def test_filtered_datapoint_True(self): """Tests if run_one_datapoint=false returns all data points""" settings.run_one_datapoint = False self.assertEqual(len(generate_strings_list()), 7) self.assertEqual(len(invalid_emails_list()), 8) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_interfaces_list()), 8) self.assertEqual(len(invalid_names_list()), 7) self.assertEqual(len(invalid_values_list()), 10) self.assertEqual(len(invalid_usernames_list()), 4) self.assertEqual(len(valid_labels_list()), 2) self.assertEqual(len(valid_data_list()), 7) self.assertEqual(len(valid_emails_list()), 8) self.assertEqual(len(valid_environments_list()), 4) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_interfaces_list()), 3) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6) self.assertEqual(len((valid_cron_expressions())), 4) with mock.patch('robottelo.datafactory.bz_bug_is_open', return_value=True): self.assertEqual(len(valid_docker_repository_names()), 6) with mock.patch('robottelo.datafactory.bz_bug_is_open', return_value=False): self.assertEqual(len(valid_docker_repository_names()), 7)
def test_negative_create_with_invalid_username(self): """Create User with invalid Username @id: aaf157a9-0375-4405-ad87-b13970e0609b @Assert: User is not created. Appropriate error shown. """ for invalid_name in invalid_usernames_list(): with self.subTest(invalid_name): with self.assertRaises(HTTPError): entities.User(login=invalid_name).create()
def test_negative_create_with_invalid_username(self): """Create User with invalid Username @Feature: User - Negative Create @Assert: User is not created. Appropriate error shown. """ for invalid_name in invalid_usernames_list(): with self.subTest(invalid_name): with self.assertRaises(HTTPError): entities.User(login=invalid_name).create()
def test_negative_create_with_invalid_username(self): """Create User with invalid Username :id: aaf157a9-0375-4405-ad87-b13970e0609b :expectedresults: User is not created. Appropriate error shown. :CaseImportance: Critical """ for invalid_name in invalid_usernames_list(): with self.subTest(invalid_name): with self.assertRaises(HTTPError): entities.User(login=invalid_name).create()
def test_filtered_datapoint_True(self): """Tests if run_one_datapoint=false returns all data points""" settings.run_one_datapoint = False self.assertEqual(len(generate_strings_list()), 7) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_emails_list()), 10) self.assertEqual(len(invalid_names_list()), 7) self.assertEqual(len(invalid_values_list()), 10) self.assertEqual(len(invalid_usernames_list()), 4) self.assertEqual(len(valid_labels_list()), 2) self.assertEqual(len(valid_data_list()), 7) self.assertEqual(len(valid_emails_list()), 8) self.assertEqual(len(valid_environments_list()), 3) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6)
def test_filtered_datapoint_True(self): """Tests if run_one_datapoint=false returns all data points""" with mock.patch('robottelo.datafactory.bz_bug_is_open', return_value=False): settings.run_one_datapoint = False self.assertEqual(len(generate_strings_list()), 7) self.assertEqual(len(invalid_emails_list()), 10) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_interfaces_list()), 8) self.assertEqual(len(invalid_names_list()), 7) self.assertEqual(len(invalid_values_list()), 10) self.assertEqual(len(invalid_usernames_list()), 4) self.assertEqual(len(valid_labels_list()), 2) self.assertEqual(len(valid_data_list()), 7) self.assertEqual(len(valid_emails_list()), 8) self.assertEqual(len(valid_environments_list()), 4) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_interfaces_list()), 3) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6)
def test_filtered_datapoint_True(self): """Tests if run_one_datapoint=false returns all data points""" settings.run_one_datapoint = False self.assertEqual(len(generate_strings_list()), 7) self.assertEqual(len(invalid_emails_list()), 8) self.assertEqual(len(invalid_id_list()), 4) self.assertEqual(len(invalid_interfaces_list()), 8) self.assertEqual(len(invalid_names_list()), 7) self.assertEqual(len(invalid_values_list()), 10) self.assertEqual(len(invalid_usernames_list()), 4) self.assertEqual(len(valid_labels_list()), 2) self.assertEqual(len(valid_data_list()), 7) self.assertEqual(len(valid_emails_list()), 8) self.assertEqual(len(valid_environments_list()), 4) self.assertEqual(len(valid_hosts_list()), 3) self.assertEqual(len(valid_hostgroups_list()), 7) self.assertEqual(len(valid_interfaces_list()), 3) self.assertEqual(len(valid_names_list()), 15) self.assertEqual(len(valid_org_names_list()), 7) self.assertEqual(len(valid_usernames_list()), 6) self.assertEqual(len((valid_cron_expressions())), 4) self.assertEqual(len(valid_docker_repository_names()), 7)
class TestUser: """Tests for the ``users`` path.""" @pytest.mark.tier1 @pytest.mark.parametrize('username', **parametrized(valid_usernames_list())) def test_positive_create_with_username(self, username): """Create User for all variations of Username :id: a9827cda-7f6d-4785-86ff-3b6969c9c00a :parametrized: yes :expectedresults: User is created :CaseImportance: Critical """ user = entities.User(login=username).create() assert user.login == username @pytest.mark.tier1 @pytest.mark.parametrize('firstname', **parametrized( generate_strings_list(exclude_types=['html'], max_length=50))) def test_positive_create_with_firstname(self, firstname): """Create User for all variations of First Name :id: 036bb958-227c-420c-8f2b-c607136f12e0 :parametrized: yes :expectedresults: User is created :CaseImportance: Critical """ if len(str.encode(firstname)) > 50: firstname = firstname[:20] user = entities.User(firstname=firstname).create() assert user.firstname == firstname @pytest.mark.tier1 @pytest.mark.parametrize('lastname', **parametrized( generate_strings_list(exclude_types=['html'], max_length=50))) def test_positive_create_with_lastname(self, lastname): """Create User for all variations of Last Name :id: 95d3b571-77e7-42a1-9c48-21f242e8cdc2 :parametrized: yes :expectedresults: User is created :CaseImportance: Critical """ if len(str.encode(lastname)) > 50: lastname = lastname[:20] user = entities.User(lastname=lastname).create() assert user.lastname == lastname @pytest.mark.tier1 @pytest.mark.parametrize('mail', **parametrized(valid_emails_list())) def test_positive_create_with_email(self, mail): """Create User for all variations of Email :id: e68caf51-44ba-4d32-b79b-9ab9b67b9590 :parametrized: yes :expectedresults: User is created :CaseImportance: Critical """ user = entities.User(mail=mail).create() assert user.mail == mail @pytest.mark.tier1 @pytest.mark.parametrize('description', **parametrized(valid_data_list())) def test_positive_create_with_description(self, description): """Create User for all variations of Description :id: 1463d71c-b77d-4223-84fa-8370f77b3edf :parametrized: yes :expectedresults: User is created :CaseImportance: Critical """ user = entities.User(description=description).create() assert user.description == description @pytest.mark.tier1 @pytest.mark.parametrize('password', **parametrized( generate_strings_list(exclude_types=['html'], max_length=50))) def test_positive_create_with_password(self, password): """Create User for all variations of Password :id: 53d0a419-0730-4f7d-9170-d855adfc5070 :parametrized: yes :expectedresults: User is created :CaseImportance: Critical """ user = entities.User(password=password).create() assert user is not None @pytest.mark.tier1 @pytest.mark.upgrade @pytest.mark.parametrize('mail', **parametrized(valid_emails_list())) def test_positive_delete(self, mail): """Create random users and then delete it. :id: df6059e7-85c5-42fa-99b5-b7f1ef809f52 :parametrized: yes :expectedresults: The user cannot be fetched after deletion. :CaseImportance: Critical """ user = entities.User(mail=mail).create() user.delete() with pytest.raises(HTTPError): user.read() @pytest.mark.tier1 @pytest.mark.parametrize('login', **parametrized(valid_usernames_list())) def test_positive_update_username(self, create_user, login): """Update a user and provide new username. :id: a8e218b1-7256-4f20-91f3-3958d58ea5a8 :parametrized: yes :expectedresults: The user's ``Username`` attribute is updated. :CaseImportance: Critical """ create_user.login = login user = create_user.update(['login']) assert user.login == login @pytest.mark.tier1 @pytest.mark.parametrize('login', **parametrized(invalid_usernames_list())) def test_negative_update_username(self, create_user, login): """Update a user and provide new login. :id: 9eefcba6-66a3-41bf-87ba-3e032aee1db2 :parametrized: yes :expectedresults: The user's ``login`` attribute is updated. :CaseImportance: Critical """ with pytest.raises(HTTPError): create_user.login = login create_user.update(['login']) @pytest.mark.tier1 @pytest.mark.parametrize('firstname', **parametrized( generate_strings_list(exclude_types=['html'], max_length=50))) def test_positive_update_firstname(self, create_user, firstname): """Update a user and provide new firstname. :id: a1287d47-e7d8-4475-abe8-256e6f2034fc :parametrized: yes :expectedresults: The user's ``firstname`` attribute is updated. :CaseImportance: Critical """ if len(str.encode(firstname)) > 50: firstname = firstname[:20] create_user.firstname = firstname user = create_user.update(['firstname']) assert user.firstname == firstname @pytest.mark.tier1 @pytest.mark.parametrize('lastname', **parametrized( generate_strings_list(exclude_types=['html'], max_length=50))) def test_positive_update_lastname(self, create_user, lastname): """Update a user and provide new lastname. :id: 25c6c9df-5db2-4827-89bb-b8fd0658a9b9 :parametrized: yes :expectedresults: The user's ``lastname`` attribute is updated. :CaseImportance: Critical """ if len(str.encode(lastname)) > 50: lastname = lastname[:20] create_user.lastname = lastname user = create_user.update(['lastname']) assert user.lastname == lastname @pytest.mark.tier1 @pytest.mark.parametrize('mail', **parametrized(valid_emails_list())) def test_positive_update_email(self, create_user, mail): """Update a user and provide new email. :id: 3ae70631-7cee-4a4a-9c2f-b428273f1311 :parametrized: yes :expectedresults: The user's ``mail`` attribute is updated. :CaseImportance: Critical """ create_user.mail = mail user = create_user.update(['mail']) assert user.mail == mail @pytest.mark.tier1 @pytest.mark.parametrize('mail', **parametrized(invalid_emails_list())) def test_negative_update_email(self, create_user, mail): """Update a user and provide new email. :id: 0631dce1-694c-4815-971d-26ff1934da98 :parametrized: yes :expectedresults: The user's ``mail`` attribute is updated. :CaseImportance: Critical """ with pytest.raises(HTTPError): create_user.mail = mail create_user.update(['mail']) @pytest.mark.tier1 @pytest.mark.parametrize('description', **parametrized(valid_data_list())) def test_positive_update_description(self, create_user, description): """Update a user and provide new email. :id: a1d764ad-e9bb-4e5e-b8cd-3c52e1f128f6 :parametrized: yes :expectedresults: The user's ``Description`` attribute is updated. :CaseImportance: Critical """ create_user.description = description user = create_user.update(['description']) assert user.description == description @pytest.mark.tier1 @pytest.mark.parametrize('admin_enable', [True, False]) def test_positive_update_admin(self, admin_enable): """Update a user and provide the ``admin`` attribute. :id: b5fedf65-37f5-43ca-806a-ac9a7979b19d :parametrized: yes :expectedresults: The user's ``admin`` attribute is updated. :CaseImportance: Critical """ user = entities.User(admin=admin_enable).create() user.admin = not admin_enable assert user.update().admin == (not admin_enable) @pytest.mark.tier1 @pytest.mark.parametrize('mail', **parametrized(invalid_emails_list())) def test_negative_create_with_invalid_email(self, mail): """Create User with invalid Email Address :id: ebbd1f5f-e71f-41f4-a956-ce0071b0a21c :parametrized: yes :expectedresults: User is not created. Appropriate error shown. :CaseImportance: Critical """ with pytest.raises(HTTPError): entities.User(mail=mail).create() @pytest.mark.tier1 @pytest.mark.parametrize('invalid_name', **parametrized(invalid_usernames_list())) def test_negative_create_with_invalid_username(self, invalid_name): """Create User with invalid Username :id: aaf157a9-0375-4405-ad87-b13970e0609b :parametrized: yes :expectedresults: User is not created. Appropriate error shown. :CaseImportance: Critical """ with pytest.raises(HTTPError): entities.User(login=invalid_name).create() @pytest.mark.tier1 @pytest.mark.parametrize('invalid_name', **parametrized(invalid_names_list())) def test_negative_create_with_invalid_firstname(self, invalid_name): """Create User with invalid Firstname :id: cb1ca8a9-38b1-4d58-ae32-915b47b91657 :parametrized: yes :expectedresults: User is not created. Appropriate error shown. :CaseImportance: Critical """ with pytest.raises(HTTPError): entities.User(firstname=invalid_name).create() @pytest.mark.tier1 @pytest.mark.parametrize('invalid_name', **parametrized(invalid_names_list())) def test_negative_create_with_invalid_lastname(self, invalid_name): """Create User with invalid Lastname :id: 59546d26-2b6b-400b-990f-0b5d1c35004e :parametrized: yes :expectedresults: User is not created. Appropriate error shown. :CaseImportance: Critical """ with pytest.raises(HTTPError): entities.User(lastname=invalid_name).create() @pytest.mark.tier1 def test_negative_create_with_blank_authorized_by(self): """Create User with blank authorized by :id: 1fe2d1e3-728c-4d89-97ae-3890e904f413 :expectedresults: User is not created. Appropriate error shown. :CaseImportance: Critical """ with pytest.raises(HTTPError): entities.User(auth_source='').create()