def setUp(self): """Setup of myaccount""" super(MyAccountTestCase, self).setUp() # Creating user for each test to not mess with default user user = User(login=gen_alpha(), password='******') # copying missing id because create returns only password's hash once # it is not stored in plain text for security reason user.id = user.create().id self.account_user = user
def class_user_reader(self, class_user_password, class_org, class_location): try: reader_role = RoleEntity().search(query={'search': 'name="Discovery Reader"'})[0] except IndexError: pytest.fail('Discovery Manager role was not found, setup cannot continue') user = UserEntity( organization=[class_org], location=[class_location], password=class_user_password, role=[reader_role], ).create() yield user try: user.delete() except HTTPError: logger.exception('Exception while deleting class scope user entity in teardown')
def test_positive_update_password(self): """Update Password/Verify fields in My Account :id: 3ab5d347-e02a-4d34-aec0-970419525268 :Steps: Update Password/Verify fields with all variations in [1] :expectedresults: User is updated :CaseImportance: Critical """ for password in _valid_string_data(max_len=254): with self.subTest(password): old_password = '******' user = User(password=old_password).create() with Session(self.browser, user.login, old_password): self.my_account.update(current_password=old_password, password=password, password_confirmation=password) # UINoSuchElementError is raised on __exit__ once logout is # only possible with prior login with self.assertRaises(UINoSuchElementError): with Session(self.browser, user.login, old_password): self.assertFalse(self.login.is_logged()) with Session(self.browser, user.login, password): self.assertTrue(self.login.is_logged()) # Check user can navigate to her own account again self.my_account.navigate_to_entity()
def main(): """Create an identical user account on a pair of satellites.""" server_configs = ServerConfig.get('sat1'), ServerConfig.get('sat2') for server_config in server_configs: org = Organization(server_config).search(query={'search': 'name="Default_Organization"'})[ 0 ] # The LDAP authentication source with an ID of 1 is internal. It is # nearly guaranteed to exist and be functioning. user = User( server_config, auth_source=1, # or: AuthSourceLDAP(server_config, id=1), login='******', mail='*****@*****.**', organization=[org], password='******', ).create() pprint(user.get_values()) # e.g. {'login': '******', …}
def main(): """Create an identical user account on a pair of satellites.""" server_configs = ServerConfig.get('sat1'), ServerConfig.get('sat2') for server_config in server_configs: org = Organization(server_config).search( query={'search': 'name="Default_Organization"'} )[0] # The LDAP authentication source with an ID of 1 is internal. It is # nearly guaranteed to exist and be functioning. user = User( server_config, auth_source=1, # or: AuthSourceLDAP(server_config, id=1), login='******', mail='*****@*****.**', organization=[org], password='******', ).create() pprint(user.get_values()) # e.g. {'login': '******', …}
def test_positive_update_language(self): """Update Language in My Account :id: 87604475-3a8e-4cb1-ace4-ea874b1d9e72 :Steps: Update current User with all different Language options :expectedresults: Current User is updated :CaseImportance: Critical """ for lang, locale in LANGUAGES.items(): with self.subTest(lang): user = User(login=gen_alpha(), password='******') user.id = user.create().id with Session(self.browser, user.login, user.password): self.my_account.navigate_to_entity() self.my_account.select( locators['users.language_dropdown'], lang ) self.my_account.click(common_locators['submit']) self.my_account.navigate_to_entity() option = self.my_account.wait_until_element_exists( locators['users.selected_lang']) # Cant use directly lang because its value changes # after updating current language self.assertEqual( locale, option.get_attribute('value') ) user.delete()
def setUp(self): """Setup of myaccount. Once following tests are going to update logged user, the default user can not be used once she is used on a bunch of other tests. So this method creates a new user for each test for the sake of isolation """ super(MyAccountTestCase, self).setUp() password = '******' self.account_user = User(password=password).create() self.account_password = password
def test_positive_update_language(self): """Update Language in My Account :id: 87604475-3a8e-4cb1-ace4-ea874b1d9e72 :Steps: Update current User with all different Language options :expectedresults: Current User is updated :CaseImportance: Critical """ for language, locale in LANGUAGES.items(): with self.subTest(language): password = gen_alpha() user = User(password=password).create() with Session(self.browser, user.login, password): self.my_account.update(language=language) # Cant use directly language because its value changes # after updating current language self.assertEqual( locale, self.my_account.get_field_value('language'))