Skip to content

Commit

Permalink
Configure the validity_period as part of a separate GS profile, inste…
Browse files Browse the repository at this point in the history
…ad of manually doing it in the test
  • Loading branch information
frapell committed Aug 1, 2019
1 parent bf797af commit 780ef9a
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 63 deletions.
8 changes: 8 additions & 0 deletions collective/pwexpiry/configure.zcml
Expand Up @@ -52,6 +52,14 @@
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:registerProfile
name="robot_testing"
title="collective.pwexpiry: robot_testing"
directory="profiles/robot_testing"
description="Profile used for robot tests (Do not import)."
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<utility factory=".setuphandlers.HiddenProfiles" name="collective.pwexpiry" />

<subscriber
Expand Down
4 changes: 4 additions & 0 deletions collective/pwexpiry/profiles/robot_testing/metadata.xml
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<metadata>
<version>0001</version>
</metadata>
18 changes: 18 additions & 0 deletions collective/pwexpiry/profiles/robot_testing/registry.xml
@@ -0,0 +1,18 @@
<registry>
<record name="collective.pwexpiry.validity_period">
<field type="plone.registry.field.Int">
<title>Number of days for password validity. (set to 0 to disable)</title>
</field>
<value>0</value>
</record>

<record name="plone.enable_user_pwd_choice" interface="Products.CMFPlone.interfaces.controlpanel.ISecuritySchema" field="enable_user_pwd_choice">
<field type="plone.registry.field.Bool">
<default>False</default>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n" ns0:domain="plone" ns0:translate="">If not selected, a URL will be generated and e-mailed. Users are instructed to follow the link to reach a page where they can change their password and complete the registration process; this also verifies that they have entered a valid email address.</description>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n" ns0:domain="plone" ns0:translate="">Let users select their own passwords</title>
</field>
<value>True</value>
</record>
</registry>
1 change: 1 addition & 0 deletions collective/pwexpiry/setuphandlers.py
Expand Up @@ -23,6 +23,7 @@ def getNonInstallableProfiles(self):
u"collective.pwexpiry:plone4",
u"collective.pwexpiry:old_skins",
u"collective.pwexpiry:uninstall",
u"collective.pwexpiry:robot_testing",
]


Expand Down
23 changes: 22 additions & 1 deletion collective/pwexpiry/testing.py
Expand Up @@ -56,15 +56,36 @@ def tearDownZope(self, app):
pass


class PwExpiryRobotLayer(PwExpiryLayer):
"""
Testing layer for collective.pwexpiry robot tests
"""

def setUpPloneSite(self, portal):
"""
Set up Plone
"""
# import default profile
applyProfile(portal, "collective.pwexpiry:default")
applyProfile(portal, "collective.pwexpiry:robot_testing")

# Create test content
# 1. Login as user with Manager privilages
setRoles(portal, TEST_USER_ID, ["Manager"])
login(portal, TEST_USER_NAME)


FIXTURE = PwExpiryLayer()
ROBOT_FIXTURE = PwExpiryRobotLayer()

INTEGRATION_TESTING = IntegrationTesting(
bases=(FIXTURE,), name="PwExpiryLayer:Integration"
)
FUNCTIONAL_TESTING = FunctionalTesting(
bases=(FIXTURE,), name="PwExpiryLayer:Functional"
)
ROBOT_TESTING = FunctionalTesting(
bases=(FIXTURE, AUTOLOGIN_LIBRARY_FIXTURE, z2.ZSERVER_FIXTURE),
bases=(ROBOT_FIXTURE, AUTOLOGIN_LIBRARY_FIXTURE, z2.ZSERVER_FIXTURE),
name="PwExpiryLayer:Robot",
)

Expand Down
18 changes: 0 additions & 18 deletions collective/pwexpiry/tests/pwexpiryp4_keywords.robot
Expand Up @@ -41,16 +41,6 @@ Go to Configuration Registry

