예제 #1
0
    def test_positive_create_user_30(self):
        """@Test: Create User and associate a default Location.

        @Feature: User - Positive Create

        @Assert: User is created with default Location selected.

        """
        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        loc_name = gen_string("alpha", 6)
        entities.Location(name=loc_name).create()
        with Session(self.browser) as session:
            make_user(session,
                      username=name,
                      locations=[loc_name],
                      edit=True,
                      default_loc=loc_name)
            self.user.search(name, search_key).click()
            session.nav.wait_until_element(
                tab_locators["users.tab_locations"]).click()
            element = session.nav.wait_until_element(
                (strategy, value % loc_name))
            self.assertIsNotNone(element)
            loc_element = session.nav.find_element(
                locators["users.default_loc"])
            # Fetches currently selected option in a normal select.
            option = Select(loc_element).first_selected_option
            self.assertEqual(loc_name, option.text)
예제 #2
0
    def test_positive_update_user_1(self, new_username):
        """@Test: Update Username in User

        @Feature: User - Positive Update

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

        @Assert: User is updated

        @BZ: 1139616

        """
        name = gen_string("alpha", 6)
        password = gen_string("alpha", 8)
        with Session(self.browser) as session:
            make_user(session,
                      username=name,
                      password1=password,
                      password2=password)
            self.user.update(search_key, name, new_username)
            self.assertIsNotNone(self.user.search(new_username, search_key))
            self.login.logout()
            self.login.login(new_username, password)
            self.assertTrue(self.login.is_logged())
예제 #3
0
    def test_positive_create_user_25(self):
        """@Test: Create User associated to multiple Orgs

        @Feature: User - Positive Create

        @Assert: User is created

        """
        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        org_name1 = gen_string("alpha", 6)
        org_name2 = gen_string("alpha", 6)
        for org_name in [org_name1, org_name2]:
            entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            make_user(session,
                      username=name,
                      organizations=[org_name1, org_name2],
                      edit=True)
            self.user.search(name, search_key).click()
            self.user.wait_until_element(
                tab_locators["users.tab_organizations"]).click()
            for org_name in [org_name1, org_name2]:
                element = self.user.wait_until_element(
                    (strategy, value % org_name))
                self.assertIsNotNone(element)
예제 #4
0
    def test_positive_create_user_10(self):
        """@Test: Create User with multiple roles

        @Feature: User - Positive Create

        @Steps:
        1. Create User with multiple roles assigned to it

        @Assert: User is created

        """
        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        role1 = gen_string("alpha", 6)
        role2 = gen_string("alpha", 6)
        for role in [role1, role2]:
            entities.Role(name=role).create()
        with Session(self.browser) as session:
            make_user(session, username=name, roles=[role1, role2], edit=True)
            self.user.search(name, search_key).click()
            self.user.wait_for_ajax()
            self.user.wait_until_element(
                tab_locators["users.tab_roles"]).click()
            for role in [role1, role2]:
                element = self.user.wait_until_element(
                    (strategy, value % role))
                self.assertIsNotNone(element)
