Example #1
0
    def test_positive_update_user_4(self):
        """@Test: Update Email Address in User

        @Feature: User - Positive Update

        @Steps:
        1. Create User
        2. Update Email Address for all variations in [1]

        @Assert: User is updated
        """
        user = make_user()
        for data in (gen_string("alpha"),
                     gen_string("alphanumeric"),
                     gen_string("numeric"),
                     '{0}+{1}'.format(gen_alphanumeric(), gen_alphanumeric()),
                     '{0}.{1}'.format(gen_alphanumeric(), gen_alphanumeric()),
                     r"!#$%&*+-/=?^`{|}~"):
            with self.subTest(data):
                email = '{0}@example.com'.format(data)
                UserObj.update({
                    'id': user['id'],
                    # escape ` to avoid bash syntax error
                    'mail': email.replace('`', r'\`'),
                })
                result = UserObj.info({'id': user['id']})
                self.assertEqual(result['email'], email)
Example #2
0
    def test_positive_update_email(self):
        """Update Email Address in My Account

        @Feature: My Account - Positive Update

        @Assert: Current User is updated
        """
        email = u'{0}@example.com'.format(gen_string('alphanumeric'))
        User.update({'id': self.user['id'], 'mail': email})
        result = User.info({'id': self.user['id']})
        self.assertEqual(result['email'], email)
Example #3
0
    def test_positive_update_email(self):
        """Update Email Address in My Account

        @Feature: My Account - Positive Update

        @Assert: Current User is updated
        """
        email = u'{0}@example.com'.format(gen_string('alphanumeric'))
        User.update({'id': self.user['id'], 'mail': email})
        result = User.info({'id': self.user['id']})
        self.assertEqual(result['email'], email)
Example #4
0
    def test_positive_update_email(self):
        """Update Email Address in My Account

        @id: 70bab43b-0842-45a1-81fb-e47ff8646c8e

        @Assert: Current User is updated
        """
        email = u'{0}@example.com'.format(gen_string('alphanumeric'))
        User.update({'id': self.user['id'], 'mail': email})
        result = User.info({'id': self.user['id']})
        self.assertEqual(result['email'], email)
Example #5
0
    def test_negative_update_surname(self):
        """Update My Account with invalid Surname

        @Feature: My Account - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        with self.assertRaises(CLIReturnCodeError):
            User.update({
                'id': self.user['id'],
                'lastname': gen_string('alphanumeric', 300),
            })
Example #6
0
    def test_negative_update_surname(self):
        """Update My Account with invalid Surname

        @Feature: My Account - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        with self.assertRaises(CLIReturnCodeError):
            User.update({
                'id': self.user['id'],
                'lastname': gen_string('alphanumeric', 300),
            })
Example #7
0
    def test_positive_update_surname(self):
        """Update Surname in My Account

        @Feature: My Account - Positive Update

        @Assert: Current User is updated
        """
        new_lastname = gen_string('alphanumeric')
        User.update({'id': self.user['id'], 'lastname': new_lastname})
        result = User.info({'id': self.user['id']})
        updated_last_name = result['name'].split(' ')
        self.assertEqual(updated_last_name[1], new_lastname)
Example #8
0
    def test_negative_update_first_name(self):
        """Update My Account with invalid FirstName

        @id: 1e0e1a94-4cef-4110-b65c-8cd35df254e0

        @Assert: User is not updated. Appropriate error shown.
        """
        with self.assertRaises(CLIReturnCodeError):
            User.update({
                'id': self.user['id'],
                'firstname': gen_string('alphanumeric', 300),
            })
Example #9
0
    def test_negative_update_surname(self):
        """Update My Account with invalid Surname

        @id: 4d31ba71-2dcc-47ee-94d2-adc168ba89d7

        @Assert: User is not updated. Appropriate error shown.
        """
        with self.assertRaises(CLIReturnCodeError):
            User.update({
                'id': self.user['id'],
                'lastname': gen_string('alphanumeric', 300),
            })
Example #10
0
    def test_positive_update_first_name(self):
        """Update Firstname in My Account

        @id: f8de3843-f2dc-4121-ab75-625c8f542627

        @Assert: Current User is updated
        """
        new_firstname = gen_string('alphanumeric')
        User.update({'id': self.user['id'], 'firstname': new_firstname})
        result = User.info({'id': self.user['id']})
        updated_first_name = result['name'].split(' ')
        self.assertEqual(updated_first_name[0], new_firstname)
