예제 #1
0
class TestRead(UserManageBase):
    TNB = COMPANYADMIN_USER_READ_TNB
    datafile = COMPANYADMIN_USER_READ_DATA_FILE

    authority = Authority()
    test_data_read_check_authority_info = authority.get_user_authority_info()

    @parameterized.expand(test_data_read_check_authority_info,
                          skip_on_empty=True)
    @pytest.mark.scenario_regression_companyadmin(TNB + 2)
    @pytest.mark.scenario_regression(TNB + 1)
    def test_read_check_authority_info(self, email, company_list, site_dict,
                                       role_dict):
        self.check_authority_info(email=email,
                                  company_list=company_list,
                                  site_dict=site_dict,
                                  role_dict=role_dict,
                                  expectation="pass")

    test_data_read_normal = utilities.gen_testdata(datafile,
                                                   delimiter=',',
                                                   header=0,
                                                   scenario='normal')

    @parameterized.expand(test_data_read_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    def test_read_normal(self, companyname, username, expectation):
        self.user_read(companyname, username, expectation)
예제 #2
0
class TestRead(RoleManageBase):
    TNB = COMPANYADMIN_ROLE_READ_TNB
    datafile = COMPANYADMIN_ROLE_READ_DATA_FILE

    test_data_read_normal = utilities.gen_testdata(datafile,
                                                   delimiter=',',
                                                   header=0,
                                                   scenario='normal')

    @parameterized.expand(test_data_read_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    def test_read_normal(self, companyname, rolename, expectation):
        self.role_read(companyname, rolename, expectation)

    authority = Authority()
    test_data_read_check_authority_info = authority.get_role_authority_info()

    @parameterized.expand(test_data_read_check_authority_info,
                          skip_on_empty=True
                          )  # skip_on_empty=True doesn't work
    @pytest.mark.scenario_regression_companyadmin(TNB + 2)
    @pytest.mark.scenario_regression(TNB + 1)
    def test_read_check_authority_info(self, company, role, email_list):
        self.check_authority_info(company=company,
                                  role=role,
                                  email_list=email_list,
                                  expectation="pass")
예제 #3
0
class TestRead(SysAdminBase):
    TNB = SYSADMIN_COMPANY_READ_TNB
    datafile = SYSADMIN_COMPANY_READ_DATA_FILE

    test_data_read_normal = utilities.gen_testdata(datafile, delimiter=',', header=0, scenario='normal')

    @parameterized.expand(test_data_read_normal)
    @pytest.mark.scenario_regression(TNB + 3)
    def test_read_normal(self, companyname, expectation):
        self.company_read(companyname, expectation)

    test_data_read_notexist = utilities.gen_testdata(datafile, delimiter=',', header=0, scenario='notexist')

    @parameterized.expand(test_data_read_notexist)
    @pytest.mark.scenario_regression(TNB + 2)
    def test_read_notexist(self, companyname, expectation):
        self.company_read(companyname, expectation)

    @pytest.mark.scenario_regression(TNB + 1)
    def test_read_default(self):
        self.company_read(companyname="", expectation="pass")
예제 #4
0
class TestDelete(SysAdminBase):

    TNB = SYSADMIN_COMPANY_DELETE_TNB
    datafile = SYSADMIN_COMPANY_DELETE_DATA_FILE

    test_data_delete_normal = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='normal')

    @parameterized.expand(test_data_delete_normal)
    @pytest.mark.scenario_regression(TNB + 1)
    def test_delete_normal(self, companyname, expectation):
        self.company_delete(companyname, expectation)

    test_data_delete_notexist = utilities.gen_testdata(datafile,
                                                       delimiter=',',
                                                       header=0,
                                                       scenario='notexist')

    @parameterized.expand(test_data_delete_notexist)
    @pytest.mark.scenario_regression(TNB + 2)
    def test_delete_notexist(self, companyname, expectation):
        self.company_delete(companyname, expectation)

    @pytest.mark.scenario_renew_env(1)
    @pytest.mark.scenario_regression_companyadmin(1)
    def test_delete_emptify_testuser(
        self,
        expectation="pass"
    ):  # add [email protected] to each company as admin, and delete all other company admins
        self.company_delete_emptify_user(expectation)

    @pytest.mark.scenario_renew_env(2)
    @pytest.mark.skip
    def test_delete_emptify_company(
            self,
            companyname="",
            expectation="pass"):  #empty all test company data
        self.company_delete_emptify_company(companyname, expectation)
예제 #5
0
class TestUpdate(RoleManageBase):

    TNB = COMPANYADMIN_ROLE_UPDATE_TNB
    datafile = COMPANYADMIN_ROLE_UPDATE_DATA_FILE

    test_data_create_normal = utilities.gen_testdata(datafile, delimiter=',', header=0, scenario='update_rolename_service_user')

    @parameterized.expand(test_data_create_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    @pytest.mark.scenario_regression(TNB + 1)
    @pytest.mark.scenario_debug(1)
    def test_update_update_rolename_service_user(self, companyname, rolename, valuedict, expectation):
        self.role_update(companyname=companyname, rolename=rolename, valuedict=valuedict, expectation=expectation)
예제 #6
0
class TestDelete(UserManageBase):
    TNB = COMPANYADMIN_USER_DELETE_TNB
    datafile = COMPANYADMIN_USER_DELETE_DATA_FILE

    test_data_delete_normal = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='normal')

    @parameterized.expand(test_data_delete_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    def test_delete_normal(self, companyname, username, expectation):
        self.user_delete(companyname, username, expectation)
예제 #7
0
class TestCreate(SiteManageBase):

    TNB = COMPANYADMIN_SITE_CREATE_TNB
    datafile = COMPANYADMIN_SITE_CREATE_DATA_FILE

    test_data_create_normal = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='normal')

    @parameterized.expand(test_data_create_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    def test_create_normal(self, companyname, sitename, address, latitude,
                           longitude, label_list, user_list, expectation):
        self.site_create(companyname, sitename, address, latitude, longitude,
                         label_list, user_list, expectation)
예제 #8
0
class TestCreate(RoleManageBase):

    TNB = COMPANYADMIN_ROLE_CREATE_TNB
    datafile = COMPANYADMIN_ROLE_CREATE_DATA_FILE

    test_data_create_normal = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='normal')

    @parameterized.expand(test_data_create_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    @pytest.mark.scenario_regression(TNB + 1)
    def test_create_normal(self, companyname, rolename, service_list,
                           user_list, expectation):
        self.role_create(companyname=companyname,
                         rolename=rolename,
                         service_list=service_list,
                         user_list=user_list,
                         expectation=expectation)
예제 #9
0
class TestRead(UserManageBase):
    TNB = COMPANYADMIN_USER_CREATE_TNB
    datafile = COMPANYADMIN_USER_CREATE_DATA_FILE

    test_data_create_normal = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='normal')

    @parameterized.expand(test_data_create_normal)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    def test_create_normal(self, companyname, username, display_name, status,
                           site_list, role_list, expectation):
        self.user_create(companyname=companyname,
                         username=username,
                         display_name=display_name,
                         status=status,
                         site_list=site_list,
                         role_list=role_list,
                         expectation=expectation)
예제 #10
0
class TestUpdate(SysAdminBase):

    TNB = SYSADMIN_COMPANY_UPDATE_TNB
    datafile = SYSADMIN_COMPANY_UPDATE_DATA_FILE

    test_data_update_update_companyname = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_companyname')

    @parameterized.expand(test_data_update_update_companyname)
    @pytest.mark.scenario_regression(TNB + 1)
    def test_update_update_companyname(self, companyname, valuedict,
                                       expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_status = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_status')

    @parameterized.expand(test_data_update_update_status)
    @pytest.mark.scenario_regression(TNB + 2)
    def test_update_update_status(self, companyname, valuedict, expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email')

    @parameterized.expand(test_data_update_update_email)
    @pytest.mark.scenario_regression(TNB + 3)
    def test_update_update_email(self, companyname, valuedict, expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_companyname_status_email = utilities.gen_testdata(
        datafile,
        delimiter=',',
        header=0,
        scenario='update_companyname_status_email')

    @parameterized.expand(test_data_update_update_companyname_status_email)
    @pytest.mark.scenario_regression(TNB + 4)
    def test_update_update_companyname_status_email(self, companyname,
                                                    valuedict, expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_companyname_duplicate = utilities.gen_testdata(
        datafile,
        delimiter=',',
        header=0,
        scenario='update_companyname_duplicate')

    @parameterized.expand(test_data_update_update_companyname_duplicate)
    @pytest.mark.scenario_regression(TNB + 5)
    @pytest.mark.skip
    def test_update_update_companyname_duplicate(self, companyname, valuedict,
                                                 expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_companyname_rule = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_companyname_rule')

    @parameterized.expand(test_data_update_update_companyname_rule)
    @pytest.mark.scenario_regression(TNB + 6)
    def test_update_update_companyname_rule(self, companyname, valuedict,
                                            expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_companyname_illegal = utilities.gen_testdata(
        datafile,
        delimiter=',',
        header=0,
        scenario='update_companyname_illegal')

    @parameterized.expand(test_data_update_update_companyname_illegal)
    @pytest.mark.scenario_regression(TNB + 7)
    def test_update_update_companyname_illegal(self, companyname, valuedict,
                                               expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email_duplicate = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email_duplicate')

    @parameterized.expand(test_data_update_update_email_duplicate)
    @pytest.mark.scenario_regression(TNB + 8)
    def test_update_update_email_duplicate(self, companyname, valuedict,
                                           expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email_two_same = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email_two_same')

    @parameterized.expand(test_data_update_update_email_two_same)
    @pytest.mark.scenario_regression(TNB + 9)
    def test_update_update_email_two_same(self, companyname, valuedict,
                                          expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email_blank = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email_blank')

    @parameterized.expand(test_data_update_update_email_blank)
    @pytest.mark.scenario_regression(TNB + 10)
    def test_update_update_email_blank(self, companyname, valuedict,
                                       expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email_illegal = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email_illegal')

    @parameterized.expand(test_data_update_update_email_illegal)
    @pytest.mark.scenario_regression(TNB + 11)
    def test_update_update_email_illegal(self, companyname, valuedict,
                                         expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email_remove = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email_remove')

    @parameterized.expand(test_data_update_update_email_remove)
    @pytest.mark.scenario_regression(TNB + 13)
    def test_update_update_email_remove(self, companyname, valuedict,
                                        expectation):
        self.company_update(companyname, valuedict, expectation)

########################################################################################################################

    test_data_update_update_email_add = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='update_email_add')

    @parameterized.expand(test_data_update_update_email_add)
    @pytest.mark.scenario_regression(TNB + 12)
    def test_update_update_email_add(self, companyname, valuedict,
                                     expectation):
        self.company_update(companyname, valuedict, expectation)
예제 #11
0
class TestCreate(SysAdminBase):

    TNB = SYSADMIN_COMPANY_CREATE_TNB
    datafile = SYSADMIN_COMPANY_CREATE_DATA_FILE

    test_data_create_normal = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='normal')

    @parameterized.expand(test_data_create_normal)
    @pytest.mark.scenario_regression(TNB + 1)
    def test_create_normal(self, companyname, status, email_list, expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_name_rule = utilities.gen_testdata(datafile,
                                                        delimiter=',',
                                                        header=0,
                                                        scenario='name_rule')

    @parameterized.expand(test_data_create_name_rule)
    @pytest.mark.scenario_regression(TNB + 2)
    def test_create_name_rule(self, companyname, status, email_list,
                              expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_name_duplicate = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='name_duplicate')

    @parameterized.expand(test_data_create_name_duplicate)
    @pytest.mark.scenario_regression(TNB + 3)
    @pytest.mark.skip  #system does not check duplicate company name
    def test_create_name_duplicate(self, companyname, status, email_list,
                                   expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_name_illegal = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='name_illegal')

    @parameterized.expand(test_data_create_name_illegal)
    @pytest.mark.scenario_regression(TNB + 4)
    def test_create_name_illegal(self, companyname, status, email_list,
                                 expectation):
        self.company_create(companyname, status, email_list, expectation)
########################################################################################################################

    test_data_create_email_duplicate = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='email_duplicate')

    @parameterized.expand(test_data_create_email_duplicate)
    @pytest.mark.scenario_regression(TNB + 5)
    def test_create_email_duplicate(self, companyname, status, email_list,
                                    expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_email_two_same_email = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='email_two_same_email')

    @parameterized.expand(test_data_create_email_two_same_email)
    @pytest.mark.scenario_regression(TNB + 6)
    def test_create_email_two_same_email(self, companyname, status, email_list,
                                         expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_email_blank = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='email_blank')

    @parameterized.expand(test_data_create_email_blank)
    @pytest.mark.scenario_regression(TNB + 7)
    def test_create_email_blank(self, companyname, status, email_list,
                                expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_email_illegal = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='email_illegal')

    @parameterized.expand(test_data_create_email_illegal)
    @pytest.mark.scenario_regression(TNB + 8)
    def test_create_email_illegal(self, companyname, status, email_list,
                                  expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_create_status = utilities.gen_testdata(datafile,
                                                     delimiter=',',
                                                     header=0,
                                                     scenario='status')

    @parameterized.expand(test_data_create_status)
    @pytest.mark.scenario_regression(TNB + 9)
    @pytest.mark.skip  # do not support to create a disabled company
    def test_create_status(self, companyname, status, email_list, expectation):
        self.company_create(companyname, status, email_list, expectation)

########################################################################################################################

    test_data_for_companyadmin_test = utilities.gen_testdata(
        datafile, delimiter=',', header=0, scenario='for_companyadmin_test')

    @parameterized.expand(test_data_for_companyadmin_test)
    @pytest.mark.scenario_regression(TNB + 10)
    @pytest.mark.scenario_regression_companyadmin(TNB + 1)
    @pytest.mark.skip  # run only once
    def test_create_for_companyadmin_test(self, companyname, status,
                                          email_list, expectation):
        self.company_create(companyname, status, email_list, expectation)
########################################################################################################################

    @pytest.mark.scenario_regression(TNB + 11)
    @pytest.mark.scenario_regression_companyadmin(TNB + 2)
    def test_create_verify_companyadmin_password_email(self):
        self.verify_companyadmin_password_email()