예제 #5
0
    def test_positive_update_username(self):
        """Update Username in User

        :id: 4ecb2816-9bef-4089-86a0-02d7d065cdb1

        :expectedresults: User is updated successfully

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        password = gen_string('alpha')
        with Session(self.browser) as session:
            # Role Site meaning 'Site Manager' here
            make_user(
                session,
                username=name,
                password1=password,
                password2=password,
                edit=True,
                roles=['Site'],
            )
        for new_username in valid_strings():
            with self.subTest(new_username):
                with Session(self.browser):
                    self.user.update(name, new_username)
                    self.assertIsNotNone(
                        self.user.search(new_username))
                    self.login.logout()
                    self.login.login(new_username, password)
                    self.assertTrue(self.login.is_logged())
                    name = new_username  # for next iteration
예제 #6
0
    def test_update_role(self):
        """@Test: Update role for a user

        @Feature: User - Update

        @Assert: User role is updated

        """

        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        role_name = entities.Role().create()['name']
        with Session(self.browser) as session:
            make_user(session, username=name)
            self.user.search(name, search_key).click()
            self.user.wait_until_element(
                tab_locators["users.tab_roles"]).click()
            element1 = self.user.wait_until_element(
                (strategy, value % role_name))
            self.assertIsNone(element1)
            self.user.update(search_key, name, new_roles=[role_name])
            self.user.search(name, search_key).click()
            self.user.wait_until_element(
                tab_locators["users.tab_roles"]).click()
            element2 = self.user.wait_until_element(
                (strategy, value % role_name))
            self.assertIsNotNone(element2)
예제 #7
0
    def test_positive_create_with_password(self):
        """Create User for all variations of Password

        @Feature: User - Positive Create

        @Assert: User is created successfully
        """
        test_data = valid_strings()
        #  List is extended to test additional password data points
        test_data.extend([
            x for x in (
                u'foo@!#$^&*( ) {0}'.format(gen_string('alpha', 2)),
                u'bar+{{}}|\"?hi {0}'.format(gen_string('alpha', 2)),
            )
        ])
        with Session(self.browser) as session:
            for password in test_data:
                with self.subTest(password):
                    name = gen_string('alpha')
                    make_user(
                        session,
                        username=name,
                        password1=password,
                        password2=password,
                    )
                    self.assertIsNotNone(self.user.search(name))
예제 #8
0
    def test_add_user_1(self, testdata):
        """@test: Create user then add user
        by using the location name

        @feature: Locations

        @assert: User is added to location

        """
        user = testdata['name']
        strategy, value = common_locators["entity_deselect"]
        loc_name = generate_string("alpha", 8)
        password = generate_string("alpha", 8)
        email = generate_email_address()
        search_key = "login"
        with Session(self.browser) as session:
            make_loc(session, name=loc_name)
            self.assertIsNotNone(self.location.search(loc_name))
            make_user(session, username=user, first_name=user,
                      last_name=user, email=email,
                      password1=password, password2=password)
            self.assertIsNotNone(self.user.search(user, search_key))
            self.location.update(loc_name, new_users=[user])
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_users"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % user))
            self.assertIsNotNone(element)
예제 #9
0
    def test_positive_create_with_password(self):
        """Create User for all variations of Password

        @Feature: User - Positive Create

        @Assert: User is created successfully
        """
        test_data = valid_strings()
        #  List is extended to test additional password data points
        test_data.extend([
            x for x in (
                u'foo@!#$^&*( ) {0}'.format(gen_string('alpha', 2)),
                u'bar+{{}}|\"?hi {0}'.format(gen_string('alpha', 2)),
            )
        ])
        with Session(self.browser) as session:
            for password in test_data:
                with self.subTest(password):
                    name = gen_string('alpha')
                    make_user(
                        session,
                        username=name,
                        password1=password,
                        password2=password,
                    )
                    self.assertIsNotNone(self.user.search(name))
예제 #10
0
    def test_positive_update_username(self):
        """Update Username in User

        @id: 4ecb2816-9bef-4089-86a0-02d7d065cdb1

        @Assert: User is updated successfully
        """
        name = gen_string('alpha')
        password = gen_string('alpha')
        with Session(self.browser) as session:
            # Role Site meaning 'Site Manager' here
            make_user(
                session,
                username=name,
                password1=password,
                password2=password,
                edit=True,
                roles=['Site'],
            )
        for new_username in valid_strings():
            with self.subTest(new_username):
                with Session(self.browser):
                    self.user.update(name, new_username)
                    self.assertIsNotNone(self.user.search(new_username))
                    self.login.logout()
                    self.login.login(new_username, password)
                    self.assertTrue(self.login.is_logged())
                    name = new_username  # for next iteration
예제 #11
0
    def test_positive_create_with_multiple_orgs(self):
        """Create User associated to multiple Orgs

        @id: d74c0284-3995-4a4a-8746-00858282bf5d

        @Assert: User is created successfully

        @CaseLevel: Integration
        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        org_name1 = gen_string('alpha')
        org_name2 = gen_string('alpha')
        for org_name in [org_name1, org_name2]:
            entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            set_context(session, org=DEFAULT_ORG)
            make_user(
                session,
                username=name,
                organizations=[org_name1, org_name2],
                edit=True,
            )
            self.user.click(self.user.search(name))
            self.user.click(tab_locators['users.tab_organizations'])
            for org_name in [org_name1, org_name2, DEFAULT_ORG]:
                element = self.user.wait_until_element(
                    (strategy, value % org_name))
                self.assertIsNotNone(element)
예제 #12
0
    def test_positive_create_with_multiple_orgs(self):
        """Create User associated to multiple Orgs

        @Feature: User - Positive Create

        @Assert: User is created successfully
        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        org_name1 = gen_string('alpha')
        org_name2 = gen_string('alpha')
        for org_name in [org_name1, org_name2]:
            entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            make_user(
                session,
                username=name,
                organizations=[org_name1, org_name2],
                edit=True,
            )
            self.user.search(name).click()
            self.user.click(tab_locators['users.tab_organizations'])
            for org_name in [org_name1, org_name2, DEFAULT_ORG]:
                element = self.user.wait_until_element(
                    (strategy, value % org_name))
                self.assertIsNotNone(element)
예제 #13
0
    def test_positive_create_with_default_org(self):
        """Create User and has default organization associated with it

        @id: 3d51dead-9053-427d-8292-c42e87ed6289

        @Assert: User is created with default Org selected.
        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        org_name = gen_string('alpha')
        entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            make_user(session,
                      username=name,
                      organizations=[org_name],
                      edit=True,
                      default_org=org_name)
            self.user.click(self.user.search(name))
            self.user.click(tab_locators['users.tab_organizations'])
            element = session.nav.wait_until_element(
                (strategy, value % org_name))
            self.assertIsNotNone(element)
            # Check that default organization value was really chosen
            self.assertEqual(
                org_name,
                session.nav.find_element(
                    locators['users.default_org_value']).text)