Example #11
0
    def test_positive_update_surname(self):
        """Update Surname in My Account

        @Feature: My Account - Positive Update

        @Assert: Current User is updated
        """
        new_lastname = gen_string('alphanumeric')
        User.update({'id': self.user['id'], 'lastname': new_lastname})
        result = User.info({'id': self.user['id']})
        updated_last_name = result['name'].split(' ')
        self.assertEqual(updated_last_name[1], new_lastname)
Example #12
0
    def test_positive_update_surname(self):
        """Update Surname in My Account

        @id: 40ad2e78-a2af-45ca-bbd8-e9ca5178dc41

        @Assert: Current User is updated
        """
        new_lastname = gen_string('alphanumeric')
        User.update({'id': self.user['id'], 'lastname': new_lastname})
        result = User.info({'id': self.user['id']})
        updated_last_name = result['name'].split(' ')
        self.assertEqual(updated_last_name[1], new_lastname)
Example #13
0
    def test_negative_update_email(self):
        """Try to update User using invalid Email Address

        @id: 4a2876cc-2580-4ae9-8ce7-d7390bfebd4b

        @Assert: User is not updated.  Appropriate error shown.
        """
        user = self.user
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    User.update({'login': user['login'], 'mail': email})
                self.assert_error_msg(raise_ctx, u'Could not update the user:')
Example #14
0
    def test_negative_update_email(self):
        """Update My Account with invalid Email Address

        @Feature: My Account - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'login': self.user['login'],
                        'mail': email,
                    })
Example #15
0
    def test_negative_update_email(self):
        """Update My Account with invalid Email Address

        @Feature: My Account - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'login': self.user['login'],
                        'mail': email,
                    })
Example #16
0
    def test_negative_update_email(self):
        """Update My Account with invalid Email Address

        @id: 619f6285-8d50-47d4-b074-d8854c7567a6

        @Assert: User is not updated. Appropriate error shown.
        """
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'login': self.user['login'],
                        'mail': email,
                    })
Example #17
0
    def test_negative_update_username(self):
        """Try to update User using invalid Username

        @id: 208bb597-1b33-44c8-9b15-b7bfcbb739fd

        @Assert: User is not updated. Appropriate error shown.
        """
        user = self.user
        for new_user_name in invalid_names_list():
            with self.subTest(new_user_name):
                options = {'id': user['id'], 'login': new_user_name}
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    User.update(options)
                self.assert_error_msg(raise_ctx, u'Could not update the user:')
Example #18
0
    def test_positive_update_org(self):
        """Assign a User to an Org

        @Feature: User - Positive Update

        @Assert: User is updated
        """
        user = make_user()
        org = make_org()
        User.update({
            'id': user['id'],
            'organization-ids': org['id'],
        })
        user = User.info({'id': user['id']})
        self.assertEqual(org['name'], user['organizations'][0])
Example #19
0
    def test_negative_update_email(self):
        """Try to update User using invalid Email Address

        @id: 4a2876cc-2580-4ae9-8ce7-d7390bfebd4b

        @Assert: User is not updated.  Appropriate error shown.
        """
        user = make_user()
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'login': user['login'],
                        'mail': email,
                    })