Setup PWexpiry Use Username Login
Start Browser and Log In as Site Owner
Go to Security Settings
Select Checkbox id=form.enable_user_pwd_choice
Click Button id=form.actions.save
Go to Configuration Registry
Input Text id=q validity_period
Click Button Filter
Click Link collective pwexpiry validity_period
Wait Until Element Is Visible id=form-widgets-value
Input Text id=form-widgets-value 0
Click Button id=form-buttons-save
Go to Users and Groups
Click Button name=form.button.AddUser
Input Text id=form.fullname Test User 1
Expand All @@ -64,16 +54,8 @@ Setup PWexpiry Use Username Login
Setup PWexpiry Use Email Login
Start Browser and Log In as Site Owner
Go to Security Settings
Select Checkbox id=form.enable_user_pwd_choice
Select Checkbox id=form.use_email_as_login
Click Button id=form.actions.save
Go to Configuration Registry
Input Text id=q validity_period
Click Button Filter
Click Link collective pwexpiry validity_period
Wait Until Element Is Visible id=form-widgets-value
Input Text id=form-widgets-value 0
Click Button id=form-buttons-save
Go to Users and Groups
Click Button name=form.button.AddUser
Input Text id=form.fullname Test User 1
Expand Down
22 changes: 0 additions & 22 deletions collective/pwexpiry/tests/pwexpiryp52_keywords.robot
Expand Up @@ -44,18 +44,6 @@ Plone52 Log out

Setup PWexpiry Use Username Login
Start Browser and Log In as Site Owner
Go to Security Settings
Select Checkbox id=form-widgets-enable_user_pwd_choice-0
Click Button id=form-buttons-save
Go to Configuration Registry
Input Text id=q validity_period
Press Key id=q \\13
Wait Until Element Is Not Visible css:div#plone-loader
Click Link collective pwexpiry validity_period
Wait Until Element Is Not Visible css:div#plone-loader
Input Text id=form-widgets-value 0
Press Key id=form-widgets-value \\13
Wait Until Element Is Not Visible css:div#plone-loader
Go to Users and Groups
Click Button id=add-new-user
Wait Until Element Is Not Visible css:div#plone-loader
Expand All @@ -71,18 +59,8 @@ Setup PWexpiry Use Username Login
Setup PWexpiry Use Email Login
Start Browser and Log In as Site Owner
Go to Security Settings
Select Checkbox id=form-widgets-enable_user_pwd_choice-0
Select Checkbox id=form-widgets-use_email_as_login-0
Click Button id=form-buttons-save
Go to Configuration Registry
Input Text id=q validity_period
Press Key id=q \\13
Wait Until Element Is Not Visible css:div#plone-loader
Click Link collective pwexpiry validity_period
Wait Until Element Is Not Visible css:div#plone-loader
Input Text id=form-widgets-value 0
Press Key id=form-widgets-value \\13
Wait Until Element Is Not Visible css:div#plone-loader
Go to Users and Groups
Click Button id=add-new-user
Wait Until Element Is Not Visible css:div#plone-loader
Expand Down
22 changes: 0 additions & 22 deletions collective/pwexpiry/tests/pwexpiryp5_keywords.robot
Expand Up @@ -40,18 +40,6 @@ Go to Configuration Registry

Setup PWexpiry Use Username Login
Start Browser and Log In as Site Owner
Go to Security Settings
Select Checkbox id=form-widgets-enable_user_pwd_choice-0
Click Button id=form-buttons-save
Go to Configuration Registry
Input Text id=q validity_period
Press Key id=q \\13
Wait Until Element Is Not Visible css:div#plone-loader
Click Link collective pwexpiry validity_period
Wait Until Element Is Not Visible css:div#plone-loader
Input Text id=form-widgets-value 0
Press Key id=form-widgets-value \\13
Wait Until Element Is Not Visible css:div#plone-loader
Go to Users and Groups
Click Button id=add-new-user
Wait Until Element Is Not Visible css:div#plone-loader
Expand All @@ -67,18 +55,8 @@ Setup PWexpiry Use Username Login
Setup PWexpiry Use Email Login
Start Browser and Log In as Site Owner
Go to Security Settings
Select Checkbox id=form-widgets-enable_user_pwd_choice-0
Select Checkbox id=form-widgets-use_email_as_login-0
Click Button id=form-buttons-save
Go to Configuration Registry
Input Text id=q validity_period
Press Key id=q \\13
Wait Until Element Is Not Visible css:div#plone-loader
Click Link collective pwexpiry validity_period
Wait Until Element Is Not Visible css:div#plone-loader
Input Text id=form-widgets-value 0
Press Key id=form-widgets-value \\13
Wait Until Element Is Not Visible css:div#plone-loader
Go to Users and Groups
Click Button id=add-new-user
Wait Until Element Is Not Visible css:div#plone-loader
Expand Down

0 comments on commit 780ef9a

Please sign in to comment.