예제 #14
0
    def test_positive_create_with_password(self):
        """Create User for all variations of Password

        :id: 83d6efe0-7526-465c-9c97-5673c7736fc4

        :expectedresults: User is created successfully

        :CaseImportance: Critical
        """
        test_data = valid_strings()
        extra_passwords = (
            u'foo@!#$^&*( ) {0}'.format(gen_string('alpha', 2)),
            u'bar+{{}}|\"?hi {0}'.format(gen_string('alpha', 2)),
        )
        test_data.extend(extra_passwords)
        with Session(self.browser) as session:
            for password in test_data:
                with self.subTest(password):
                    name = gen_string('alpha')
                    make_user(
                        session,
                        username=name,
                        password1=password,
                        password2=password,
                    )
                    self.assertIsNotNone(self.user.search(name))
예제 #15
0
    def test_positive_create_user_25(self):
        """@Test: Create User associated to multiple Orgs

        @Feature: User - Positive Create

        @Assert: User is created

        """
        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        org_name1 = gen_string("alpha", 6)
        org_name2 = gen_string("alpha", 6)
        for org_name in [org_name1, org_name2]:
            entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            make_user(session, username=name,
                      organizations=[org_name1, org_name2],
                      edit=True)
            self.user.search(name, search_key).click()
            self.user.wait_until_element(
                tab_locators["users.tab_organizations"]).click()
            for org_name in [org_name1, org_name2]:
                element = self.user.wait_until_element((strategy,
                                                        value % org_name))
                self.assertIsNotNone(element)
예제 #16
0
    def test_positive_create_user_default_location(self):
        """@Test: Create User and associate a default Location.

        @Feature: User - Positive Create

        @Assert: User is created with default Location selected.

        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        loc_name = gen_string('alpha')
        entities.Location(name=loc_name).create()
        with Session(self.browser) as session:
            make_user(session, username=name, locations=[loc_name],
                      edit=True, default_loc=loc_name)
            self.user.search(name, search_key).click()
            session.nav.click(tab_locators['users.tab_locations'])
            element = session.nav.wait_until_element((strategy,
                                                      value % loc_name))
            self.assertIsNotNone(element)
            loc_element = session.nav.find_element(
                locators['users.default_loc'])
            # Fetches currently selected option in a normal select.
            option = Select(loc_element).first_selected_option
            self.assertEqual(loc_name, option.text)
예제 #17
0
    def test_negative_create_user_with_invalid_surname(self):
        """@Test: Create User with invalid Surname

        @Feature: User - Negative Create

        @Steps:
        1. Create User for all invalid Surname in [2]
        using valid Username, First Name Email Address, Language, authorized by

        @Assert: User is not created. Appropriate error shown.

        """
        with Session(self.browser) as session:
            # invalid_values_list is not used here because sur name is an
            # optional field
            for last_name in invalid_names_list():
                with self.subTest(last_name):
                    make_user(
                        session,
                        username=gen_string('alpha'),
                        last_name=last_name,
                    )
                    self.assertIsNotNone(
                        self.user.wait_until_element(
                            common_locators['haserror'])
                    )
예제 #18
0
    def test_positive_create_user_3(self, last_name):
        """@Test: Create User for all variations of Surname

        @Feature: User - Positive Create

        @Steps:
        1. Create User for all valid Surname variation in [1] using
        valid User name, First Name, Email Address, Language, authorized by

        @Assert: User is created

        """

        name = gen_string("alpha", 8)
        with Session(self.browser) as session:
            make_user(session, username=name, last_name=last_name)
            element = self.user.search(name, search_key)
            self.assertIsNotNone(element)
            element.click()
            self.assertEqual(
                last_name,
                self.user.wait_until_element(
                    locators['users.lastname']
                ).get_attribute('value')
            )
예제 #19
0
    def test_positive_create_user_different_pass(self):
        """@Test: Create User for all variations of Password

        @Feature: User - Positive Create

        @Steps:
        1. Create User for all valid Password variation in [1] using valid
        Username, First Name, Surname, Email Address, Language, authorized by

        @Assert: User is created

        """
        test_data = valid_strings()
        #  List is extended to test additional password data points
        test_data.extend([
            x for x in (
                u'foo@!#$^&*( ) {0}'.format(gen_string('alpha', 2)),
                u'bar+{{}}|\"?hi {0}'.format(gen_string('alpha', 2)),
            )
        ])
        with Session(self.browser) as session:
            for password in test_data:
                with self.subTest(password):
                    name = gen_string('alpha')
                    make_user(
                        session,
                        username=name,
                        password1=password,
                        password2=password,
                    )
                    self.assertIsNotNone(self.user.search(name))
예제 #20
0
    def test_positive_create_user_different_languages(self):
        """@Test: Create User for all variations of Language

        @Feature: User - Positive Create

        @Steps:
        1. Create User for all valid Language variations using
        valid Username, First Name, Surname, Email Address, authorized by

        @Assert: User is created

        """
        with Session(self.browser) as session:
            for language in LANGUAGES:
                with self.subTest(language):
                    name = gen_string('alpha')
                    make_user(session, username=name, locale=language)
                    element = self.user.search(name)
                    self.assertIsNotNone(element)
                    element.click()
                    self.assertEqual(
                        language,
                        self.user.wait_until_element(
                            locators['users.selected_lang']
                        ).get_attribute('value')
                    )
예제 #21
0
    def test_positive_create_user_different_first_names(self):
        """@Test: Create User for all variations of First Name

        @Feature: User - Positive Create

        @Steps:
        1. Create User for all valid First Name variation in [1] using
        valid Username, Surname, Email Address, Language, authorized by

        @Assert: User is created

        """
        with Session(self.browser) as session:
            for first_name in valid_strings():
                with self.subTest(first_name):
                    name = gen_string('alpha')
                    make_user(session, username=name, first_name=first_name)
                    element = self.user.search(name)
                    self.assertIsNotNone(element)
                    element.click()
                    self.assertEqual(
                        first_name,
                        self.user.wait_until_element(
                            locators['users.firstname']).get_attribute('value')
                    )
예제 #22
0
    def test_positive_create_user_with_multiple_roles(self):
        """@Test: Create User with multiple roles

        @Feature: User - Positive Create

        @Steps:
        1. Create User with multiple roles assigned to it

        @Assert: User is created

        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        role1 = gen_string('alpha')
        role2 = gen_string('alpha')
        for role in [role1, role2]:
            entities.Role(name=role).create()
        with Session(self.browser) as session:
            make_user(session, username=name, roles=[role1, role2],
                      edit=True)
            self.user.search(name, search_key).click()
            self.user.wait_for_ajax()
            self.user.click(tab_locators['users.tab_roles'])
            for role in [role1, role2]:
                element = self.user.wait_until_element((strategy,
                                                        value % role))
                self.assertIsNotNone(element)