Example #20
0
    def test_negative_update_username(self):
        """Try to update User using invalid Username

        @Feature: User - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        user = make_user()
        for new_user_name in invalid_names_list():
            with self.subTest(new_user_name):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'id': user['id'],
                        'login': new_user_name,
                    })
Example #21
0
    def test_negative_update_username(self):
        """Try to update User using invalid Username

        @id: 208bb597-1b33-44c8-9b15-b7bfcbb739fd

        @Assert: User is not updated. Appropriate error shown.
        """
        user = make_user()
        for new_user_name in invalid_names_list():
            with self.subTest(new_user_name):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'id': user['id'],
                        'login': new_user_name,
                    })
Example #22
0
    def test_positive_update_org(self):
        """Assign a User to an Org

        @id: 7d16ea11-b1e9-4f3b-b3c5-a4b8569947da

        @Assert: User is updated
        """
        user = make_user()
        org = make_org()
        User.update({
            'id': user['id'],
            'organization-ids': org['id'],
        })
        user = User.info({'id': user['id']})
        self.assertEqual(org['name'], user['organizations'][0])
Example #23
0
    def test_positive_update_to_admin(self):
        """Convert usual user to an admin user

        @id: 3c5cdeb0-c529-472e-a291-269b703bf9d1

        @Assert: User is updated
        """
        user = make_user()
        self.assertEqual(user['admin'], 'no')
        User.update({
            'id': user['id'],
            'admin': '1',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'yes')
Example #24
0
    def test_positive_update_to_non_admin(self):
        """Convert an user from an admin user to non-admin user

        @id: 6a291547-d60d-4dc6-aeb6-d7ad969993a8

        @Assert: User is updated
        """
        user = make_user({'admin': '1'})
        self.assertEqual(user['admin'], 'yes')
        User.update({
            'id': user['id'],
            'admin': '0',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'no')
Example #25
0
    def test_positive_update_to_admin(self):
        """Convert usual user to an admin user

        @Feature: User - Positive Update

        @Assert: User is updated
        """
        user = make_user()
        self.assertEqual(user['admin'], 'no')
        User.update({
            'id': user['id'],
            'admin': '1',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'yes')
Example #26
0
    def test_positive_update_password(self):
        """Update Password in My Account

        @Feature: My Account - Positive Update

        @Assert: User is updated
        """
        password = gen_string('alphanumeric')
        User.update({
            'id': self.user['id'],
            'password': password,
        })
        User.foreman_admin_password = password
        result = User.info({'id': self.user['id']})
        self.assertTrue(result)
Example #27
0
    def test_negative_update_email(self):
        """Try to update User using invalid Email Address

        :id: 4a2876cc-2580-4ae9-8ce7-d7390bfebd4b

        :expectedresults: User is not updated.  Appropriate error shown.

        :CaseImportance: Critical
        """
        user = self.user
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaisesRegex(CLIReturnCodeError,
                                            u'Could not update the user:'******'login': user['login'], 'mail': email})
Example #28
0
    def test_positive_update_password(self):
        """Update Password in My Account

        @id: e7e9b212-f0aa-4f7e-8433-b4639da89495

        @Assert: User is updated
        """
        password = gen_string('alphanumeric')
        User.update({
            'id': self.user['id'],
            'password': password,
        })
        User.foreman_admin_password = password
        result = User.info({'id': self.user['id']})
        self.assertTrue(result)
Example #29
0
    def test_positive_update_to_admin(self):
        """Convert usual user to an admin user

        @Feature: User - Positive Update

        @Assert: User is updated
        """
        user = make_user()
        self.assertEqual(user['admin'], 'no')
        User.update({
            'id': user['id'],
            'admin': '1',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'yes')
Example #30
0
    def test_negative_update_username(self):
        """Try to update User using invalid Username

        @Feature: User - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        user = make_user()
        for new_user_name in invalid_names_list():
            with self.subTest(new_user_name):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'id': user['id'],
                        'login': new_user_name,
                    })
Example #31
0
    def test_positive_update_org(self):
        """Assign a User to an Org

        @Feature: User - Positive Update

        @Assert: User is updated
        """
        user = make_user()
        org = make_org()
        User.update({
            'id': user['id'],
            'organization-ids': org['id'],
        })
        user = User.info({'id': user['id']})
        self.assertEqual(org['name'], user['organizations'][0])
Example #32
0
    def test_positive_update_to_admin(self):
        """Convert usual user to an admin user

        @id: 3c5cdeb0-c529-472e-a291-269b703bf9d1

        @Assert: User is updated
        """
        user = self.user
        self.assertEqual(user['admin'], 'no')
        User.update({
            'id': user['id'],
            'admin': '1',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'yes')
Example #33
0
    def test_negative_update_email(self):
        """Try to update User using invalid Email Address

        @Feature: User - Negative Update

        @Assert: User is not updated.  Appropriate error shown.
        """
        user = make_user()
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'login': user['login'],
                        'mail': email,
                    })
Example #34
0
    def test_positive_update_org(self):
        """Assign a User to an Org

        @id: 7d16ea11-b1e9-4f3b-b3c5-a4b8569947da

        @Assert: User is updated
        """
        user = self.user
        org = make_org()
        User.update({
            'id': user['id'],
            'organization-ids': org['id'],
        })
        user = User.info({'id': user['id']})
        self.assertEqual(org['name'], user['organizations'][0])
