summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-09-06 13:59:05 +0200
committervarac <varacanero@zeromail.org>2016-09-06 13:59:05 +0200
commit5fbd43d5a948ac7773955a26c1d0cb0db42252d9 (patch)
treed1f9b2d6b2ad015fec1f53256887b39838748d5f
parentcb6740619fe003b4a1956a413844a1a2bfa4b9de (diff)
git subrepo clone https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated
subrepo: subdir: "files/puppet/modules/pixelated" merged: "6086b94" upstream: origin: "https://github.com/pixelated/puppet-pixelated.git" branch: "master" commit: "6086b94" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "1e79595"
-rw-r--r--files/puppet/modules/pixelated/.fixtures-latest.yml11
-rw-r--r--files/puppet/modules/pixelated/.fixtures-leap-pinned.yml14
-rw-r--r--files/puppet/modules/pixelated/.fixtures.yml8
-rw-r--r--files/puppet/modules/pixelated/.gitignore9
-rw-r--r--files/puppet/modules/pixelated/.gitrepo11
-rw-r--r--files/puppet/modules/pixelated/.rspec2
-rw-r--r--files/puppet/modules/pixelated/Gemfile12
-rw-r--r--files/puppet/modules/pixelated/LICENSE661
-rw-r--r--files/puppet/modules/pixelated/README.md114
-rw-r--r--files/puppet/modules/pixelated/Rakefile20
-rw-r--r--files/puppet/modules/pixelated/files/0x287A1542472DC0E3_packages@pixelated-project.org.asc28
-rw-r--r--files/puppet/modules/pixelated/files/Debian/51unattended-upgrades_pixelated7
-rw-r--r--files/puppet/modules/pixelated/files/check_mk/check_pixelated_user_agent.sh11
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/__init__.py18
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/account.feature47
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature33
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature32
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/environment.py98
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/forward_trash_archive.feature35
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/login_and_send_an_email.feature32
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/__init__.py29
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/base_page_object.py87
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/compose_box.py78
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py53
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py61
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_list.py65
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py83
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/maillist_actions.py51
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/notification.py35
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/pixelated_page.py56
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py66
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/user_agent_pages.py72
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature32
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/send_mail.feature48
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py101
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/account.py84
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/common.py85
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/compose.py41
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/delete_mail.py38
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/login.py26
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py147
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/mail_view.py98
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/search.py35
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/send_email_to_self.py28
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py131
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/tag_list.py50
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature35
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/test_requirements.txt4
-rw-r--r--files/puppet/modules/pixelated/files/leap_test.rb19
-rwxr-xr-xfiles/puppet/modules/pixelated/files/phantomjsbin0 -> 67932064 bytes
-rw-r--r--files/puppet/modules/pixelated/files/syslog/pixelated9
-rw-r--r--files/puppet/modules/pixelated/files/webapp/locales/en.yml2
-rw-r--r--files/puppet/modules/pixelated/files/webapp/views/common/_download_button.html.haml0
-rw-r--r--files/puppet/modules/pixelated/manifests/agent.pp81
-rw-r--r--files/puppet/modules/pixelated/manifests/apt.pp21
-rw-r--r--files/puppet/modules/pixelated/manifests/apt/preferences.pp18
-rw-r--r--files/puppet/modules/pixelated/manifests/init.pp5
-rw-r--r--files/puppet/modules/pixelated/manifests/remove.pp9
-rw-r--r--files/puppet/modules/pixelated/manifests/syslog.pp18
-rw-r--r--files/puppet/modules/pixelated/manifests/tests.pp57
-rw-r--r--files/puppet/modules/pixelated/manifests/unattended_upgrades.pp10
-rwxr-xr-xfiles/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh36
-rw-r--r--files/puppet/modules/pixelated/spec/classes/agent_spec.rb48
-rw-r--r--files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb26
-rw-r--r--files/puppet/modules/pixelated/spec/classes/apt_spec.rb21
-rw-r--r--files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb30
-rw-r--r--files/puppet/modules/pixelated/spec/classes/remove_spec.rb6
-rw-r--r--files/puppet/modules/pixelated/spec/classes/syslog_spec.rb24
-rw-r--r--files/puppet/modules/pixelated/spec/classes/tests_spec.rb50
-rw-r--r--files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml7
-rw-r--r--files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml9
-rw-r--r--files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml11
-rw-r--r--files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml9
-rw-r--r--files/puppet/modules/pixelated/spec/spec_helper.rb12
-rw-r--r--files/puppet/modules/pixelated/templates/05-pixelated.conf.erb7
-rw-r--r--files/puppet/modules/pixelated/templates/pixelated-apache.conf.erb60
-rw-r--r--files/puppet/modules/pixelated/templates/pixelated-server-default9
-rw-r--r--files/puppet/modules/pixelated/templates/webapp/show.html.haml.erb6
-rwxr-xr-xfiles/puppet/modules/pixelated/vagrant_platform.sh19
79 files changed, 3561 insertions, 0 deletions
diff --git a/files/puppet/modules/pixelated/.fixtures-latest.yml b/files/puppet/modules/pixelated/.fixtures-latest.yml
new file mode 100644
index 0000000..acee2b6
--- /dev/null
+++ b/files/puppet/modules/pixelated/.fixtures-latest.yml
@@ -0,0 +1,11 @@
+fixtures:
+ symlinks:
+ pixelated: "#{source_dir}"
+ repositories:
+ lsb: "https://leap.se/git/puppet_lsb"
+ common: "https://leap.se/git/puppet_common"
+ rsyslog: "https://leap.se/git/puppet_rsyslog"
+ concat: "https://leap.se/git/puppet_concat"
+ apache: "https://leap.se/git/puppet_apache"
+ stdlib: " https://leap.se/git/puppet_stdlib"
+ templatewlv: "https://github.com/duritong/puppet-templatewlv"
diff --git a/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml b/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml
new file mode 100644
index 0000000..fff8ea7
--- /dev/null
+++ b/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml
@@ -0,0 +1,14 @@
+fixtures:
+ symlinks:
+ pixelated: "#{source_dir}"
+ lsb: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/lsb"
+ common: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/common"
+ rsyslog: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/rsyslog"
+ concat: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/concat"
+ apache: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/apache"
+ templatewlv: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/templatewlv"
+ repositories:
+ leap_platform:
+ repo: "https://github.com/pixelated/leap_platform.git"
+ flags: "--recursive"
+
diff --git a/files/puppet/modules/pixelated/.fixtures.yml b/files/puppet/modules/pixelated/.fixtures.yml
new file mode 100644
index 0000000..cd5881c
--- /dev/null
+++ b/files/puppet/modules/pixelated/.fixtures.yml
@@ -0,0 +1,8 @@
+fixtures:
+ symlinks:
+ pixelated: "#{source_dir}"
+ repositories:
+ lsb: "https://leap.se/git/puppet_lsb"
+ common: "https://leap.se/git/puppet_common"
+ rsyslog: "https://leap.se/git/puppet_rsyslog"
+ concat: "https://leap.se/git/puppet_concat"
diff --git a/files/puppet/modules/pixelated/.gitignore b/files/puppet/modules/pixelated/.gitignore
new file mode 100644
index 0000000..f974e08
--- /dev/null
+++ b/files/puppet/modules/pixelated/.gitignore
@@ -0,0 +1,9 @@
+# ignore rake spec module checkouts
+**/spec/fixtures/modules/
+**/spec/fixtures/manifests/
+/Gemfile.lock
+# deployed by vagrant_platform.sh
+/leap_platform
+# ignore files created by functional test
+/files/functional-tests/ghostdriver.log
+*.pyc
diff --git a/files/puppet/modules/pixelated/.gitrepo b/files/puppet/modules/pixelated/.gitrepo
new file mode 100644
index 0000000..ac9a4c4
--- /dev/null
+++ b/files/puppet/modules/pixelated/.gitrepo
@@ -0,0 +1,11 @@
+; DO NOT EDIT (unless you know what you are doing)
+;
+; This subdirectory is a git "subrepo", and this file is maintained by the
+; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
+;
+[subrepo]
+ remote = https://github.com/pixelated/puppet-pixelated.git
+ branch = master
+ commit = 6086b945165d075e911c6afc6cfc53c9932586c2
+ parent = cb6740619fe003b4a1956a413844a1a2bfa4b9de
+ cmdver = 0.3.0
diff --git a/files/puppet/modules/pixelated/.rspec b/files/puppet/modules/pixelated/.rspec
new file mode 100644
index 0000000..16f9cdb
--- /dev/null
+++ b/files/puppet/modules/pixelated/.rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
diff --git a/files/puppet/modules/pixelated/Gemfile b/files/puppet/modules/pixelated/Gemfile
new file mode 100644
index 0000000..4d5e1c9
--- /dev/null
+++ b/files/puppet/modules/pixelated/Gemfile
@@ -0,0 +1,12 @@
+source "https://rubygems.org"
+
+group :test do
+ gem "rake",'< 11'
+ gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
+ gem "rspec", '< 3.2.0'
+ gem "rspec-puppet"
+ gem "puppetlabs_spec_helper"
+ gem "metadata-json-lint"
+ gem "rspec-puppet-facts"
+ gem "rspec-puppet-utils"
+end
diff --git a/files/puppet/modules/pixelated/LICENSE b/files/puppet/modules/pixelated/LICENSE
new file mode 100644
index 0000000..dba13ed
--- /dev/null
+++ b/files/puppet/modules/pixelated/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
diff --git a/files/puppet/modules/pixelated/README.md b/files/puppet/modules/pixelated/README.md
new file mode 100644
index 0000000..7e319d2
--- /dev/null
+++ b/files/puppet/modules/pixelated/README.md
@@ -0,0 +1,114 @@
+puppet-pixelated
+================
+
+[![Build Status](https://snap-ci.com/pixelated/puppet-pixelated/branch/master/build_image)](https://snap-ci.com/pixelated/puppet-pixelated/branch/master)
+
+**Pixelated is in an early stage of development! Things may not work to their full extent yet**
+
+This puppet module provides a simple way to add Pixelated to a running [LEAP Platform](https://leap.se/en/docs/platform).
+It sets up the [Pixelated User-Agent](https://github.com/pixelated/pixelated-user-agent).
+
+### High level Architecture
+#### Pixelated Platform
+
+![High-level Architecture](https://raw.githubusercontent.com/pixelated/website/master/assets/images/pixelated-user-agent.png)
+
+
+Testing Pixelated
+=================
+
+If you want to have a look at pixelated, the easiest way ist to run everything inside [vagrant](https://www.vagrantup.com/). The following command
+installs a working LEAP Platform, the pixelated-user-agent. You can create accounts
+by visiting the LEAP Webapp at <https://localhost:4443/signup> and see Pixelated in action at <https://localhost:8080/>.
+Be aware that you will not be able to send mails outside, but you can test sending mails internally from one user to another.
+
+```bash
+ curl https://raw.githubusercontent.com/pixelated/puppet-pixelated/master/vagrant_platform.sh | sh
+```
+
+Manual installation
+===================
+
+## 1 Creating a LEAP Provider
+
+Pixelated is built on top of LEAP, so in order to have a Pixelated Platform, you need to have a LEAP Platform.
+
+In this example, we use a single node setup. Please refer to <https://leap.se/en/docs/platform/tutorials/single-node-email> for help with setting up a LEAP provider.
+We assume that you have the LEAP platform and the configuration for your LEAP node on your local workstation. If you followed the tutorial you should have the following directories:
+
+* `~/leap/leap_plaform`: the LEAP platform itself
+* `~/leap/example`: the configuration for your LEAP provider node
+
+Ideally you have run `leap deploy` and `leap test` to set up the node on a server and verify that the installation actually works.
+
+
+### 2 Adding Pixelated to your existing LEAP configuration
+
+This puppet module take care of (almost) everything. It will install the pixelated-user-agent.
+
+Please note that currently, you need proper DNS entries for your provider domain and all of its subdomains (`hostname1.DOMAIN`, `DOMAIN`, `api.DOMAIN` and `nicknym.DOMAIN`).
+You can access your LEAP provider with only local DNS overrides, but you cannot do this for the pixelated user agent.
+
+Add the pixelated-platform files to `files/puppet` inside your LEAP configuration folder.
+
+```bash
+ cd ~/leap/example
+ mkdir -p files/puppet/modules
+```
+
+
+The documentation for the installation of the LEAP Platform suggests that you make the configuration folder (`~/leap/example` is the name they suggest) versioned using Git to make it easier to track and undo any changes on the configuration. If you followed this suggestion of the tutorial, the easiest way to get the Pixelated platform is to add it as a submodule.
+
+```bash
+ git submodule add https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated
+```
+
+If you haven't added version control to your LEAP configuration, you can simply clone the Pixelated platform files into your node configuration.
+
+```bash
+ git clone https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated
+```
+
+Include the `::pixelated` class in the `custom` class, which gets automatically applied by the leap_platform.
+
+```bash
+ mkdir -p files/puppet/modules/custom/manifests
+ echo '{}' > services/pixelated.json
+ echo 'class custom { include ::pixelated}' > files/puppet/modules/custom/manifests/init.pp
+```
+
+
+### 3 Installing Pixelated on the LEAP provider node
+
+With Pixelated added to the configuration simply re-run the LEAP deployment.
+
+ leap deploy
+ leap test
+
+When this completes Pixelated should be ready and available on port 8080 on your LEAP provider.
+
+Have fun!
+
+
+### Running Funcional Tests (local)
+
+From:
+```$cd /puppet-pixelated/files/functional-tests/```
+
+Install python dependencies:
+```$pip install -r test_requirements.txt```
+
+Install phantomjs:
+```$npm install phantomjs -g```
+
+Setting staging host as pixelated-platform on the TESTHOST environment variable:
+```$export TESTHOST=staging.pixelated-project.org```
+
+And to run:
+$behave
+
+To run a feature:
+```$behave -t @mail_to_myself```
+
+To run a set of tests:
+```$behave -t @staging```
diff --git a/files/puppet/modules/pixelated/Rakefile b/files/puppet/modules/pixelated/Rakefile
new file mode 100644
index 0000000..7fb499f
--- /dev/null
+++ b/files/puppet/modules/pixelated/Rakefile
@@ -0,0 +1,20 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+PuppetLint.configuration.send('disable_80chars')
+PuppetLint.configuration.send('disable_fileserver')
+PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
+
+desc "Validate manifests, templates, and ruby files"
+task :validate do
+ Dir['manifests/**/*.pp'].each do |manifest|
+ sh "puppet parser validate --noop #{manifest}"
+ end
+ Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
+ sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
+ end
+ Dir['templates/**/*.erb'].each do |template|
+ sh "erb -P -x -T '-' #{template} | ruby -c"
+ end
+end
+
+task :test => [:lint, :syntax , :validate, :spec]
diff --git a/files/puppet/modules/pixelated/files/0x287A1542472DC0E3_packages@pixelated-project.org.asc b/files/puppet/modules/pixelated/files/0x287A1542472DC0E3_packages@pixelated-project.org.asc
new file mode 100644
index 0000000..0e903e6
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/0x287A1542472DC0E3_packages@pixelated-project.org.asc
@@ -0,0 +1,28 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQMuBFQFs9YRCACSwF49RDAnCE0UplrTTpymDjEEFA9G+34TLL3NNLBlY+ldkS94
+ZHFH5Gt8j3HqbPlDPaV9aUPl8f3CFSL8qWT3LbDk/jmIcIG+UHdMuYAEQayuFbWg
+yWa3pHm57yJxaxHMrAddWffNMZswoc2Qu1M6S3ekMPN9Cow9XLhP5zGgrI2qR7sV
+F5uqI1rX345BXRqqZqZ4mpDgEafb29YR3gQbGWlJZ1/Rjia2OdzW5RcfhIHuoZaB
+NM2b8VCvQNanowz01EVLIZLI77oFsU0fnuHRiqcxwNlMBvO0dv/72anmx4Q4iAW+
+GqiMe6G7eu3InUNFYl+zU9JQjZSQCqGvfySjAQCUZmEjsj2hPMFn8juV4zIpzTEd
+ruwmfwIFkf9NM8MvaQf/dTHa+UkPEwXKjDhYdmvb/PCQSHF4ghxDiNUAqZtSlDf5
+Wh/oZJ6hhZyyOwnbUgG0+WMFen7qzD146gxgx1go6YnYnPFDamYncyZfuISWHSeD
+0C/54XhD1akdOHfI4aw9ZlQ2F9JKtXiFXa2g34vwNLiFtWtYCR29+1S40xOd+tv5
+5M2TYoPjEKWm92Wa7ZCF2L83qy/B8jZWgwSSWgXXWhBTrAu2S8Xi5adrCJLfSeoO
+Vp8TN3eXJYIAbq1GFJlI9rv8+yNshzoyUbKGtptSezpAywKXoyVsHaSfoKHypQaw
+LlNePVubweIcxPOJZAPmD/uafzAKEzUcjCAVNaBNbgf+ODSeI6WjITR0NH0os/vs
+UjiUy3WZX+FQxaWaK5F+dpw0QutvFjiGr8k2jsTjekXvCUlX0Uh87+eHKlzc9iaW
+m3cqVohVBeRyjHuNaS0e8e8WVaZIPyJS7eq5gJHjOsZpXjcR5wpt2QJFdcnbgG+m
+cIro0uakMvkkSaRUnIuIywtbsUGi03CRBDXg3u9grwAEk6k7Af0iSvigblQ3cZKI
+C87zHfAH3fJxp0xVfCkNBgBt2FL/tIRJLy6x5Jyas62k+n/xkymGlyLNTRXv28se
+xFh2bOGKy2yL3LZuh255UWMum+7aI5EECnyB88Be1NrhwPbKeC5/f93SZ0QsFjmJ
+e7RIUGl4ZWxhdGVkIFByb2plY3QgQXV0b21hdGljIFNpZ25pbmcgS2V5IDxwYWNr
+YWdlc0BwaXhlbGF0ZWQtcHJvamVjdC5vcmc+iH8EExEKACcFAlQFs9YCGwMFCQHh
+M4AFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQKHoVQkctwOPmRgD+LGIfe3NJ
+pbKU3j+beXHSk36kbtITskgsRnwoc8QQT/EA/jE2LMSSkI+aPA1kF0m6A+30TPDc
+3twWBOaj2fhknvmViH8EExEKACcCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AF
+AlfNQJsFCQeJ88MACgkQKHoVQkctwOPgqAD8DrABUvBsu3xTH6pHZPpqtozM1425
+DANGvoyN59+RHd0A/0kk9gRu445VjtnW8xTywwAKq3qSsrJAtUPIip4/Q6Hb
+=zJDU
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/files/puppet/modules/pixelated/files/Debian/51unattended-upgrades_pixelated b/files/puppet/modules/pixelated/files/Debian/51unattended-upgrades_pixelated
new file mode 100644
index 0000000..421dc27
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/Debian/51unattended-upgrades_pixelated
@@ -0,0 +1,7 @@
+// this file is managed by puppet !
+
+Unattended-Upgrade::Allowed-Origins {
+ "pixelated:stable";
+ "pixelated:snapshots";
+}
+
diff --git a/files/puppet/modules/pixelated/files/check_mk/check_pixelated_user_agent.sh b/files/puppet/modules/pixelated/files/check_mk/check_pixelated_user_agent.sh
new file mode 100644
index 0000000..a2d81a9
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/check_mk/check_pixelated_user_agent.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+STATUS[0]='OK'
+STATUS[1]='Critical'
+STATUS[2]='Critical'
+CHECKNAME='Dispatcher_Proxy'
+
+MESSAGE=$(/usr/lib/nagios/plugins/check_procs -a '/usr/bin/pixelated-user-agent' -c 1:1)
+SERVICESTATUS=$?
+echo "${SERVICESTATUS} ${CHECKNAME} running=1 ${MESSAGE}"
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/__init__.py b/files/puppet/modules/pixelated/files/functional-tests/__init__.py
new file mode 100644
index 0000000..7a50bed
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/__init__.py
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+# from page_objects import *
+import page_objects
diff --git a/files/puppet/modules/pixelated/files/functional-tests/account.feature b/files/puppet/modules/pixelated/files/functional-tests/account.feature
new file mode 100644
index 0000000..0acca0a
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/account.feature
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+@staging
+Feature: account
+
+ @register
+ Scenario: user goes to signup-page
+ When I visit the signup-page
+ Then I should see a signup button
+
+ @register
+ Scenario: user goes to signup-page and registers new account
+ When I visit the signup-page
+ And I register
+ Then I see the control-panel
+
+ @login
+ Scenario: user goes to user-agent
+ When I visit the user-agent
+ Then I should see a login button
+
+ @login
+ Scenario: user goes to user-agent and enters credentials
+ When I visit the user-agent
+ And I login
+ Then I see the inbox
+
+ @logout
+ Scenario: user logs out
+ When I visit the user-agent
+ And I login
+ When I logout
+ And I visit the user-agent
+ Then I should see a login button
diff --git a/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature b/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature
new file mode 100644
index 0000000..430887c
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+
+@user_agent
+Feature: Checkboxes
+ As a user of Pixelated
+ I want to use checkboxes to manage my emails
+ So I can manage more than one email at once
+
+ Scenario: User has a list of emails in each mailboxes that needs to be managed
+ Given I login as behave-testuser
+ When I mark the first unread email as read
+ And I delete the email
+ When I select the tag 'trash'
+ Then the deleted mail is there
+ When I check all emails
+ And I delete them permanently
+ Then I should not see any email
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature b/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature
new file mode 100644
index 0000000..95bcc4c
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+@user_agent
+Feature: compose mail, save draft and send mail
+ As a user of Pixelated
+ I want to save drafts
+ So I can review and send them later
+
+ Scenario: user composes and email, save the draft, later sends the draft and checks the sent message
+ Given I login as behave-testuser
+ When I compose a message to 'pixelated@friends.org'
+ When I select the tag 'drafts'
+ When I open the first mail in the mail list
+ And I send it
+ When I select the tag 'sent'
+ And I open the first mail in the mail list
+ Then I see that the subject reads 'Pixelated rocks!'
+ Then I see that the body reads 'You should definitely use it. Cheers, User.'
diff --git a/files/puppet/modules/pixelated/files/functional-tests/environment.py b/files/puppet/modules/pixelated/files/functional-tests/environment.py
new file mode 100644
index 0000000..9eb6b68
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/environment.py
@@ -0,0 +1,98 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from page_objects import SignUpPage, LeapLoginPage
+from selenium import webdriver
+from selenium.webdriver.common.by import By
+from steps.common import get_invite_code, RandomUser
+from steps import behave_testuser, behave_password, delete_soledad_server_db, delete_soledad_client_db, signup_url
+
+
+def before_all(context):
+ set_browser(context)
+ create_behave_user(context)
+ context.random_user = RandomUser
+
+
+def after_step(context, step):
+ screenshot_filename = '{step_name}.png'
+
+ if step.status == 'failed':
+ take_screenshot(context,
+ screenshot_filename.format(step_name=step.name))
+ log_browser_console(context, step)
+ save_page_source(context, step)
+
+
+def after_scenario(context, scenario):
+ context.browser.delete_all_cookies()
+
+
+def after_all(context):
+ _delete_user(context, behave_testuser(), behave_password())
+ _delete_user(context, context.random_user.username, context.random_user.password)
+ if hasattr(context, 'browser'):
+ context.browser.quit()
+
+
+def _delete_user(context, username, password):
+ user_id = LeapLoginPage(context).destroy_account(username, password)
+ delete_soledad_server_db(user_id, username)
+ delete_soledad_client_db(user_id)
+
+
+def save_page_source(context, step):
+ page_source_filename = '{step_name}.html'.format(step_name=step.name)
+ with open(page_source_filename, 'w') as page_source:
+ page_source.write(context.browser.page_source)
+
+
+def log_browser_console(context, step):
+ console_log_filename = '{step_name}.log'.format(step_name=step.name)
+ with open(console_log_filename, 'w') as console_log_file:
+ line = '{time} {level}: {message}\n'
+ log_lines = []
+ for log in context.browser.get_log('browser'):
+ log_lines.append(line.format(time=log['timestamp'],
+ level=log['level'],
+ message=log['message']))
+ console_log_file.writelines(log_lines)
+
+
+def take_screenshot(context, filename):
+ context.browser.save_screenshot(filename)
+
+
+def set_browser(context):
+ # context.browser = webdriver.Firefox()
+ #context.browser = webdriver.Chrome()
+ context.browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=yes'])
+ context.browser.set_window_size(1280, 1024)
+ context.browser.implicitly_wait(10)
+ context.browser.set_page_load_timeout(60)
+
+
+def create_behave_user(context):
+ username = behave_testuser()
+ password = behave_password()
+ context.browser.get(signup_url())
+ signup_page = SignUpPage(context)
+ signup_page.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, 'input#srp_username'))
+ signup_page.enter_username(username)
+ signup_page.enter_password(password)
+ signup_page.enter_password_confirmation(password)
+ signup_page.enter_invite_code(get_invite_code())
+ signup_page.click_signup_button()
+ # context.browser.quit()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/forward_trash_archive.feature b/files/puppet/modules/pixelated/files/functional-tests/forward_trash_archive.feature
new file mode 100644
index 0000000..8883170
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/forward_trash_archive.feature
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+@user_agent
+Feature: forward and deletion
+ As a user of Pixelated
+ I want to forward emails using CC and Bcc features
+ So I can take actions
+
+ Scenario: User forwards a mail, add CC and BCC address, later trash the mail
+ Given I have a mail in my inbox
+ When I open the first mail in the 'inbox'
+ And I choose to forward this mail
+ When for the 'CC' field I enter 'pixelated@friends.org'
+ And for the 'Bcc' field I enter 'pixelated@family.org'
+ And I forward this mail
+ When I open the first mail in the 'sent'
+ Then I see the mail has a cc and a bcc recipient
+ When I choose to trash
+# Then I see that mail under the 'trash' tag
+ When I select the tag 'trash'
+ And I open the first mail in the mail list
diff --git a/files/puppet/modules/pixelated/files/functional-tests/login_and_send_an_email.feature b/files/puppet/modules/pixelated/files/functional-tests/login_and_send_an_email.feature
new file mode 100644
index 0000000..d4ac9cc
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/login_and_send_an_email.feature
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+@try
+Feature: login and send mail
+
+
+ Scenario Outline: user logs in, composes and send an email, then deletes it
+ Given I login as "<user>" with password "<password>" to an organization install of pixelated
+ When I send an email to myself
+ Then I see the email on the mail list
+ Then I delete the email
+ And I delete it permanently
+
+ Examples:
+ | user | password |
+ | alice | WuSh3ohse4 |
+ | eve | Voh0ohghai |
+ | bob | quuojoo1Su |
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/__init__.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/__init__.py
new file mode 100644
index 0000000..4ca3302
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/__init__.py
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+
+from login_page import LoginPage
+from compose_box import ComposeBox
+from base_page_object import BasePageObject
+from maillist_actions import MailListActions
+from pixelated_page import PixelatedPage
+from mail_page import MailPage
+from user_agent_pages import SignUpPage
+from user_agent_pages import ControlPanelPage
+from mail_list import MailList
+from tag_list import TagList
+from notification import Notification
+from leap_login_page import LeapLoginPage \ No newline at end of file
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/base_page_object.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/base_page_object.py
new file mode 100644
index 0000000..f809128
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/base_page_object.py
@@ -0,0 +1,87 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from selenium.webdriver.support import expected_conditions as EC
+from selenium.webdriver.support.wait import WebDriverWait
+from selenium.webdriver.common.by import By
+
+
+class BasePageObject(object):
+ def __init__(self, context, timeout=10):
+ self.context = context
+ self.timeout = timeout
+
+ def _find_element_containing_text(self, text, element_type='*'):
+ return self._find_element_by_xpath("//%s[contains(.,'%s')]" % (element_type, text))
+
+ def _find_element_by_css_locator(self, locator, timeout=None, dom_context=None):
+ locator_tuple = (By.CSS_SELECTOR, locator)
+ self._wait_until(EC.visibility_of_element_located(locator_tuple), timeout or self.timeout)
+ context = dom_context or self.context.browser
+ return context.find_element_by_css_selector(locator)
+
+ def _find_element_by_id(self,id):
+ return self.context.browser.find_element_by_id(id)
+
+ def _find_elements_by_css_locator(self, locator, timeout=None):
+ locator_tuple = (By.CSS_SELECTOR, locator)
+ self._wait_until(EC.visibility_of_element_located(locator_tuple), timeout or self.timeout)
+ return self.context.browser.find_elements_by_css_selector(locator)
+
+ def _find_elements_by_xpath(self, xpath, timeout=None):
+ locator_tuple = (By.XPATH, xpath)
+ self._wait_until(EC.visibility_of_element_located(locator_tuple), timeout or self.timeout)
+ return self.context.browser.find_elements_by_xpath(xpath)
+
+ def _find_element_by_xpath(self, xpath, timeout=None, dom_context=None):
+ locator_tuple = (By.XPATH, xpath)
+ self._wait_until(EC.visibility_of_element_located(locator_tuple), timeout or self.timeout)
+ context = dom_context or self.context.browser
+ return self.context.browser.find_element_by_xpath(xpath)
+
+ def _wait_element_to_be_removed(self, locator, timeout=None):
+ locator_tuple = (By.CSS_SELECTOR, locator)
+ self._wait_until(EC.invisibility_of_element_located(locator_tuple), timeout or self.timeout)
+
+ def _wait_element_to_be_removed_by_xpath(self, xpath, timeout=None):
+ locator_tuple = (By.XPATH, xpath)
+ self._wait_until(EC.invisibility_of_element_located(locator_tuple), timeout or self.timeout)
+
+ def _wait_until(self, condition_function, timeout=None):
+ wait = WebDriverWait(self.context.browser, timeout or self.timeout)
+ wait.until(condition_function)
+
+ def wait_until_element_is_visible_by_css_locator(self, locator):
+ wait = WebDriverWait(self.context.browser, 60)
+ wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, locator)))
+ return self.context.browser.find_element_by_selector(locator)
+
+ def wait_until_elements_are_visible_by_css_locator(self, locator):
+ wait = WebDriverWait(self.context.browser, 60)
+ wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, locator)))
+
+ def wait_until_element_is_visible_by_locator(self, locator):
+ wait = WebDriverWait(self.context.browser, 60)
+ by, locator = locator
+ wait.until(EC.visibility_of_element_located((by, locator)))
+ return self.context.browser.find_element(by, locator)
+
+ def wait_until_element_is_invisible_by_locator(self, locator):
+ wait = WebDriverWait(self.context.browser, 60)
+ by, locator = locator
+ wait.until(EC.invisibility_of_element_located((by, locator)))
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/compose_box.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/compose_box.py
new file mode 100644
index 0000000..cade132
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/compose_box.py
@@ -0,0 +1,78 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from base_page_object import BasePageObject
+
+
+class ComposeBox(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'subject': 'input#subject',
+ 'body': 'textarea#text-box',
+ 'to': 'input.tt-input',
+ 'send_button': 'button#send-button',
+ 'compose_box': 'div#compose-box',
+ 'reply_subject': '#reply-subject'
+ }
+ super(ComposeBox, self).__init__(context, timeout)
+
+ def enter_body(self, body):
+ self._body_field().send_keys(body)
+ return self
+
+ def enter_subject(self, subject):
+ self._subject_field().send_keys(subject)
+ return self
+
+ def enter_recipients(self, recipients):
+ if type(recipients) is list:
+ for recipient in recipients:
+ self.enter_recipient(recipient)
+ else:
+ self.enter_recipient(recipients)
+ return self
+
+ def enter_recipient(self, recipient):
+ self._to_field().send_keys(recipient)
+ self._to_field().send_keys('\n')
+ return self
+
+ def send_mail(self):
+ self._send_mail_button().click()
+
+ def save_draft(self):
+ self._find_element_by_css_locator('button#draft-button').click()
+
+ def choose_from_suggestions(self):
+ self._find_element_by_css_locator('.tt-dropdown-menu div div').click()
+
+ def wait_compose_box_to_disappear(self):
+ self._wait_element_to_be_removed(self._locators['compose_box'], 120)
+
+ def get_reply_subject(self):
+ return self._find_elements_by_css_locator(self._locators['reply_subject'])
+
+ def _subject_field(self):
+ return self._find_element_by_css_locator(self._locators['subject'])
+
+ def _body_field(self):
+ return self._find_element_by_css_locator(self._locators['body'])
+
+ def _to_field(self):
+ return self._find_element_by_css_locator(self._locators['to'])
+
+ def _send_mail_button(self):
+ return self._find_element_by_css_locator(self._locators['send_button'])
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py
new file mode 100644
index 0000000..70b38b3
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/leap_login_page.py
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from selenium.webdriver.common.by import By
+
+from login_page import LoginPage
+from steps import leap_login_url
+
+
+class LeapLoginPage(LoginPage):
+ def __init__(self, context, timeout=10):
+ super(LeapLoginPage, self).__init__(context, timeout)
+ self._locators = {
+ 'username': 'input#srp_username',
+ 'password': 'input#srp_password',
+ 'login_button': 'button[type=submit]',
+ }
+ self.url = leap_login_url()
+
+ def _visit_page(self):
+ self.context.browser.delete_all_cookies()
+ self.context.browser.get(self.url)
+
+ def _login(self, username, password):
+ self._visit_page()
+ self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, 'input#srp_username'))
+ self.enter_username(username).enter_password(password).login()
+
+ def destroy_account(self, username, password):
+ self._login(username, password)
+ self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, 'a[href="/logout"]'))
+ return self._confirm_destroy_account()
+
+ def _confirm_destroy_account(self):
+ current_url = self.context.browser.current_url
+ user_id = current_url.split("/")[-1]
+ self.context.browser.get(current_url + '/edit')
+ delete_button_selector = 'a[href="/users/' + user_id + '"][data-method="delete"]'
+ self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, delete_button_selector))
+ self._find_elements_by_css_locator(delete_button_selector)[0].click()
+ return user_id
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py
new file mode 100644
index 0000000..ae6e31c
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from base_page_object import BasePageObject
+from selenium.common.exceptions import TimeoutException
+
+
+class LoginPage(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'username': 'input#email',
+ 'password': 'input#password',
+ 'login_button': 'input[type=submit]',
+ 'hive_svg': 'svg#hive'
+ }
+ super(LoginPage, self).__init__(context, timeout)
+
+ def enter_username(self, username):
+ self._username_field().send_keys(username)
+ return self
+
+ def enter_password(self, password):
+ self._password_field().send_keys(password)
+ return self
+
+ def login(self):
+ self._login_button().click()
+ return self
+
+ def _username_field(self):
+ return self._find_element_by_css_locator(self._locators['username'])
+
+ def _password_field(self):
+ return self._find_element_by_css_locator(self._locators['password'])
+
+ def _login_button(self):
+ return self._find_element_by_css_locator(self._locators['login_button'])
+
+ def wait_interstitial_page(self, time=180):
+ if self._is_interstitial_page_displayed():
+ self._wait_element_to_be_removed(self._locators['hive_svg'], time)
+
+ def _is_interstitial_page_displayed(self):
+ try:
+ self._find_element_by_css_locator(self._locators['hive_svg'], 2)
+ return True
+ except TimeoutException:
+ return False
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_list.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_list.py
new file mode 100644
index 0000000..7ffb76d
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_list.py
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from base_page_object import BasePageObject
+from selenium.common.exceptions import TimeoutException
+from time import sleep
+
+class MailList(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'mail_items': '//a[contains(@class, "mail-list-entry__item") and contains(., "{sender}") and contains(., "{subject}")]',
+ 'mailbox_mails': '.mail-list-entry__item[href*="{mailbox}"]',
+ 'all_mails': '.mail-list-entry',
+ 'checkboxes': '.mail-list-entry__checkbox input[type="checkbox"]'
+ }
+ super(MailList, self).__init__(context, timeout)
+
+ def is_mail_on_list(self, sender, subject, timeout=None):
+ try:
+ self.select_mail(sender, subject, timeout)
+ return True
+ except TimeoutException:
+ return False
+
+ def is_mail_not_on_the_list(self, sender, subject):
+ try:
+ xpath = self._locators['mail_items'].format(
+ sender=sender,
+ subject=subject)
+ self._wait_element_to_be_removed_by_xpath(xpath)
+ return True
+ except TimeoutException:
+ return False
+
+ def is_there_emails(self):
+ return len(self.context.browser.find_elements_by_css_selector(self._locators['all_mails'])) > 0
+
+ def get_all_emails(self):
+ return self.context.browser.find_elements_by_css_selector(self._locators['all_mails'])
+
+ def is_mailbox_loaded(self,context, mailbox):
+ self.wait_until_elements_are_visible_by_css_locator((self._locators['mailbox_mails']).format(mailbox=mailbox))
+
+ def select_mail(self, sender, subject, timeout=180):
+ xpath = self._locators['mail_items'].format(sender=sender, subject=subject)
+ self._find_element_by_xpath(xpath, timeout=timeout).click()
+
+ def mark_nth_checkbox(self, position):
+ checkboxes = self._find_elements_by_css_locator(self._locators['checkboxes'])
+ checkboxes[position].click()
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py
new file mode 100644
index 0000000..d92290b
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py
@@ -0,0 +1,83 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from selenium.webdriver.common.keys import Keys
+
+from base_page_object import BasePageObject
+from compose_box import ComposeBox
+
+class MailPage(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'encrypted_flag': '.security-status__label--encrypted',
+ 'unencrypted_flag': '.security-status__label--not-encrypted',
+ 'undercryptable_flag': '.security-status__label--encryption-error',
+ 'subject': '#mail-view .subject',
+ 'body': '#mail-view .bodyArea',
+ 'tags': '#mail-view .tagsArea .tag',
+ 'add_tag_button': '#new-tag-button',
+ 'add_tag_input': '#new-tag-input',
+ 'reply_button': 'Reply',
+ 'forward_button': 'button#forward-button',
+ 'cc': '.msg-header .cc',
+ 'bcc': '.msg-header .bcc',
+ 'delete': 'span#delete-button-top',
+ 'more_actions': '#mail-view #view-more-actions'
+ }
+ super(MailPage, self).__init__(context, timeout)
+
+ def check_mail_flag(self, flag):
+ self._find_element_by_css_locator(self._locators[flag])
+
+ def get_subject(self):
+ return self._find_element_by_css_locator(self._locators['subject'])
+
+ def get_body(self):
+ return self._find_element_by_css_locator(self._locators['body'])
+
+ def get_tags(self):
+ return self._find_elements_by_css_locator(self._locators['tags'])
+
+ def add_tag(self, tag):
+ # import pdb; pdb.set_trace()
+ self._find_element_by_css_locator(self._locators['add_tag_button']).click()
+ self._find_element_by_css_locator(self._locators['add_tag_input']).send_keys(tag + Keys.ENTER)
+
+ def press_reply_button(self):
+ self._find_element_containing_text(self._locators['reply_button'], 'button').click()
+
+ def mail_has_cc_and_bcc(self):
+ cc = self._find_element_by_css_locator(self._locators['cc']).text
+ bcc = self._find_element_by_css_locator(self._locators['bcc']).text
+
+ return (cc is not None) and (bcc is not None)
+
+ def reply_mail(self):
+ self.press_reply_button()
+ compose_box = ComposeBox(self.context)
+ self.context.reply_subject = compose_box.get_reply_subject()
+ compose_box.send_mail()
+
+ def forward_mail(self):
+ self._find_elements_by_css_locator(self._locators['forward_button']).click()
+
+ def remove_tags(self):
+ tags = self._find_elements_by_css_locator(self._locators['tags'])
+ for tag in tags:
+ tag.click()
+
+ def delete_mail(self):
+ self._find_element_by_css_locator(self._locators['more_actions']).click()
+ self._find_element_by_css_locator(self._locators['delete']).click()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/maillist_actions.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/maillist_actions.py
new file mode 100644
index 0000000..64c705a
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/maillist_actions.py
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from selenium.webdriver.common.keys import Keys
+
+from base_page_object import BasePageObject
+
+
+class MailListActions(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'compose_mail_button': 'div#compose-trigger',
+ 'delete_selected_button': 'input#delete-selected',
+ 'delete_successful_message': '//span[contains("Your messages were moved to trash!")]',
+ 'search': '#search-trigger input[type="search"]',
+ 'select_all_mails': '#toggle-check-all-emails'
+ }
+ super(MailListActions, self).__init__(context, timeout)
+
+ def open_compose_box(self):
+ self._compose_mail_button().click()
+
+ def delete_selected_mails(self):
+ self._delete_selected_button().click()
+
+ def select_all_mails(self):
+ self._find_element_by_css_locator(self._locators['select_all_mails']).click()
+
+ def do_search(self, search_term):
+ search_box = self._find_element_by_css_locator(self._locators['search'])
+ search_box.send_keys(search_term + Keys.ENTER)
+
+ def _compose_mail_button(self):
+ return self._find_element_by_css_locator(self._locators['compose_mail_button'])
+
+ def _delete_selected_button(self):
+ return self._find_element_by_css_locator(self._locators['delete_selected_button'])
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/notification.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/notification.py
new file mode 100644
index 0000000..35042dd
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/notification.py
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from base_page_object import BasePageObject
+from selenium.webdriver.common.by import By
+
+class Notification(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'message_sent': '#user-alerts:contains("Your message was sent!")',
+ 'message_deleted': '#user-alerts:contains("Your message was moved to trash!")'
+ }
+ super(Notification, self).__init__(context, timeout)
+
+ def wait_for_notification(self, notification):
+ print "Waiting for message sent notification"
+ self._find_element_by_css_locator(self._locators[notification])
+ print "Notification found"
+ return self
+
+ def wait_until_notification_is_gone(self):
+ self.wait_until_element_is_invisible_by_locator(By.ID, 'user-alerts') \ No newline at end of file
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/pixelated_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/pixelated_page.py
new file mode 100644
index 0000000..79c372f
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/pixelated_page.py
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from compose_box import ComposeBox
+from maillist_actions import MailListActions
+from mail_list import MailList
+from tag_list import TagList
+import random
+import string
+
+
+class PixelatedPage(object):
+ def __init__(self, context, timeout=10):
+ self.maillist_actions = MailListActions(context)
+ self.compose_box = ComposeBox(context)
+ self.mail_list = MailList(context)
+ self.tag_list = TagList(context)
+
+ def compose_and_send_email(self, mail_fields):
+ self.maillist_actions.open_compose_box()
+ self.compose_box.enter_subject(mail_fields['subject']).enter_body(mail_fields['body']).enter_recipients(mail_fields['recipients'])
+ self.compose_box.send_mail()
+ self.compose_box.wait_compose_box_to_disappear()
+ return self
+
+ def delete_mail(self, sender, subject, timeout=None):
+ self.mail_list.select_mail(sender, subject, timeout)
+ self.maillist_actions.delete_selected_mails()
+ assert(self.mail_list.is_mail_not_on_the_list(sender, subject))
+ return self
+
+ def is_mail_on_list(self, sender, subject, timeout=None):
+ assert(self.mail_list.is_mail_on_list(sender, subject, timeout))
+
+ def go_to_trash(self):
+ self.tag_list.go_to_trash()
+
+ def random_subject(self):
+ if 'random_subject_string' not in globals():
+ global random_subject_string
+ random_string = ''.join(random.choice(string.lowercase) for i in range(8))
+ random_subject_string = 'Automated test, TBD (To Be Deleted): '+ random_string
+ return random_subject_string
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py
new file mode 100644
index 0000000..bc152da
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/tag_list.py
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from base_page_object import BasePageObject
+
+from selenium.webdriver.common.by import By
+
+
+class TagList(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'inbox': 'li#tag-inbox',
+ 'trash': 'li#tag-trash',
+ 'draft': 'li#tag-draft',
+ 'sent': 'li#tag-sent'
+ }
+ super(TagList, self).__init__(context, timeout)
+
+ def go_to_trash(self):
+ self._trash_tag().click()
+
+ def go_to_drafts(self):
+ self._draft_tag().click()
+
+ def go_to_inbox(self):
+ self._inbox_tag().click()
+
+ def go_to_sent(self):
+ self._sent_tag().click()
+
+ def go_to_mailbox(self, mailbox):
+ self._go_to_mailbox(mailbox).click()
+
+ def _go_to_mailbox(self, mailbox):
+ if not self._locators.has_key(mailbox):
+ # user created tag
+ return self._find_element_by_css_locator('#tag-%s' % mailbox)
+ return self._find_element_by_css_locator(self._locators[mailbox])
+
+ def _trash_tag(self):
+ return self._find_element_by_css_locator(self._locators['trash'])
+
+ def _draft_tag(self):
+ return self._find_element_by_css_locator(self._locators['draft'])
+
+ def _inbox_tag(self):
+ return self._find_element_by_css_locator(self._locators['inbox'])
+
+ def _inbox_tag(self):
+ return self._find_element_by_css_locator(self._locators['sent'])
+
+ def is_pixelated_loaded(self):
+ self.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, self._locators['inbox']))
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/user_agent_pages.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/user_agent_pages.py
new file mode 100644
index 0000000..246b88e
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/user_agent_pages.py
@@ -0,0 +1,72 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+import os
+
+from base_page_object import BasePageObject
+
+
+class SignUpPage(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'username': 'input#srp_username',
+ 'pswd': 'input#srp_password',
+ 'pswd_confirmation': 'input#srp_password_confirmation',
+ 'invite': 'input#srp_invite_code'
+ }
+ super(SignUpPage, self).__init__(context, timeout)
+
+ def enter_username(self, username):
+ self._fill_field('username', username)
+ return self
+
+ def enter_invite_code(self, invite_code):
+ if invite_code:
+ self._enter_invite_code(invite_code)
+ return self
+
+ def enter_password(self, password):
+ self._fill_field('pswd', password)
+ return self
+
+ def enter_password_confirmation(self, password):
+ self._fill_field('pswd_confirmation', password)
+ return self
+
+ def _enter_invite_code(self, invite_code):
+ self._fill_field('invite', invite_code)
+ return self
+
+ def click_signup_button(self):
+ self._signup_button().click()
+ return self
+
+ def _fill_field(self, locator_key, value):
+ field = self._find_element_by_css_locator(self._locators[locator_key])
+ field.send_keys(value)
+
+ def _signup_button(self):
+ return self.context.browser.find_element_by_name("button")
+
+
+class ControlPanelPage(BasePageObject):
+ def __init__(self, context, timeout=10):
+ self._locators = {
+ 'home': "//h1[contains(.,'user control panel')]"
+ }
+ super(ControlPanelPage, self).__init__(context, timeout)
+
+ def is_control_panel_home(self):
+ self.context.browser.find_element_by_xpath(self._locators['home']) \ No newline at end of file
diff --git a/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature b/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature
new file mode 100644
index 0000000..2ed3ecd
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+
+# XXX: must implement with HTML content
+@user_agent
+Feature: search mail and deletion
+ As a user of pixelated
+ I want to search for emails
+ So I can manage them
+
+ Scenario: User searches for a mail and deletes it
+ Given I login as behave-testuser
+ When I search for a mail with the words "mail"
+ When I open the first mail in the mail list
+ Then I see one or more mails in the search results
+ When I try to delete the first mail
+ When I select the tag 'trash'
+ Then the deleted mail is there
diff --git a/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature b/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature
new file mode 100644
index 0000000..e020fd3
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+@staging
+Feature: send_mail
+
+ @mail_to_myself
+ Scenario: user logs in end sends a mail to self
+ Given I login as behave-testuser
+ When I send a mail to myself
+# And I see that the mail was sent
+ When I open the email
+ Then I see a encrypted flag
+
+ @unencrypted
+ Scenario: user receives an unencrypted email
+ Given I send an unencrypted email
+ And I login as behave-testuser
+ When I open the unencrypted email
+ Then I see a unencrypted email flag
+
+ @wip
+ @undecryptable
+ Scenario: user receives an email we cannot decrypt
+ Given I send an email encrypted to someone else
+ And I login as behave-testuser
+ When I open the undecryptable email
+ Then I see a undecryptable flag
+
+ @logout
+ Scenario: behave-testuser logs out
+ Given I login as behave-testuser
+ When I logout
+ And I visit the user-agent
+ Then I should see a login button
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py b/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py
new file mode 100644
index 0000000..dbc9cc6
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py
@@ -0,0 +1,101 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+import os
+import subprocess
+import couchdb
+import shutil
+LEAP_HOME_FOLDER = os.environ.get('LEAP_HOME_FOLDER', '/var/lib/pixelated/.leap/')
+
+
+def detect_hostname():
+ return os.environ.get('TESTHOST') or subprocess.check_output(['hostname', '-d']).strip()
+
+hostname = detect_hostname()
+
+user_agent_address = 'https://%s' % hostname
+
+
+def url_home(port=None):
+ if port is not None:
+ return '%s:%d' % (user_agent_address, port)
+ else:
+ return user_agent_address
+
+
+def login_url():
+ return url_home(port=8083) + '/login'
+
+
+def logout_url():
+ return url_home(port=8083) + '/logout'
+
+
+def signup_url():
+ return url_home() + '/signup'
+
+
+def leap_login_url():
+ return url_home() + '/login'
+
+
+def behave_email():
+ return '%s@%s' % (behave_testuser(), hostname)
+
+
+def behave_password():
+ return 'Eido6aeg3za9ooNiekiemahm'
+
+
+def behave_testuser():
+ return 'behave-testuser'
+
+
+def _netrc_couch_credentials():
+ with open('/etc/couchdb/couchdb.netrc', 'r') as netrc:
+ netrc_line = netrc.readline().strip().split(' ')
+ credentials = {}
+ for index in xrange(0, len(netrc_line), 2):
+ credentials[netrc_line[index]] = netrc_line[index+1]
+ return credentials
+
+
+def _delete_identity(server, username):
+ email = '%s@%s' % (username, detect_hostname())
+ filter_by_user_id = '''function(doc) { if (doc['address']=='%s') { emit(doc, null);} }''' % email
+ identities = server['identities']
+ user_identities = identities.query(filter_by_user_id)
+ for ident in user_identities:
+ doc = identities.get(ident['id'])
+ identities.delete(doc)
+
+
+def _delete_data(server, user_id):
+ user_db = 'user-%s' % user_id
+ if user_db in server:
+ del server[user_db]
+
+
+def delete_soledad_server_db(user_id, username):
+ couch_credentials = _netrc_couch_credentials()
+ server = couchdb.Server("http://%(login)s:%(password)s@%(machine)s:5984" % couch_credentials)
+ _delete_identity(server, username)
+ _delete_data(server, user_id)
+
+
+def delete_soledad_client_db(user_id):
+ soledad_folder = LEAP_HOME_FOLDER + user_id
+ if os.path.exists(soledad_folder):
+ shutil.rmtree(soledad_folder)
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/account.py b/files/puppet/modules/pixelated/files/functional-tests/steps/account.py
new file mode 100644
index 0000000..51a6837
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/account.py
@@ -0,0 +1,84 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+import time
+
+from behave import *
+from steps import login_url, logout_url, signup_url
+
+from common import *
+from ..page_objects import ControlPanelPage
+from ..page_objects import LoginPage
+from ..page_objects import SignUpPage
+from ..page_objects import TagList
+
+
+@when(u'I visit the user-agent')
+def step_impl(context):
+ context.browser.get(login_url())
+
+
+@then(u'I should see a login button')
+def step_impl(context):
+ context.browser.find_element_by_name('login')
+
+
+@when(u'I login')
+def step_impl(context):
+ login_page = LoginPage(context)
+ login_page.enter_username(context.random_user.username).enter_password(context.random_user.password).login()
+ login_page.wait_interstitial_page()
+
+
+@then(u'I see the inbox')
+def step_impl(context):
+ # phantomjs can not deal with the interstitial. We need to load the
+ # website manually after the user-agent has started
+ time.sleep(30)
+ taglist = TagList(context)
+ taglist.is_pixelated_loaded()
+
+
+@when(u'I logout')
+def step_impl(context):
+ logout_button = context.browser.find_element_by_css_selector('ul#logout')
+ logout_button.click()
+
+
+@when(u'I visit the signup-page')
+def step_impl(context):
+ context.browser.get(signup_url())
+
+
+@then(u'I should see a signup button')
+def step_impl(context):
+ context.browser.find_element_by_name('button')
+
+
+@when(u'I register')
+def step_impl(context):
+ signup_page = SignUpPage(context)
+ signup_page.enter_username(context.random_user.username)
+ signup_page.enter_password(context.random_user.password)
+ signup_page.enter_password_confirmation(context.random_user.password)
+ signup_page.enter_invite_code(get_invite_code())
+ signup_page.click_signup_button()
+
+
+@then(u'I see the control-panel')
+def step_impl(context):
+ controlpanel_page = ControlPanelPage(context)
+ controlpanel_page.is_control_panel_home()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/common.py b/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
new file mode 100644
index 0000000..2db1298
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
@@ -0,0 +1,85 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+import os
+import subprocess
+
+from selenium.webdriver.common.by import By
+from selenium.webdriver.support import expected_conditions as EC
+from selenium.webdriver.support.wait import WebDriverWait
+from email.mime.text import MIMEText
+from steps import behave_email, hostname
+
+import string
+import random
+import smtplib
+
+
+MAX_WAIT_IN_S = 120
+
+
+class RandomUser(object):
+ username = 'testuser_' + ''.join(random.choice(string.lowercase) for i in range(16))
+ password = ''.join(random.choice(string.lowercase) for i in range(16))
+
+
+def get_invite_code():
+ if os.environ.get('INVITE_CODE_ENABLED') == 'true':
+ os.environ['RAILS_ENV'] = 'production'
+ return subprocess.check_output('/usr/bin/bundle exec rake generate_invites[1]'.split(), cwd='/srv/leap/webapp').strip()
+
+
+def random_subject():
+ if 'randomsubject' not in globals():
+ global randomsubject
+ randomsubject=''.join(random.choice(string.lowercase) for i in range(16))
+ return randomsubject
+
+
+def wait_long_until_element_is_visible_by_locator(context, locator_tuple):
+ wait_emails_for = 600
+ wait = WebDriverWait(context.browser, wait_emails_for)
+ wait.until(EC.visibility_of_element_located(locator_tuple))
+ by, value = locator_tuple
+ return context.browser.find_element(by, value)
+
+
+def save_source(context, filename='/tmp/source.html'):
+ with open(filename, 'w') as out:
+ out.write(context.browser.page_source.encode('utf8'))
+
+
+def send_external_email(subject, body):
+ msg = MIMEText(body)
+ msg['Subject'] = subject
+ msg['From'] = behave_email()
+ msg['To'] = behave_email()
+
+ s = smtplib.SMTP(hostname)
+ s.sendmail(behave_email(), [behave_email()], msg.as_string())
+ s.quit()
+
+
+def open_email(context, subject):
+ locator = '//ul[@id="mail-list"]//*[contains(.,"%s")]/parent::a' % subject
+ wait_long_until_element_is_visible_by_locator(context, (By.XPATH, locator)).click()
+
+
+
+
+
+
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/compose.py b/files/puppet/modules/pixelated/files/functional-tests/steps/compose.py
new file mode 100644
index 0000000..7863443
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/compose.py
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from behave import when
+
+from ..page_objects import ComposeBox
+from ..page_objects import MailListActions
+
+@when("I compose a message to '{recipient}'")
+def impl(context, recipient):
+ compose_box = ComposeBox(context)
+ maillist_actions = MailListActions(context)
+ maillist_actions.open_compose_box()
+
+ compose_box.enter_subject("Pixelated rocks!")
+ compose_box.enter_body("You should definitely use it. Cheers, User.")
+ compose_box.enter_recipients(recipient)
+ compose_box.save_draft()
+
+
+@when('I send it')
+def send_impl(context):
+ compose_box = ComposeBox(context)
+ compose_box.send_mail()
+
+
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/delete_mail.py b/files/puppet/modules/pixelated/files/functional-tests/steps/delete_mail.py
new file mode 100644
index 0000000..6bccd6b
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/delete_mail.py
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from behave import then
+from ..page_objects import PixelatedPage
+
+
+@then('I delete the email')
+def impl(context):
+ pixelated_page = PixelatedPage(context)
+ pixelated_page.delete_mail(context.pixelated_email, pixelated_page.random_subject(), 240)
+
+
+@then('I see it in the trash box')
+def impl(context):
+ pixelated_page = PixelatedPage(context)
+ pixelated_page.go_to_trash()
+ pixelated_page.is_mail_on_list(context.pixelated_email, pixelated_page.random_subject())
+
+
+@then('I delete it permanently')
+def impl(context):
+ pixelated_page = PixelatedPage(context)
+ pixelated_page.go_to_trash()
+ pixelated_page.delete_mail(context.pixelated_email, pixelated_page.random_subject())
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/login.py b/files/puppet/modules/pixelated/files/functional-tests/steps/login.py
new file mode 100644
index 0000000..ae5d3cc
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/login.py
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from behave import given
+from ..page_objects import LoginPage
+
+
+@given('I login as "{user}" with password "{password}" to an organization install of pixelated')
+def impl(context, user, password):
+ context.pixelated_email = user + '@try.pixelated-project.org'
+ login_page = LoginPage(context)
+ login_page.enter_username(user).enter_password(password).login()
+ login_page.wait_interstitial_page()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py b/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py
new file mode 100644
index 0000000..d5cb324
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py
@@ -0,0 +1,147 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from selenium.webdriver.common.by import By
+from behave import then
+from ..page_objects import PixelatedPage
+from ..page_objects import MailList
+from ..page_objects import MailListActions
+
+
+
+
+@then('I see the email on the mail list')
+def impl(context):
+ pixelated_page = PixelatedPage(context)
+ pixelated_page.is_mail_on_list(context.pixelated_email, pixelated_page.random_subject(), 240)
+
+
+#FROM USER AGENT REPO
+from selenium.common.exceptions import NoSuchElementException
+from time import sleep
+
+def find_current_mail(context):
+ return context.browser.find_element_by_id(context.current_mail_id)
+
+
+def check_current_mail_is_visible(context):
+ find_current_mail(context)
+
+
+def open_current_mail(context):
+ sleep(2)
+ e = find_current_mail(context)
+ e.click()
+
+
+@then('I see that mail under the \'{tag}\' tag')
+def impl(context, tag):
+ context.execute_steps("when I select the tag '%s'" % tag)
+ context.execute_steps(u'When I open the first mail in the mail list')
+
+
+@when('I open that mail')
+def impl(context):
+ sleep(3)
+ find_current_mail(context).click()
+
+
+@when('I open the first mail in the mail list')
+def impl(context):
+ # maillist = MailList(context)
+ context.current_mail_id = context.browser.find_element_by_css_selector("li[id^='mail']").get_attribute("id")
+ context.browser.find_element_by_css_selector("li[id^='mail'] a").click()
+ sleep(5)
+
+
+@when('I open the first mail in the \'{tag}\'')
+def impl(context, tag):
+ context.execute_steps(u"When I select the tag '%s'" % tag)
+ context.execute_steps(u'When I open the first mail in the mail list')
+
+
+@when('I open the mail I previously tagged')
+def impl(context):
+ open_current_mail(context)
+
+
+@then('I see the mail I sent')
+def impl(context):
+ src = context.browser.page_source
+ assert context.reply_subject in src
+
+
+@then('the deleted mail is there')
+def impl(context):
+ find_current_mail(context)
+
+
+@given('I have mails')
+def impl(context):
+ mail_list = MailList(context)
+ mails = mail_list.is_there_emails()
+ assert len(mails) > 0
+
+
+@when('I mark the first unread email as read')
+def impl(context):
+ mail_list = MailList(context)
+ mails = mail_list.get_all_emails()
+
+ for mail in mails:
+ if 'status-read' not in mail.get_attribute('class'):
+ mail.find_element_by_tag_name('input').click()
+ context.browser.find_element_by_id('mark-selected-as-read').click()
+ context.current_mail_id = mail.get_attribute('id')
+ break
+ sleep(5)
+ assert 'status-read' in context.browser.find_element_by_id(context.current_mail_id).get_attribute('class')
+
+
+@when('I delete the email')
+def impl(context):
+ maillist = MailList(context)
+ def last_email():
+ return maillist.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, '#mail-list li'))
+ import pdb; pdb.set_trace()
+ context.current_mail_id = last_email().get_attribute('id')
+ last_email().find_element_by_tag_name('input').click()
+ maillist._find_element_by_id('delete-selected').click()
+ assert context.current_mail_id != maillist._find_elements_by_css_locator('#mail-list li span a')[0]
+
+
+@when('I check all emails')
+def impl(context):
+ maillist_action = MailListActions(context)
+ maillist_action.select_all_mails()
+
+
+@when('I delete them permanently')
+def impl(context):
+ maillist_actions = MailListActions(context)
+ maillist_actions.delete_selected_mails()
+ maillist_actions._find_element_by_id('delete-selected').click()
+
+
+@then('I should not see any email')
+def impl(context):
+ try:
+ context.browser.find_element(By.CSS_SELECTOR, '#mail-list li span a')
+ except NoSuchElementException:
+ assert True
+ except:
+ assert False
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/mail_view.py b/files/puppet/modules/pixelated/files/functional-tests/steps/mail_view.py
new file mode 100644
index 0000000..c9ade4a
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/mail_view.py
@@ -0,0 +1,98 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from selenium.webdriver.common.keys import Keys
+from common import *
+
+from ..page_objects import ComposeBox
+from ..page_objects import MailList
+from ..page_objects import MailListActions
+from ..page_objects import MailPage
+from ..page_objects import Notification
+
+
+@then('I see that the subject reads \'{subject_expected}\'')
+def impl(context, subject_expected):
+ compose_box = ComposeBox(context)
+ subject_read = compose_box.get_reply_subject().text
+ assert subject_read == subject_expected
+
+
+@then('I see that the body reads \'{body_expected}\'')
+def impl(context, body_expected):
+ mail_page = MailPage(context)
+ body_read = mail_page.get_body().text
+ assert body_read == body_expected
+
+
+@then('that email has the \'{tag}\' tag')
+def impl(context, tag):
+ mail_page = MailPage(context)
+ elements = mail_page.get_tags()
+ tags = [e.text for e in elements]
+ assert tag in tags
+
+
+@when('I add the tag \'{tag}\' to that mail')
+def impl(context, tag):
+ mail_page = MailPage(context)
+ mail_page.add_tag(tag)
+
+
+@when('I reply to it')
+def impl(context):
+ mail_page = MailPage(context)
+ mail_page.reply_mail()
+
+
+@when('I try to delete the first mail')
+def impl(context):
+ context.execute_steps(u"When I open the first mail in the mail list")
+ mail_page = MailPage(context)
+ mail_page.delete_mail()
+
+ # notification = Notification(context)
+ # notification.wait_for_notification("message_deleted")
+
+@when('I choose to forward this mail')
+def impl(context):
+ mail_page = MailPage(context)
+ mail_page.forward_mail()
+
+@when('I forward this mail')
+def impl(context):
+ compose_box = ComposeBox(context)
+ compose_box.send_mail()
+
+
+@when('I remove all tags')
+def impl(context):
+ mail_page = MailPage(context)
+ mail_page.remove_tags()
+
+
+@when('I choose to trash')
+def impl(context):
+ mail_list = MailList(context)
+ mail_list.mark_nth_checkbox(1)
+ maillist_actions = MailListActions(context)
+ maillist_actions.delete_selected_mails()
+
+
+@then('I see the mail has a cc and a bcc recipient')
+def impl(context):
+ mail_page = MailPage(context)
+ assert mail_page.mail_has_cc_and_bcc() == True
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/search.py b/files/puppet/modules/pixelated/files/functional-tests/steps/search.py
new file mode 100644
index 0000000..f581ca5
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/search.py
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from time import sleep
+
+from selenium.webdriver.common.keys import Keys
+from common import *
+
+from ..page_objects import MailListActions
+from ..page_objects import MailList
+
+
+@when('I search for a mail with the words "{search_term}"')
+def impl(context, search_term):
+ maillist_action = MailListActions(context)
+ maillist_action.do_search(search_term)
+ sleep(1)
+
+
+@then('I see one or more mails in the search results')
+def impl(context):
+ maillist= MailList(context)
+ assert maillist.is_there_emails()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/send_email_to_self.py b/files/puppet/modules/pixelated/files/functional-tests/steps/send_email_to_self.py
new file mode 100644
index 0000000..48bae26
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/send_email_to_self.py
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2015 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from behave import when
+from ..page_objects import PixelatedPage
+
+
+@when('I send an email to myself')
+def impl(context):
+ pixelated_page = PixelatedPage(context)
+ pixelated_page.compose_and_send_email({
+ 'subject': pixelated_page.random_subject(),
+ 'body': 'This is an automated test of Pixelated. Please do not delete this, it will be deleted automatically.',
+ 'recipients': context.pixelated_email
+ })
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py b/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py
new file mode 100644
index 0000000..99d6d95
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py
@@ -0,0 +1,131 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from ..page_objects import LoginPage
+from ..page_objects import ComposeBox
+from ..page_objects import MailListActions
+from ..page_objects import MailList
+from ..page_objects import MailPage
+from ..page_objects import Notification
+
+from behave import *
+from common import *
+from steps import behave_email, behave_password, behave_testuser, login_url
+
+
+@given(u'I login as behave-testuser')
+def step_impl(context):
+ context.browser.get(login_url())
+ login_page = LoginPage(context)
+ login_page.enter_username(behave_testuser()).enter_password(behave_password()).login()
+ login_page.wait_interstitial_page()
+
+
+@given(u'I send an unencrypted email')
+def step_impl(context):
+ send_external_email('unencrypted email %s' %random_subject(), 'some body')
+
+
+@given(u'I send an email encrypted to someone else')
+def step_impl(context):
+ send_external_email('undecryptable email %s' %random_subject(), encrypted_body())
+
+
+@when(u'I send a mail to myself')
+def step_impl(context):
+ email_to = behave_email()
+ compose_box = ComposeBox(context)
+ maillist_actions = MailListActions(context)
+
+ maillist_actions.open_compose_box()
+ compose_box.enter_subject('email to myself %s' % random_subject())
+ compose_box.enter_body('Hi, \n this is an email. To find this email, I add this strange string here:\n eisheeneejaih7eiw7heiLah')
+ compose_box.enter_recipient(email_to)
+ compose_box.send_mail()
+
+
+@when(u'I see that the mail was sent')
+def step_impl(context):
+ notification = Notification(context)
+ notification.wait_for_notification("message_sent")
+
+
+@when(u'I open the email')
+def step_impl(context):
+ subject = 'email to myself %s' % random_subject()
+ behave_user = behave_testuser()
+
+ maillist = MailList(context)
+ maillist.select_mail(behave_user, subject)
+
+
+@when(u'I open the undecryptable email')
+def step_impl(context):
+ subject = 'undecryptable email %s' % random_subject()
+ behave_user = behave_testuser()
+
+ maillist = MailList(context)
+ maillist.select_mail(behave_user, subject)
+
+
+@when(u'I open the unencrypted email')
+def step_impl(context):
+ subject = 'unencrypted email %s' % random_subject()
+ behave_user = behave_testuser()
+
+ maillist = MailList(context)
+ maillist.select_mail(behave_user, subject)
+
+
+@then(u'I see a encrypted flag')
+def step_impl(context):
+ mail_page = MailPage(context)
+ mail_page.check_mail_flag('encrypted_flag')
+
+
+@then(u'I see a unencrypted email flag')
+def step_impl(context):
+ mail_page = MailPage(context)
+ mail_page.check_mail_flag('unencrypted_flag')
+
+
+@then(u'I see a undecryptable flag')
+def step_impl(context):
+ mail_page = MailPage(context)
+ mail_page.check_mail_flag('undercryptable_flag')
+
+
+def encrypted_body():
+ return """
+-----BEGIN PGP MESSAGE-----
+Comment: GPGTools - https://gpgtools.org
+
+hQIMA8Aza4SMPrUXARAAsiIM/+InP8FP77iI/Kuhlaj1JHkjomGdm3X/fc7W498e
+njbLt58cLwiGdNJWEKCBWP8McjyKevA5b9CaE94qJJA2OHEPo2yG6mL+SbbhvHFw
+X+815CwxeT/VsqJksRXxl7Y337t9PgniWvpnlAhmtkh4S8CskqQJjZCFmC0v2s9r
+XuJv/XEgReG2xX7SktjMwVYFRb5ghpbz42JyP8ahUGOlyIpYVwRp4tzsYWhCJH90
+WPKqPwLBatJ0qHzYVky6KpsnjFdwTLjy9NM5yw1xPkuuUFjjB7pKZTCTdtfkAyX9
+qcH0iUdhmlzUhm0BIJpyFW4gfh6+mWTe0oWa+Lf3NIiJEmeNl8Z9nAKVcfjwgVOS
+nrjaTM3lOh15MwBblOK5B0CM5YyEhJ6NG0gITM+dt+gItpbUi53QU/oRZJ6mCvNB
+J/XX9lYua+FcSrgXygcGU0Lyx1vOwRjm4/BsJGXmYZ2dow0moJ4IVDRlcecpYzaz
+j7M0fzajCmeS+JVaqrBVxecFE4LIw2cFbT27pYScO18Id1c3b7n/6TxJjyMYAgNa
+cUeI6yCx1w6roGSkG53L3MQPHfjMNSHhRdG0PeprBVg2G4n2Wazfl3n9mqb0Mk4K
+YyVbN9+LY+R8e3obfVGZsZAp5nHlSR/mhuq0EfS1S9a18XMSIIVv8p90su/SvD3S
+TQE9zqA3EjY4OzrNe+FKVpLFjCo5VLxuCZdaCVbjuEhDk7i/X06T3dqPtqlvIErW
+R2zZzupoH5OfjBazUB0ZqkRBZTO/VAAmVr8DCk+e
+=htJr
+-----END PGP MESSAGE-----
+"""
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/tag_list.py b/files/puppet/modules/pixelated/files/functional-tests/steps/tag_list.py
new file mode 100644
index 0000000..829bb65
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/tag_list.py
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+from common import *
+
+from ..page_objects import TagList
+from ..page_objects import MailList
+
+
+def click_first_element_with_class(context, classname):
+ elements = context.browser.find_elements_by_class_name(classname)
+ elements[0].click()
+
+
+def is_side_nav_expanded(context):
+ e = context.browser.find_elements_by_class_name('content')[0].get_attribute('class').count(u'move-right') == 1
+ return e
+
+
+def expand_side_nav(context):
+ if is_side_nav_expanded(context):
+ return
+
+ toggle = context.browser.find_elements_by_class_name('side-nav-toggle')[0]
+ toggle.click()
+
+
+@when('I select the tag \'{mailbox}\'')
+def impl(context, mailbox):
+ expand_side_nav(context)
+ tag_list = TagList(context)
+
+ tag_list.go_to_mailbox(mailbox)
+
+ mail_list = MailList(context)
+ mail_list.is_mailbox_loaded(context, mailbox)
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature b/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature
new file mode 100644
index 0000000..0cbc7e1
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2014 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+@user_agent
+Feature: Tag and reply
+ As a user of Pixelated
+ I want to tag my emails
+ So that I can easily find them
+
+ Scenario: User tags a mail, replies to it then checks that mail is in the right tag
+# Given I have a mail in my inbox
+ Given I login as behave-testuser
+ When I open the first mail in the 'inbox'
+ When I add the tag 'website' to that mail
+ Then I see that mail under the 'website' tag
+ When I open the mail I previously tagged
+ #could not test beyond this because of the problem to send emails
+ And I reply to it
+ When I select the tag 'sent'
+ Then I see the mail I sent
+
+
diff --git a/files/puppet/modules/pixelated/files/functional-tests/test_requirements.txt b/files/puppet/modules/pixelated/files/functional-tests/test_requirements.txt
new file mode 100644
index 0000000..940a51f
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/functional-tests/test_requirements.txt
@@ -0,0 +1,4 @@
+behave==1.2.4
+selenium==2.44.0
+pycurl==7.43.0
+couchdb \ No newline at end of file
diff --git a/files/puppet/modules/pixelated/files/leap_test.rb b/files/puppet/modules/pixelated/files/leap_test.rb
new file mode 100644
index 0000000..cb4d177
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/leap_test.rb
@@ -0,0 +1,19 @@
+raise SkipTest unless service?(:webapp)
+
+require 'json'
+
+class Pixelated < LeapTest
+ depends_on "Network"
+
+ def setup
+ end
+ def test_01_Are_daemons_running?
+ assert_running '/usr/bin/pixelated-user-agent'
+ pass
+ end
+ def test_02_can_connect_to_useragent?
+ assert_tcp_socket('localhost', '8080')
+ pass
+ end
+end
+
diff --git a/files/puppet/modules/pixelated/files/phantomjs b/files/puppet/modules/pixelated/files/phantomjs
new file mode 100755
index 0000000..d72e801
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/phantomjs
Binary files differ
diff --git a/files/puppet/modules/pixelated/files/syslog/pixelated b/files/puppet/modules/pixelated/files/syslog/pixelated
new file mode 100644
index 0000000..2ff4d36
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/syslog/pixelated
@@ -0,0 +1,9 @@
+/var/log/pixelated/*.log {
+ rotate 7
+ daily
+ compress
+ missingok
+ notifempty
+ copytruncate
+}
+
diff --git a/files/puppet/modules/pixelated/files/webapp/locales/en.yml b/files/puppet/modules/pixelated/files/webapp/locales/en.yml
new file mode 100644
index 0000000..0b0989d
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/webapp/locales/en.yml
@@ -0,0 +1,2 @@
+en:
+ signup_info: Create a new user account.
diff --git a/files/puppet/modules/pixelated/files/webapp/views/common/_download_button.html.haml b/files/puppet/modules/pixelated/files/webapp/views/common/_download_button.html.haml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/webapp/views/common/_download_button.html.haml
diff --git a/files/puppet/modules/pixelated/manifests/agent.pp b/files/puppet/modules/pixelated/manifests/agent.pp
new file mode 100644
index 0000000..c689799
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/agent.pp
@@ -0,0 +1,81 @@
+# configure and install the pixelated user agent
+class pixelated::agent {
+ include ::pixelated::apt
+ include ::pixelated::apt::preferences
+ include ::pixelated::unattended_upgrades
+ include ::pixelated::syslog
+ include ::pixelated::tests
+
+ $domain_hash = hiera('domain')
+ $domain = $domain_hash['full_suffix']
+ $services = hiera('services')
+ $default_file = '/etc/default/pixelated-server'
+
+ package { 'pixelated-server':
+ ensure => installed,
+ }
+
+ service { 'pixelated-server':
+ ensure => running,
+ require => Package['pixelated-server'],
+ }
+
+ file { $default_file:
+ content => template('pixelated/pixelated-server-default'),
+ mode => '0644',
+ owner => 'root',
+ group => 'root',
+ notify => Service['pixelated-server'],
+ require => Package['pixelated-server'],
+ }
+
+ # make pixelated accessible at https://mail.domain/
+ apache::vhost::file { 'pixelated':
+ content => template('pixelated/pixelated-apache.conf.erb'),
+ mod_security => false,
+ }
+
+ # Allow traffic from outside to pixelated
+ file { '/etc/shorewall/macro.pixelated_user_agent':
+ content => 'PARAM - - tcp 8080',
+ notify => Service['shorewall'],
+ require => Package['shorewall']
+ }
+
+ shorewall::rule {
+ 'net2fw-pixelated-user-agent':
+ source => 'net',
+ destination => '$FW',
+ action => 'pixelated_user_agent(ACCEPT)',
+ order => 200;
+ }
+
+
+ # webapp customizations
+ file{ ['/srv/leap/webapp/config/customization/locales/','/srv/leap/webapp/config/customization/views','/srv/leap/webapp/config/customization/views/common','/srv/leap/webapp/config/customization/views/users']:
+ ensure => directory,
+ owner => 'leap-webapp',
+ group => 'leap-webapp',
+ require => Vcsrepo['/srv/leap/webapp'],
+ }
+ file{ '/srv/leap/webapp/config/customization/views/common/_download_button.html.haml':
+ source => 'puppet:///modules/pixelated/webapp/views/common/_download_button.html.haml',
+ owner => 'leap-webapp',
+ group => 'leap-webapp',
+ require => File['/srv/leap/webapp/config/customization/views/common'],
+ }
+ file{ '/srv/leap/webapp/config/customization/locales/en.yml':
+ source => 'puppet:///modules/pixelated/webapp/locales/en.yml',
+ owner => 'leap-webapp',
+ group => 'leap-webapp',
+ require => File['/srv/leap/webapp/config/customization/views/common'],
+ }
+ file{ '/srv/leap/webapp/config/customization/views/users/show.html.haml':
+ content => template('pixelated/webapp/show.html.haml.erb'),
+ owner => 'leap-webapp',
+ group => 'leap-webapp',
+ require => File['/srv/leap/webapp/config/customization/views/common'],
+ }
+
+}
+
diff --git a/files/puppet/modules/pixelated/manifests/apt.pp b/files/puppet/modules/pixelated/manifests/apt.pp
new file mode 100644
index 0000000..2de5112
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/apt.pp
@@ -0,0 +1,21 @@
+# add the pixelated sources and the signing key
+class pixelated::apt {
+
+ include apt
+
+ apt::sources_list { 'pixelated.list':
+ content => "deb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename}-snapshots main\ndeb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename} main\n",
+ require => Exec[add_pixelated_key],
+ notify => Exec[refresh_apt],
+ }
+
+ file { '/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc':
+ source => 'puppet:///modules/pixelated/0x287A1542472DC0E3_packages@pixelated-project.org.asc',
+ notify => Exec['add_pixelated_key']
+ }
+ exec{'add_pixelated_key':
+ command => '/usr/bin/apt-key add /srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc',
+ refreshonly => true,
+ require => File['/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc'],
+ }
+}
diff --git a/files/puppet/modules/pixelated/manifests/apt/preferences.pp b/files/puppet/modules/pixelated/manifests/apt/preferences.pp
new file mode 100644
index 0000000..719117b
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/apt/preferences.pp
@@ -0,0 +1,18 @@
+# pin packages so they have precedence over those from the leap repo
+class pixelated::apt::preferences {
+
+ apt::preferences_snippet { ['python-urllib3', 'python-requests','python-six']:
+ release => "${::lsbdistcodename}-backports",
+ priority => 999
+ }
+
+ apt::preferences_snippet { ['soledad-server',
+ 'soledad-common',
+ 'soledad-client',
+ 'leap-keymanager',
+ 'leap-auth']:
+ pin => 'release o=pixelated',
+ priority => 999,
+ }
+
+}
diff --git a/files/puppet/modules/pixelated/manifests/init.pp b/files/puppet/modules/pixelated/manifests/init.pp
new file mode 100644
index 0000000..6d31f68
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/init.pp
@@ -0,0 +1,5 @@
+# setup pixelated
+class pixelated {
+ include pixelated::agent
+}
+
diff --git a/files/puppet/modules/pixelated/manifests/remove.pp b/files/puppet/modules/pixelated/manifests/remove.pp
new file mode 100644
index 0000000..4fcfc9f
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/remove.pp
@@ -0,0 +1,9 @@
+# remove obsolent stuff we deployed by earlier versions of
+# this module
+
+#
+class pixelated::remove {
+ tidy {
+ ['/etc/apt/preferences.d/leap-mx','/etc/apt/preferences.d/python-leap-common']:;
+ }
+}
diff --git a/files/puppet/modules/pixelated/manifests/syslog.pp b/files/puppet/modules/pixelated/manifests/syslog.pp
new file mode 100644
index 0000000..1695a6f
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/syslog.pp
@@ -0,0 +1,18 @@
+#
+class pixelated::syslog {
+ File {
+ owner => root,
+ group => root,
+ mode => '0644',
+ }
+
+ rsyslog::snippet { '05-pixelated':
+ content => template('pixelated/05-pixelated.conf.erb'),
+ }
+
+ file { '/etc/logrotate.d/pixelated':
+ ensure => present,
+ source => 'puppet:///modules/pixelated/syslog/pixelated',
+ }
+
+}
diff --git a/files/puppet/modules/pixelated/manifests/tests.pp b/files/puppet/modules/pixelated/manifests/tests.pp
new file mode 100644
index 0000000..a0264ae
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/tests.pp
@@ -0,0 +1,57 @@
+# Install functional test for Pixelated based on bahave and phantomjs
+# The tetst are integrated in 'leap test'
+class pixelated::tests {
+ include stdlib
+ $webapp = hiera('webapp')
+ $invite = $webapp['invite_required']
+ File {
+ owner => root,
+ group => root,
+ mode => '0644',
+ }
+
+ file { '/srv/leap/tests_custom':
+ ensure => directory,
+ mode => '0755',
+ }
+ file { '/srv/leap/tests_custom/pixelated.rb':
+ source => 'puppet:///modules/pixelated/leap_test.rb',
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ }
+
+ ensure_packages(['python-pip', 'curl', 'bzip2', 'python-enum','python-pycurl'])
+
+ package{['behave','selenium']:
+ ensure => installed,
+ provider => 'pip',
+ require => Package['python-pip'],
+ }
+
+ file{'/usr/local/bin/phantomjs':
+ source => 'puppet:///modules/pixelated/phantomjs',
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ }
+
+ file{'/srv/leap/tests_custom/functional-tests':
+ ensure => directory,
+ recurse => true,
+ purge => true,
+ source => 'puppet:///modules/pixelated/functional-tests',
+ }
+ cron {'run_functional_tests':
+ command => "(date; INVITE_CODE_ENABLED=$invite /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1",
+ environment => 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+ user => 'root',
+ minute => 27,
+ notify => Exec['dummy_register_job'],
+ }
+ exec {'dummy_register_job':
+ command => '/usr/bin/mk-job pixelated-functional-tests /bin/true',
+ require => Class['::check_mk::agent::install'],
+ refreshonly => true,
+ }
+}
diff --git a/files/puppet/modules/pixelated/manifests/unattended_upgrades.pp b/files/puppet/modules/pixelated/manifests/unattended_upgrades.pp
new file mode 100644
index 0000000..dc50c26
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/unattended_upgrades.pp
@@ -0,0 +1,10 @@
+# enable unattended upgrades for pixelated platform
+class pixelated::unattended_upgrades {
+ apt::apt_conf { '51unattended-upgrades_pixelated':
+ source => [
+ "puppet:///modules/pixelated/${::lsbdistid}/51unattended-upgrades_pixelated.${::lsbdistcodename}",
+ "puppet:///modules/pixelated/${::lsbdistid}/51unattended-upgrades_pixelated"],
+ require => Package['unattended-upgrades'],
+ refresh_apt => false,
+ }
+}
diff --git a/files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh b/files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh
new file mode 100755
index 0000000..68dba6b
--- /dev/null
+++ b/files/puppet/modules/pixelated/migrate_data_from_dispatcher_to_multi_user_agent.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+
+DISPATCHER_LEAP_FOLDER=/var/lib/pixelated/dispatcher
+DESTINATION_LEAP_FOLDER=/var/lib/pixelated/.leap
+
+hash ls $DESTINATION_LEAP_FOLDER 2>/dev/null || mkdir -p $DESTINATION_LEAP_FOLDER
+hash jq 2>/dev/null || apt-get install jq
+
+echo $all_users
+echo 'about to copy user soledad client folders'
+for user in $(ls $DISPATCHER_LEAP_FOLDER)
+do
+ user_id=$(/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc '127.0.0.1:5984/identities/_all_docs?include_docs=true' | grep 'address":"'$user'@' | jq -r '.doc.user_id' 2> /dev/null)
+ echo 'User '$user', User ID' $user_id
+
+ # if no user id
+ if [ -z $user_id ] || [ $user_id = 'null' ]; then
+ echo 'skipping...'
+ continue
+ fi
+
+ leap_folder=$DISPATCHER_LEAP_FOLDER/$user/data/$user_id
+ if [ -d $leap_folder ]; then
+ cp -r $leap_folder $DESTINATION_LEAP_FOLDER
+ else
+ data_folder=$DISPATCHER_LEAP_FOLDER/$user/data
+ mkdir -p $DESTINATION_LEAP_FOLDER/$user_id
+ cp -r $data_folder/providers $DESTINATION_LEAP_FOLDER/$user_id
+ cp -r $data_folder/search_index $DESTINATION_LEAP_FOLDER/$user_id
+ cp -r $data_folder/soledad $DESTINATION_LEAP_FOLDER/$user_id
+ fi
+ echo 'done with user' $user
+done
+
+echo "******* data moved ********" \ No newline at end of file
diff --git a/files/puppet/modules/pixelated/spec/classes/agent_spec.rb b/files/puppet/modules/pixelated/spec/classes/agent_spec.rb
new file mode 100644
index 0000000..f55be37
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/agent_spec.rb
@@ -0,0 +1,48 @@
+require 'spec_helper'
+ describe 'pixelated::agent' do
+ after :each do
+ Facter.clear
+ Facter.clear_messages
+ end
+
+
+
+ context 'single node' do
+ let(:facts) do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'jessie',
+ :testscenario => 'single_node',
+ }
+ end
+ let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) }
+ let(:pre_condition) { [
+ "class stdlib {}",
+ "define rsyslog::snippet($content) {}",
+ "define shorewall::rule($source,$destination,$action,$order) {}",
+ "define apache::vhost::file($content,$mod_security) {}",
+ "define apt::sources_list($content='deb url') {}",
+ "define apt::apt_conf($source='file url',$refresh_apt='true') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ ] }
+
+ it { should contain_class('pixelated::syslog') }
+ it { should contain_class('pixelated::tests') }
+
+ it { should contain_service('pixelated-server')}
+
+ # testing if shorewall::masq generates the files
+ it { should contain_shorewall__rule('net2fw-pixelated-user-agent').with_source('net') }
+
+ it { should contain_apache__vhost__file('pixelated').with_content(/mail.example.com/)}
+
+ it "should configure leap webapp" do
+ should contain_file('/srv/leap/webapp/config/customization/locales/en.yml').with( 'require' => 'File[/srv/leap/webapp/config/customization/views/common]',)
+ should contain_file('/srv/leap/webapp/config/customization/views/common/_download_button.html.haml')
+ should contain_file('/srv/leap/webapp/config/customization/views/users/show.html.haml').with_content(/mail.example.com/)
+ end
+ end
+
+end
diff --git a/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb
new file mode 100644
index 0000000..778e739
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe 'pixelated::apt::preferences' do
+ let(:facts) do
+ {
+ :operatingsystem => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'jessie',
+ }
+ end
+
+ let(:pre_condition) { [
+ "class apt {}",
+ "define apt::sources_list($content='deb url') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ ] }
+
+# %w( soledad-server soledad-client soledad-common leap-keymanager leap-auth).each do | package |
+ #it { should contain_apt__preferences_snippet("#{package}").with_pin('release o=pixelated')}
+ #end
+
+ # %w( python-urllib3 python-requests python-six).each do | package |
+ #it { should contain_apt__preferences_snippet("#{package}").with_release(/jessie/) }
+ #end
+
+end
diff --git a/files/puppet/modules/pixelated/spec/classes/apt_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb
new file mode 100644
index 0000000..df5c33f
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe 'pixelated::apt' do
+ let(:facts) do
+ {
+ :operatingsystem => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'jessie',
+ }
+ end
+
+ let(:pre_condition) { [
+ "class apt {}",
+ "define apt::sources_list($content='deb url') {}",
+ ] }
+
+ it { should contain_apt__sources_list('pixelated.list') }
+ it { should contain_file('/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc') }
+ it { should contain_exec('add_pixelated_key') }
+
+end
diff --git a/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb b/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb
new file mode 100644
index 0000000..b24f721
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+
+describe 'pixelated' do
+ context 'single node' do
+ let(:facts) do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'jessie',
+ :testscenario => 'single_node',
+ }
+ end
+
+ let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) }
+ let(:pre_condition) { [
+ "class stdlib {}",
+ "class apt {}",
+ "define rsyslog::snippet($content) {}",
+ "define shorewall::rule($source,$destination,$action,$order) {}",
+ "define apache::vhost::file($content,$mod_security) {}",
+ "define apt::sources_list($content='deb url') {}",
+ "define apt::apt_conf($source='file url',$refresh_apt='true') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ ] }
+
+ it { should contain_class('pixelated::agent') }
+ end
+end
+
diff --git a/files/puppet/modules/pixelated/spec/classes/remove_spec.rb b/files/puppet/modules/pixelated/spec/classes/remove_spec.rb
new file mode 100644
index 0000000..5e5567d
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/remove_spec.rb
@@ -0,0 +1,6 @@
+require 'spec_helper'
+
+describe 'pixelated::remove' do
+ it { should compile }
+end
+
diff --git a/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb b/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb
new file mode 100644
index 0000000..f1b98a4
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe 'pixelated::syslog' do
+ let(:facts) do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistcodename => 'jessie',
+ }
+ end
+ let(:pre_condition) { [
+ "class stdlib {}",
+ "define rsyslog::snippet($content) {}",
+ "define shorewall::rule($source,$destination,$action,$order) {}",
+ "define apache::vhost::file($content,$mod_security) {}",
+ "define apt::sources_list($content='deb url') {}",
+ "define apt::apt_conf($source='file url') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ ] }
+
+
+ it { should contain_rsyslog__snippet('05-pixelated')}
+ it { should contain_file('/etc/logrotate.d/pixelated')}
+end
diff --git a/files/puppet/modules/pixelated/spec/classes/tests_spec.rb b/files/puppet/modules/pixelated/spec/classes/tests_spec.rb
new file mode 100644
index 0000000..eaf347c
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/classes/tests_spec.rb
@@ -0,0 +1,50 @@
+require 'spec_helper'
+
+describe 'pixelated::tests' do
+ context 'single node' do
+ let(:facts) do
+ {
+ :operatingsystem => 'Debian',
+ :osfamily => 'Debian',
+ :lsbdistid => 'Debian',
+ :lsbdistcodename => 'jessie',
+ :testscenario => 'single_node',
+ }
+ end
+
+ let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) }
+ let(:pre_condition) { [
+ "class stdlib {}",
+ ] }
+
+
+ it do
+ should contain_file('/srv/leap/tests_custom').with(
+ 'ensure' => 'directory',
+ 'mode' => '0755',
+ )
+ end
+ it do
+ should contain_file('/srv/leap/tests_custom/functional-tests').with(
+ 'ensure' => 'directory',
+ 'recurse' => 'true',
+ )
+ end
+
+
+
+ it { should contain_file('/srv/leap/tests_custom/pixelated.rb')}
+ it { should contain_file('/usr/local/bin/phantomjs')}
+
+ it do
+ should contain_exec('dummy_register_job').with(
+ "require" => "Class[::Check_mk::Agent::Install]"
+ )
+ end
+ it do
+ should contain_cron('run_functional_tests').with(
+ "command" => """(date; INVITE_CODE_ENABLED=true /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1"
+ )
+ end
+ end
+end
diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml
new file mode 100644
index 0000000..2d001ec
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml
@@ -0,0 +1,7 @@
+---
+:backends:
+ - yaml
+:hierarchy:
+ - "%{::testscenario}"
+:yaml:
+ :datadir: 'spec/fixtures/hiera'
diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml
new file mode 100644
index 0000000..c8bf5c7
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml
@@ -0,0 +1,9 @@
+---
+domain:
+ full: pixelated.example.com
+ full_suffix: example.com
+ internal: pixelated.example.i
+ internal_suffix: example.i
+ name: pixelated.example.com
+services: ["pixelated"]
+
diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml
new file mode 100644
index 0000000..0759bdf
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml
@@ -0,0 +1,11 @@
+---
+domain:
+ full: pixelated.example.com
+ full_suffix: example.com
+ internal: pixelated.example.i
+ internal_suffix: example.i
+ name: pixelated.example.com
+services: ["mx","pixelated"]
+
+webapp:
+ invite_required: true
diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml
new file mode 100644
index 0000000..74b9031
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml
@@ -0,0 +1,9 @@
+---
+domain:
+ full: pixelated.example.com
+ full_suffix: example.com
+ internal: pixelated.example.i
+ internal_suffix: example.i
+ name: pixelated.example.com
+services: ["pixelated","monitor"]
+
diff --git a/files/puppet/modules/pixelated/spec/spec_helper.rb b/files/puppet/modules/pixelated/spec/spec_helper.rb
new file mode 100644
index 0000000..fb6ab97
--- /dev/null
+++ b/files/puppet/modules/pixelated/spec/spec_helper.rb
@@ -0,0 +1,12 @@
+require 'rspec-puppet'
+require 'rspec-puppet-utils'
+require 'puppetlabs_spec_helper/module_spec_helper'
+require 'puppetlabs_spec_helper/puppetlabs_spec_helper'
+
+fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
+
+RSpec.configure do |c|
+ c.module_path = File.join(fixture_path, 'modules')
+ c.manifest_dir = File.join(fixture_path, 'manifests')
+ c.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
+end
diff --git a/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb b/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb
new file mode 100644
index 0000000..35f1353
--- /dev/null
+++ b/files/puppet/modules/pixelated/templates/05-pixelated.conf.erb
@@ -0,0 +1,7 @@
+# This file is managed by Puppet, changes may be overwritten
+if $syslogtag contains_i 'user-agent' then {
+ action(type="omfile" file="/var/log/pixelated/user-agent.log")
+ stop
+}
+
+
diff --git a/files/puppet/modules/pixelated/templates/pixelated-apache.conf.erb b/files/puppet/modules/pixelated/templates/pixelated-apache.conf.erb
new file mode 100644
index 0000000..9f71420
--- /dev/null
+++ b/files/puppet/modules/pixelated/templates/pixelated-apache.conf.erb
@@ -0,0 +1,60 @@
+<VirtualHost *:80>
+ ServerName mail.<%= scope.lookupvar('::pixelated::agent::domain') %>
+ RewriteEngine On
+ RewriteRule ^.*$ https://mail.<%= scope.lookupvar('::pixelated::agent::domain') %>%{REQUEST_URI} [R=permanent,L]
+ CustomLog ${APACHE_LOG_DIR}/mail.<%= scope.lookupvar('::pixelated::agent::domain') %>.log common
+</VirtualHost>
+
+<VirtualHost *:443>
+ ServerName mail.<%= scope.lookupvar('::pixelated::agent::domain') %>
+ CustomLog ${APACHE_LOG_DIR}/mail.<%= scope.lookupvar('::pixelated::agent::domain') %>.log common
+
+ SSLCACertificatePath /etc/ssl/certs
+ SSLCertificateChainFile /usr/local/share/ca-certificates/leap_commercial_ca.crt
+ SSLCertificateKeyFile /etc/x509/keys/leap_commercial.key
+ SSLCertificateFile /etc/x509/certs/leap_commercial.crt
+
+ Include include.d/ssl_common.inc
+
+ <IfModule mod_headers.c>
+ Header always unset X-Powered-By
+ Header always unset X-Runtime
+ Header set X-Frame-Options SAMEORIGIN
+ </IfModule>
+
+ DocumentRoot /srv/leap/webapp/public
+
+ SSLProxyEngine on
+ ProxyPass / https://<%= scope.lookupvar('::pixelated::agent::domain') %>:8080/
+ ProxyPassReverse / https://<%= scope.lookupvar('::pixelated::agent::domain') %>:8080/
+</VirtualHost>
+
+
+Listen 8083
+<VirtualHost *:8083>
+ ServerName mail.<%= scope.lookupvar('::pixelated::agent::domain') %>
+ CustomLog ${APACHE_LOG_DIR}/mail.<%= scope.lookupvar('::pixelated::agent::domain') %>.log common
+
+ SSLCACertificatePath /etc/ssl/certs
+ SSLCertificateChainFile /usr/local/share/ca-certificates/leap_commercial_ca.crt
+ SSLCertificateKeyFile /etc/x509/keys/leap_commercial.key
+ SSLCertificateFile /etc/x509/certs/leap_commercial.crt
+
+ Include include.d/ssl_common.inc
+
+ <IfModule mod_headers.c>
+ Header always unset X-Powered-By
+ Header always unset X-Runtime
+ </IfModule>
+
+ DocumentRoot /srv/leap/webapp/public
+
+ SSLProxyEngine on
+ ProxyPass / https://<%= scope.lookupvar('::pixelated::agent::domain') %>:8080/
+ ProxyPassReverse / https://<%= scope.lookupvar('::pixelated::agent::domain') %>:8080/
+ Header unset Content-Security-Policy
+ Header unset X-Content-Security-Policy
+ Header unset X-Webkit-Csp
+
+</VirtualHost>
+
diff --git a/files/puppet/modules/pixelated/templates/pixelated-server-default b/files/puppet/modules/pixelated/templates/pixelated-server-default
new file mode 100644
index 0000000..efe91dd
--- /dev/null
+++ b/files/puppet/modules/pixelated/templates/pixelated-server-default
@@ -0,0 +1,9 @@
+# managed by puppet
+
+FEEDBACK_URL=
+HOME=/var/lib/pixelated
+LEAP_PROVIDER=<%= @domain %>
+SSL_KEY=/etc/x509/keys/leap_commercial.key
+SSL_CERT=/etc/x509/certs/leap_commercial.crt
+LEAP_CA=/etc/ssl/certs/ca-certificates.crt
+EXTRA_OPTS="--banner /etc/pixelated/pixelated_banner.html"
diff --git a/files/puppet/modules/pixelated/templates/webapp/show.html.haml.erb b/files/puppet/modules/pixelated/templates/webapp/show.html.haml.erb
new file mode 100644
index 0000000..0ede372
--- /dev/null
+++ b/files/puppet/modules/pixelated/templates/webapp/show.html.haml.erb
@@ -0,0 +1,6 @@
+= render 'overview'
+.container-fluid
+ .row-fluid
+ %br
+ %h4
+ = link_to 'Go to your Pixelated inbox', 'https://mail.<%= scope.lookupvar('::pixelated::agent::domain') %>'
diff --git a/files/puppet/modules/pixelated/vagrant_platform.sh b/files/puppet/modules/pixelated/vagrant_platform.sh
new file mode 100755
index 0000000..67382b4
--- /dev/null
+++ b/files/puppet/modules/pixelated/vagrant_platform.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Issues:
+# - homebrew version of git does not work nicely with submodules
+
+hash vagrant 2>/dev/null || { echo >&2 "Vagrant is not installed. Aborting."; exit 1; }
+
+if [ -d ./leap_platform ]
+then
+ cd leap_platform
+ /usr/bin/git pull
+ /usr/bin/git submodule update --init
+else
+ /usr/bin/git clone --branch develop --recursive https://leap.se/git/leap_platform.git
+ cd leap_platform
+fi
+
+vagrant up pixelated --no-provision || vagrant reload
+vagrant provision