예제 #23
0
    def test_positive_create_user_29(self):
        """@Test: Create User and associate a default Org

        @Feature: User - Positive Create.

        @Assert: User is created with default Org selected.

        """
        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        org_name = gen_string("alpha", 6)
        entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            make_user(session, username=name, organizations=[org_name],
                      edit=True, default_org=org_name)
            self.user.search(name, search_key).click()
            session.nav.wait_until_element(
                tab_locators["users.tab_organizations"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % org_name))
            self.assertIsNotNone(element)
            org_element = session.nav.find_element(
                locators["users.default_org"])
            # Fetches currently selected option in a normal select.
            option = Select(org_element).first_selected_option
            self.assertEqual(org_name, option.text)
예제 #24
0
    def test_positive_create_with_default_location(self):
        """Create User and associate a default Location.

        @id: 952a0be5-d393-49a2-8fd9-f6dfcc31f762

        @Assert: User is created with default Location selected.
        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        loc_name = gen_string('alpha')
        entities.Location(name=loc_name).create()
        with Session(self.browser) as session:
            make_user(session,
                      username=name,
                      locations=[loc_name],
                      edit=True,
                      default_loc=loc_name)
            self.user.click(self.user.search(name))
            self.user.click(tab_locators['users.tab_locations'])
            element = session.nav.wait_until_element(
                (strategy, value % loc_name))
            self.assertIsNotNone(element)
            # Check that default location value was really chosen
            self.assertEqual(
                loc_name,
                session.nav.find_element(
                    locators['users.default_loc_value']).text)
예제 #25
0
    def test_positive_update_user_1(self, new_username):
        """@Test: Update Username in User

        @Feature: User - Positive Update

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

        @Assert: User is updated

        @BZ: 1139616

        """
        name = gen_string("alpha", 6)
        password = gen_string("alpha", 8)
        with Session(self.browser) as session:
            make_user(session, username=name, password1=password,
                      password2=password)
            self.user.update(search_key, name, new_username)
            self.assertIsNotNone(
                self.user.search(new_username, search_key))
            self.login.logout()
            self.login.login(new_username, password)
            self.assertTrue(self.login.is_logged())
예제 #26
0
    def test_positive_update_user_username(self, new_username):
        """@Test: Update Username in User

        @Feature: User - Positive Update

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

        @Assert: User is updated

        @BZ: 1139616

        """
        name = gen_string('alpha')
        password = gen_string('alpha')
        with Session(self.browser) as session:
            # Role Site meaning 'Site Manager' here
            make_user(session, username=name, password1=password,
                      password2=password, edit=True, roles=['Site'])
            self.user.update(search_key, name, new_username)
            self.assertIsNotNone(
                self.user.search(new_username, search_key))
            self.login.logout()
            self.login.login(new_username, password)
            self.assertTrue(self.login.is_logged())
예제 #27
0
    def test_update_role(self):
        """@Test: Update role for a user

        @Feature: User - Update

        @Assert: User role is updated

        """

        strategy, value = common_locators["entity_deselect"]
        name = gen_string("alpha", 6)
        role_name = entities.Role().create()['name']
        with Session(self.browser) as session:
            make_user(session, username=name)
            self.user.search(name, search_key).click()
            self.user.wait_until_element(
                tab_locators["users.tab_roles"]).click()
            element1 = self.user.wait_until_element((strategy,
                                                     value % role_name))
            self.assertIsNone(element1)
            self.user.update(search_key, name, new_roles=[role_name])
            self.user.search(name, search_key).click()
            self.user.wait_until_element(
                tab_locators["users.tab_roles"]).click()
            element2 = self.user.wait_until_element((strategy,
                                                     value % role_name))
            self.assertIsNotNone(element2)
예제 #28
0
    def test_positive_create_with_multiple_orgs(self):
        """Create User associated to multiple Orgs

        @id: d74c0284-3995-4a4a-8746-00858282bf5d

        @Assert: User is created successfully

        @CaseLevel: Integration
        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        org_name1 = gen_string('alpha')
        org_name2 = gen_string('alpha')
        for org_name in [org_name1, org_name2]:
            entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            set_context(session, org=DEFAULT_ORG)
            make_user(
                session,
                username=name,
                organizations=[org_name1, org_name2],
                edit=True,
            )
            self.user.click(self.user.search(name))
            self.user.click(tab_locators['users.tab_organizations'])
            for org_name in [org_name1, org_name2, DEFAULT_ORG]:
                element = self.user.wait_until_element(
                    (strategy, value % org_name))
                self.assertIsNotNone(element)