Example #35
0
    def test_positive_update_to_non_admin(self):
        """Convert an user from an admin user to non-admin user

        @id: 6a291547-d60d-4dc6-aeb6-d7ad969993a8

        @Assert: User is updated
        """
        user = make_user({'admin': '1'})
        self.assertEqual(user['admin'], 'yes')
        User.update({
            'id': user['id'],
            'admin': '0',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'no')
Example #36
0
    def test_negative_update_email(self):
        """Try to update User using invalid Email Address

        @Feature: User - Negative Update

        @Assert: User is not updated.  Appropriate error shown.
        """
        user = make_user()
        for email in invalid_emails_list():
            with self.subTest(email):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'login': user['login'],
                        'mail': email,
                    })
Example #37
0
    def test_positive_update_password(self):
        """Update Password in My Account

        @Feature: My Account - Positive Update

        @Assert: User is updated
        """
        password = gen_string('alphanumeric')
        User.update({
            'id': self.user['id'],
            'password': password,
        })
        User.foreman_admin_password = password
        result = User.info({'id': self.user['id']})
        self.assertTrue(result)
Example #38
0
    def test_negative_update_surname(self):
        """Try to update User using invalid Last Name

        @Feature: User - Negative Update

        @Assert: User is not updated. Appropriate error shown.
        """
        user = make_user()
        for invalid_lastname in (gen_string('alpha', 51), gen_string('html')):
            with self.subTest(invalid_lastname):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'lastname': invalid_lastname,
                        'login': user['login'],
                    })
Example #39
0
    def test_positive_update_password(self):
        """Update Password/Verify fields for existing User

        @id: 065197ab-1352-4da8-9df6-b6ff332e6847

        @Assert: User is updated
        """
        user = make_user()
        for password in valid_usernames_list():
            with self.subTest(password):
                User.update({
                    'id': user['id'],
                    'password': password,
                })
                user = User.info({'id': user['id']})
                self.assertTrue(user)
Example #40
0
    def test_positive_update_password(self):
        """Update Password/Verify fields for existing User

        @Feature: User - Positive Update

        @Assert: User is updated
        """
        user = make_user()
        for password in valid_usernames_list():
            with self.subTest(password):
                User.update({
                    'id': user['id'],
                    'password': password,
                })
                user = User.info({'id': user['id']})
                self.assertTrue(user)
Example #41
0
    def test_negative_update_surname(self):
        """Try to update User using invalid Last Name

        @id: 92ca237a-daa8-43bd-927b-a0bdc8250658

        @Assert: User is not updated. Appropriate error shown.
        """
        user = make_user()
        for invalid_lastname in (gen_string('alpha', 51),
                                 gen_string('html')):
            with self.subTest(invalid_lastname):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'lastname': invalid_lastname,
                        'login': user['login'],
                    })
Example #42
0
    def test_positive_update_password(self):
        """Update Password/Verify fields for existing User

        @id: 065197ab-1352-4da8-9df6-b6ff332e6847

        @Assert: User is updated
        """
        user = self.user
        for password in valid_usernames_list():
            with self.subTest(password):
                User.update({
                    'id': user['id'],
                    'password': password,
                })
                user = User.info({'id': user['id']})
                self.assertTrue(user)
Example #43
0
    def test_negative_update_surname(self):
        """Try to update User using invalid Last Name

        @id: 92ca237a-daa8-43bd-927b-a0bdc8250658

        @Assert: User is not updated. Appropriate error shown.
        """
        user = self.user
        for invalid_lastname in (gen_string('alpha', 51), gen_string('html')):
            with self.subTest(invalid_lastname):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    User.update({
                        'lastname': invalid_lastname,
                        'login': user['login']
                    })
                self.assert_error_msg(raise_ctx, u'Could not update the user:')
Example #44
0
    def test_positive_update_password(self):
        """Update Password/Verify fields for existing User

        @Feature: User - Positive Update

        @Assert: User is updated
        """
        user = make_user()
        for password in valid_usernames_list():
            with self.subTest(password):
                User.update({
                    'id': user['id'],
                    'password': password,
                })
                user = User.info({'id': user['id']})
                self.assertTrue(user)