예제 #29
0
    def test_add_user_2(self, name):
        """@test: Create different types of users then add user
        by using the organization name.

        @feature: Organizations associate user.

        @assert: User is added to organization.

        """

        strategy, value = common_locators["entity_deselect"]
        org_name = generate_string("alpha", 8)
        password = generate_string("alpha", 8)
        email = generate_email_address()
        search_key = "login"
        with Session(self.browser) as session:
            make_org(session, org_name=org_name)
            self.assertIsNotNone(self.org.search(org_name))
            make_user(session, username=name, first_name=name,
                      last_name=name, email=email,
                      password1=password, password2=password)
            self.assertIsNotNone(self.user.search(name, search_key))
            self.org.wait_for_ajax()
            self.org.update(org_name, new_users=[name])
            self.org.search(org_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_users"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % name))
            self.assertIsNotNone(element)
예제 #30
0
    def test_positive_create_with_password(self):
        """Create User for all variations of Password

        :id: 83d6efe0-7526-465c-9c97-5673c7736fc4

        :expectedresults: User is created successfully

        :CaseImportance: Critical
        """
        test_data = valid_strings()
        extra_passwords = (
            u'foo@!#$^&*( ) {0}'.format(gen_string('alpha', 2)),
            u'bar+{{}}|\"?hi {0}'.format(gen_string('alpha', 2)),
        )
        test_data.extend(extra_passwords)
        with Session(self.browser) as session:
            for password in test_data:
                with self.subTest(password):
                    name = gen_string('alpha')
                    make_user(
                        session,
                        username=name,
                        password1=password,
                        password2=password,
                    )
                    self.assertIsNotNone(self.user.search(name))
예제 #31
0
    def test_positive_assign_cloned_role(self):
        """Clone role and assign it to user

        :id: cbb17f37-9039-4875-981b-1f427b095ed1

        :expectedresults: User is created successfully

        :BZ: 1353788

        :CaseImportance: Critical
        """
        user_name = gen_string('alpha')
        role_name = gen_string('alpha')
        with Session(self.browser) as session:
            # Clone one of the builtin roles
            self.role.clone(choice(ROLES), role_name)
            # Create user wit this role
            make_user(session,
                      username=user_name,
                      roles=[role_name],
                      edit=True)
            self.user.search_and_click(user_name)
            self.user.click(tab_locators['users.tab_roles'])
            element = self.user.wait_until_element(
                common_locators['entity_deselect'] % role_name)
            self.assertIsNotNone(element)
예제 #32
0
    def test_positive_create_with_multiple_orgs(self):
        """Create User associated to multiple Orgs

        @Feature: User - Positive Create

        @Assert: User is created successfully
        """
        strategy, value = common_locators['entity_deselect']
        name = gen_string('alpha')
        org_name1 = gen_string('alpha')
        org_name2 = gen_string('alpha')
        for org_name in [org_name1, org_name2]:
            entities.Organization(name=org_name).create()
        with Session(self.browser) as session:
            make_user(
                session,
                username=name,
                organizations=[org_name1, org_name2],
                edit=True,
            )
            self.user.search(name).click()
            self.user.click(tab_locators['users.tab_organizations'])
            for org_name in [org_name1, org_name2, DEFAULT_ORG]:
                element = self.user.wait_until_element(
                    (strategy, value % org_name))
                self.assertIsNotNone(element)
예제 #33
0
 def test_remove_user_3(self, testdata):
     """
     @test: Create admin users then add user and remove it
     by using the organization name.
     @feature: Organizations dis-associate user.
     @assert: The user is added then removed from the organization
     """
     user_name = testdata['name']
     strategy, value = common_locators["entity_select"]
     strategy1, value1 = common_locators["entity_deselect"]
     org_name = generate_string("alpha", 8)
     password = generate_string("alpha", 8)
     email = generate_email_address()
     search_key = "login"
     with Session(self.browser) as session:
         make_user(session, username=user_name, email=email,
                   password1=password, password2=password)
         self.assertIsNotNone(self.user.search(user_name, search_key))
         make_org(session, org_name=org_name, users=[user_name], edit=True)
         self.org.search(org_name).click()
         session.nav.wait_until_element(
             tab_locators["context.tab_users"]).click()
         element = session.nav.wait_until_element((strategy1,
                                                   value1 % user_name))
         # Item is listed in 'Selected Items' list and not 'All Items' list.
         self.assertIsNotNone(element)
         self.org.update(org_name, users=[user_name], new_users=None)
         self.org.search(org_name).click()
         session.nav.wait_until_element(
             tab_locators["context.tab_users"]).click()
         element = session.nav.wait_until_element((strategy,
                                                   value % user_name))
         # Item is listed in 'All Items' list and not 'Selected Items' list.
         self.assertIsNotNone(element)
예제 #34
0
    def test_positive_update_username(self):
        """Update Username in User

        @Feature: User - Positive Update

        @Assert: User is updated successfully
        """
        name = gen_string('alpha')
        password = gen_string('alpha')
        with Session(self.browser) as session:
            # Role Site meaning 'Site Manager' here
            make_user(
                session,
                username=name,
                password1=password,
                password2=password,
                edit=True,
                roles=['Site'],
            )
        for new_username in valid_strings():
            with self.subTest(new_username):
                with Session(self.browser):
                    self.user.update(name, new_username)
                    self.assertIsNotNone(
                        self.user.search(new_username))
                    self.login.logout()
                    self.login.login(new_username, password)
                    self.assertTrue(self.login.is_logged())
                    name = new_username  # for next iteration
예제 #35
0
    def test_positive_create_filter_without_override(self):
        """Create filter in role w/o overriding it

        :id: a7f76f6e-6c13-4b34-b38c-19501b65786f

        :steps:

            1. Create a role with taxonomies (location and organization)
                assigned
            2. Create filter in role without overriding it
            3. Create user and assign new role to it
            4. Re-login into application using new user with a role

        :expectedresults:

            1. Filter w/o override is created in role
            2. The taxonomies of role are inherited to filter
            3. Override check is not marked by default in filters table
            4. User can access application sections specified in a filter
        """
        name = gen_string('alpha')
        username = gen_string('alpha')
        password = gen_string('alpha')
        domain_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_role(
                session,
                name=name,
                locations=[self.role_loc],
                organizations=[self.role_org],
            )
            self.assertIsNotNone(self.role.search(name))
            self.role.add_permission(
                name,
                resource_type='Domain',
                permission_list=['view_domains', 'create_domains'],
                override_check=True,
            )
            self.assertTrue(
                self.role.wait_until_element(common_locators['alert.success']))
            make_user(session,
                      username=username,
                      password1=password,
                      password2=password,
                      roles=[name],
                      locations=[self.role_loc],
                      organizations=[self.role_org],
                      edit=True)
        with Session(self.browser, username, password) as session:
            set_context(session, org=self.role_org)
            set_context(session, loc=self.role_loc)
            make_domain(session, name=domain_name)
            self.assertIsNotNone(self.domain.search(domain_name))
            self.assertIsNone(
                session.nav.wait_until_element(menu_locators['menu.content'],
                                               timeout=3))
            self.assertIsNone(
                session.nav.wait_until_element(menu_locators['menu.configure'],
                                               timeout=3))
예제 #36
0
    def test_positive_create_non_overridable_filter(self):
        """Create non overridden filter in role

        @id: 5ee281cf-28fa-439d-888d-b1f9aacc6d57

        @steps:

        1. Create a filter in a role to which taxonomies
        (location and organization) cannot be associated.
        e.g Architecture filter
        2. Create an user with taxonomies different than role and assign role
        to it
        3. Login as new user and attempt to acess the resources

        @assert:

        1. Filter is created without taxonomies
        2. Override checkbox is not available to check
        3. User can access resources, permissions specified in a filter
        4. User have access in all taxonomies available to user
        """
        name = gen_string('alpha')
        username = gen_string('alpha')
        password = gen_string('alpha')
        with Session(self.browser) as session:
            make_role(
                session,
                name=name,
                locations=[self.role_loc],
                organizations=[self.role_org],
            )
            self.assertIsNotNone(self.role.search(name))
            self.role.add_permission(
                name,
                resource_type='Architecture',
                permission_list=['view_architectures', 'edit_architectures'],
                override_check=False,
            )
            self.assertTrue(self.role.wait_until_element(
                common_locators['alert.success']))
            make_user(
                session,
                username=username,
                password1=password,
                password2=password,
                roles=[name],
                locations=[self.role_loc],
                organizations=[self.role_org],
                edit=True
            )
        with Session(self.browser, username, password) as session:
            set_context(session, org=self.role_org)
            set_context(session, loc=self.role_loc)
            self.assertIsNone(session.nav.wait_until_element(
                menu_locators['menu.content'], timeout=3))
            self.assertIsNone(session.nav.wait_until_element(
                menu_locators['menu.infrastructure'], timeout=3))
            # check that we can access edit functionality at all
            self.architecture.update(old_name='x86_64', new_name='x86_64')
예제 #37
0
    def test_positive_create_filter_without_override(self):
        """Create filter in role w/o overriding it

        :id: a7f76f6e-6c13-4b34-b38c-19501b65786f

        :steps:

            1. Create a role with taxonomies (location and organization)
                assigned
            2. Create filter in role without overriding it
            3. Create user and assign new role to it
            4. Re-login into application using new user with a role

        :expectedresults:

            1. Filter w/o override is created in role
            2. The taxonomies of role are inherited to filter
            3. Override check is not marked by default in filters table
            4. User can access application sections specified in a filter
        """
        name = gen_string('alpha')
        username = gen_string('alpha')
        password = gen_string('alpha')
        domain_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_role(
                session,
                name=name,
                locations=[self.role_loc],
                organizations=[self.role_org],
            )
            self.assertIsNotNone(self.role.search(name))
            self.role.add_permission(
                name,
                resource_type='Domain',
                permission_list=['view_domains', 'create_domains'],
                override_check=True,
            )
            self.assertTrue(self.role.wait_until_element(
                common_locators['alert.success']))
            make_user(
                session,
                username=username,
                password1=password,
                password2=password,
                roles=[name],
                locations=[self.role_loc],
                organizations=[self.role_org],
                edit=True
            )
        with Session(self.browser, username, password) as session:
            set_context(session, org=self.role_org)
            set_context(session, loc=self.role_loc)
            make_domain(session, name=domain_name)
            self.assertIsNotNone(self.domain.search(domain_name))
            self.assertIsNone(session.nav.wait_until_element(
                menu_locators['menu.content'], timeout=3))
            self.assertIsNone(session.nav.wait_until_element(
                menu_locators['menu.configure'], timeout=3))
예제 #38
0
    def test_positive_create_non_overridable_filter(self):
        """Create non overridden filter in role

        :id: 5ee281cf-28fa-439d-888d-b1f9aacc6d57

        :steps:

            1. Create a filter in a role to which taxonomies (location and
                organization) cannot be associated.  e.g Architecture filter
            2. Create an user with taxonomies different than role and assign
                role to it
            3. Login as new user and attempt to acess the resources

        :expectedresults:

            1. Filter is created without taxonomies
            2. Override checkbox is not available to check
            3. User can access resources, permissions specified in a filter
            4. User have access in all taxonomies available to user
        """
        name = gen_string('alpha')
        username = gen_string('alpha')
        password = gen_string('alpha')
        with Session(self.browser) as session:
            make_role(
                session,
                name=name,
                locations=[self.role_loc],
                organizations=[self.role_org],
            )
            self.assertIsNotNone(self.role.search(name))
            self.role.add_permission(
                name,
                resource_type='Architecture',
                permission_list=['view_architectures', 'edit_architectures'],
                override_check=False,
            )
            self.assertTrue(
                self.role.wait_until_element(common_locators['alert.success']))
            make_user(session,
                      username=username,
                      password1=password,
                      password2=password,
                      roles=[name],
                      locations=[self.role_loc],
                      organizations=[self.role_org],
                      edit=True)
        with Session(self.browser, username, password) as session:
            set_context(session, org=self.role_org)
            set_context(session, loc=self.role_loc)
            self.assertIsNone(
                session.nav.wait_until_element(menu_locators['menu.content'],
                                               timeout=3))
            self.assertIsNone(
                session.nav.wait_until_element(
                    menu_locators['menu.infrastructure'], timeout=3))
            # check that we can access edit functionality at all
            self.architecture.update(old_name='x86_64', new_name='x86_64')
예제 #39
0
    def test_negative_create_with_blank_auth(self):
        """Create User with blank value for 'Authorized by' field

        @id: 68f670ed-ac6e-4052-889c-6671d659e510

        @Assert: User is not created. Appropriate error shown.
        """
        with Session(self.browser) as session:
            make_user(session, username=gen_string('alpha'), authorized_by='')
            self.assertIsNotNone(
                self.user.wait_until_element(common_locators['haserror']))
예제 #40
0
    def test_delete_user(self, user_name):
        """@Test: Delete a User

        @Feature: User - Delete

        @Assert: User is deleted

        """
        with Session(self.browser) as session:
            make_user(session, username=user_name)
            self.user.delete(user_name, search_key)
예제 #41
0
    def test_positive_create_admin(self):
        """Create an Admin user

        @id: 9bf56045-1026-435c-bf4c-623e160582d5

        @Assert: Admin User is created successfully
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
예제 #42
0
    def test_positive_create_admin(self):
        """Create an Admin user

        @id: 9bf56045-1026-435c-bf4c-623e160582d5

        @Assert: Admin User is created successfully
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
예제 #43
0
    def test_negative_create_with_blank_auth(self):
        """Create User with blank value for 'Authorized by' field

        @Feature: User - Negative Create

        @Assert: User is not created. Appropriate error shown.
        """
        with Session(self.browser) as session:
            make_user(session, username=gen_string('alpha'), authorized_by='')
            self.assertIsNotNone(
                self.user.wait_until_element(common_locators['haserror']))
예제 #44
0
    def test_positive_create_admin(self):
        """Create an Admin user

        @Feature: User - Positive Create

        @Assert: Admin User is created successfully
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
예제 #45
0
    def test_positive_create_admin(self):
        """Create an Admin user

        @Feature: User - Positive Create

        @Assert: Admin User is created successfully
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
예제 #46
0
    def test_negative_delete_user(self):
        """[UI ONLY] Attempt to delete an User and cancel

        @Feature: User - Negative Delete

        @Assert: User is not deleted
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name)
            self.assertIsNotNone(self.user.search(user_name))
            self.user.delete(user_name, really=False)
예제 #47
0
    def test_negative_delete_user(self):
        """[UI ONLY] Attempt to delete an User and cancel

        @Feature: User - Negative Delete

        @Assert: User is not deleted
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name)
            self.assertIsNotNone(self.user.search(user_name))
            self.user.delete(user_name, really=False)
예제 #48
0
    def test_positive_delete_admin(self):
        """Delete an admin user

        @Feature: User - Positive Delete

        @Assert: User is deleted
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
            self.user.delete(user_name)
예제 #49
0
    def test_positive_delete_user(self):
        """Delete an existing User

        @Feature: User - Delete

        @Assert: User is deleted successfully
        """
        with Session(self.browser) as session:
            for user_name in valid_strings():
                with self.subTest(user_name):
                    make_user(session, username=user_name)
                    self.user.delete(user_name)
예제 #50
0
    def test_positive_update_to_admin(self):
        """Convert a user to an admin user

        @Feature: User - Positive Update

        @Assert: User is updated and has proper admin role value
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=False)
            self.assertIsNotNone(self.user.search(user_name))
            self.assertTrue(self.user.user_admin_role_toggle(user_name, True))
예제 #51
0
    def test_positive_create_with_username(self):
        """Create User for all variations of Username

        @Feature: User - Positive Create

        @Assert: User is created successfully
        """
        with Session(self.browser) as session:
            for user_name in valid_strings():
                with self.subTest(user_name):
                    make_user(session, username=user_name)
                    self.assertIsNotNone(self.user.search(user_name))
예제 #52
0
    def test_positive_delete_user(self):
        """Delete an existing User

        @Feature: User - Delete

        @Assert: User is deleted successfully
        """
        with Session(self.browser) as session:
            for user_name in valid_strings():
                with self.subTest(user_name):
                    make_user(session, username=user_name)
                    self.user.delete(user_name)