Example #45
0
    def test_negative_update_username(self):
        """Try to update User using invalid Username

        @id: 208bb597-1b33-44c8-9b15-b7bfcbb739fd

        @Assert: User is not updated. Appropriate error shown.
        """
        user = self.user
        for new_user_name in invalid_names_list():
            with self.subTest(new_user_name):
                options = {'id': user['id'], 'login': new_user_name}
                with self.assertRaisesRegex(
                    CLIReturnCodeError,
                    u'Could not update the user:'
                ):
                    User.update(options)
Example #46
0
    def test_negative_update_username(self):
        """Try to update User using invalid Username

        :id: 208bb597-1b33-44c8-9b15-b7bfcbb739fd

        :expectedresults: User is not updated. Appropriate error shown.

        :CaseImportance: Critical
        """
        user = self.user
        for new_user_name in invalid_names_list():
            with self.subTest(new_user_name):
                options = {'id': user['id'], 'login': new_user_name}
                with self.assertRaisesRegex(CLIReturnCodeError,
                                            u'Could not update the user:'):
                    User.update(options)
Example #47
0
    def test_positive_update_all_locales(self):
        """Update Language in My Account

        :id: f0993495-5117-461d-a116-44867b820139

        :Steps: Update current User with all different Language options

        :expectedresults: Current User is updated

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        user = make_user()
        for locale in LOCALES:
            User.update({'id': user['id'], 'locale': locale})
            assert locale == User.info({'id': user['id']})['locale']
Example #48
0
    def test_negative_update_firstname(self):
        """Try to update User using invalid First Name

        @id: fb425e86-6e09-4535-b1dc-aef1e02ea712

        @Assert: User is not updated. Appropriate error shown.
        """
        user = make_user()
        for invalid_firstname in invalid_names_list():
            with self.subTest(invalid_firstname):
                with self.assertRaises(CLIReturnCodeError):
                    User.update({
                        'firstname': invalid_firstname,
                        'login': user['login'],
                    })
                    updated_user = User.info({'id': user['id']})
                    self.assertEqual(updated_user['name'], user['name'])
Example #49
0
    def test_positive_update_org(self):
        """Assign a User to an Org

        :id: 7d16ea11-b1e9-4f3b-b3c5-a4b8569947da

        :expectedresults: User is updated

        :CaseImportance: Critical
        """
        user = self.user
        org = make_org()
        User.update({
            'id': user['id'],
            'organization-ids': org['id'],
        })
        user = User.info({'id': user['id']})
        self.assertEqual(org['name'], user['organizations'][0])
Example #50
0
    def test_positive_update_to_admin(self):
        """Convert usual user to an admin user

        :id: 3c5cdeb0-c529-472e-a291-269b703bf9d1

        :expectedresults: User is updated

        :CaseImportance: Critical
        """
        user = self.user
        self.assertEqual(user['admin'], 'no')
        User.update({
            'id': user['id'],
            'admin': '1',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'yes')
Example #51
0
    def test_positive_update_org(self):
        """Assign a User to an Org

        :id: 7d16ea11-b1e9-4f3b-b3c5-a4b8569947da

        :expectedresults: User is updated

        :CaseImportance: Critical
        """
        user = self.user
        org = make_org()
        User.update({
            'id': user['id'],
            'organization-ids': org['id'],
        })
        user = User.info({'id': user['id']})
        self.assertEqual(org['name'], user['organizations'][0])
Example #52
0
    def test_positive_update_to_admin(self):
        """Convert usual user to an admin user

        :id: 3c5cdeb0-c529-472e-a291-269b703bf9d1

        :expectedresults: User is updated

        :CaseImportance: Critical
        """
        user = self.user
        self.assertEqual(user['admin'], 'no')
        User.update({
            'id': user['id'],
            'admin': '1',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'yes')
Example #53
0
    def test_positive_update_to_non_admin(self):
        """Convert an user from an admin user to non-admin user

        :id: 6a291547-d60d-4dc6-aeb6-d7ad969993a8

        :expectedresults: User is updated

        :CaseImportance: Critical
        """
        user = make_user({'admin': '1'})
        self.assertEqual(user['admin'], 'yes')
        User.update({
            'id': user['id'],
            'admin': '0',
        })
        user = User.info({'id': user['id']})
        self.assertEqual(user['admin'], 'no')