예제 #53
0
    def test_positive_delete_admin(self):
        """Delete an admin user

        @Feature: User - Positive Delete

        @Assert: User is deleted
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
            self.user.delete(user_name)
예제 #54
0
    def test_negative_delete_user(self):
        """[UI ONLY] Attempt to delete an User and cancel

        @id: 43aed0c0-a3c3-4044-addc-910dc29e4f37

        @Assert: User is not deleted
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name)
            self.assertIsNotNone(self.user.search(user_name))
            self.user.delete(user_name, really=False)
예제 #55
0
    def test_positive_delete_admin(self):
        """Delete an admin user

        @id: afda171a-b464-461f-93ce-96d770935200

        @Assert: User is deleted
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
            self.user.delete(user_name)
예제 #56
0
    def test_positive_delete_user(self):
        """Delete an existing User

        @id: 49534eda-f8ea-404e-9714-a8d0d2210979

        @Assert: User is deleted successfully
        """
        with Session(self.browser) as session:
            for user_name in valid_strings():
                with self.subTest(user_name):
                    make_user(session, username=user_name)
                    self.user.delete(user_name)
예제 #57
0
    def test_positive_create_with_username(self):
        """Create User for all variations of Username

        @id: 2acc8c7d-cb14-4eda-98f9-fb379950f2f5

        @Assert: User is created successfully
        """
        with Session(self.browser) as session:
            for user_name in valid_strings():
                with self.subTest(user_name):
                    make_user(session, username=user_name)
                    self.assertIsNotNone(self.user.search(user_name))
예제 #58
0
    def test_positive_update_to_admin(self):
        """Convert a user to an admin user

        @id: d3cdda62-1384-4b49-97a3-0c66764583bb

        @Assert: User is updated and has proper admin role value
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=False)
            self.assertIsNotNone(self.user.search(user_name))
            self.assertTrue(self.user.user_admin_role_toggle(user_name, True))
예제 #59
0
    def test_positive_create_with_first_name(self):
        """Create User for all variations of First Name

        @id: dd398cd6-821e-4b0e-a111-22d5a6eeafd8

        @Assert: User is created successfully
        """
        with Session(self.browser) as session:
            for first_name in valid_strings():
                with self.subTest(first_name):
                    name = gen_string('alpha')
                    make_user(session, username=name, first_name=first_name)
                    self.user.validate_user(name, 'firstname', first_name)
예제 #60
0
    def test_positive_update_to_non_admin(self):
        """Convert an user from an admin user to non-admin user

        @id: b41cbcf8-d819-4daa-b217-a4812541dca3

        @Assert: User is updated and has proper admin role value
        """
        user_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_user(session, username=user_name, admin=True)
            self.assertIsNotNone(self.user.search(user_name))
            self.assertFalse(self.user.user_admin_role_toggle(
                user_name, False))