Exemple #1
0
    def test_EWA_3113_pass_non_hr_token(self):
        '''

            Sending admin token instead of hr token. Admin token should not have permission to add users.

        :return:
        '''
        employee_payload = employee_api_helper.generate_employee_data()
        files = {
            "image":
            ("duck.png",
             (open(os.path.join(fwork.IN_DATA_PATH, "images/duck.png"), "rb")))
        }
        response = webservice.post(url=base_url +
                                   apis.employee_basic_data_endpoint,
                                   data=employee_payload,
                                   files=files,
                                   token=admin_token,
                                   headers={})

        response_data = response.json()
        assert response.status_code == 200
        assert response_data['responseCode'] == employee_basic_data.get(
            'non_admin_token_response').get('responseCode')
        assert response_data['message'] == employee_basic_data.get(
            'non_admin_token_response').get('message')
Exemple #2
0
    def test_EWA__pass_invalid_authorization_token(self):
        logger.debug('Employee Data: test invalid authorization token')
        employee_payload = employee_api_helper.generate_employee_data()
        files = {
            "image":
            ("duck.png",
             (open(os.path.join(fwork.IN_DATA_PATH, "images/duck.png"), "rb")))
        }
        response = webservice.post(url=base_url +
                                   apis.employee_basic_data_endpoint,
                                   data=employee_payload,
                                   files=files,
                                   token=admin_token[::-1],
                                   headers={})

        assert response.status_code == 401
Exemple #3
0
    def test_EWA_710_check_for_missing_email(self):

        employee_payload = employee_api_helper.generate_employee_data()
        employee_payload['emailId'] = None
        files = {
            "image":
            ("duck.png",
             (open(os.path.join(fwork.IN_DATA_PATH, "images/duck.png"), "rb")))
        }
        response = webservice.post(url=base_url +
                                   apis.employee_basic_data_endpoint,
                                   data=employee_payload,
                                   files=files,
                                   token=hr_token,
                                   headers={})

        response_data = response.json()
        assert response.status_code == 200
        assert response_data['message'] == employee_basic_data.get(
            'missing_fields').get('message')
Exemple #4
0
    def test_EWA_151_add_duplicate_user(self, delete_user):

        employee_payload = employee_api_helper.generate_employee_data()
        employee_payload['emailId'] = delete_user[0]
        files = {
            "image":
            ("duck.png",
             (open(os.path.join(fwork.IN_DATA_PATH, "images/duck.png"), "rb")))
        }
        response = webservice.post(url=base_url +
                                   apis.employee_basic_data_endpoint,
                                   data=employee_payload,
                                   files=files,
                                   token=hr_token,
                                   headers={})

        response_data = response.json()
        assert response.status_code == 200
        assert response_data['responseCode'] == employee_basic_data.get(
            'add_duplicate_user').get('responseCode')
        assert response_data['message'] == employee_basic_data.get(
            'add_duplicate_user').get('message')
Exemple #5
0
    def test_EWA_150_to_validate_add_user_api(self, delete_user):
        logger.debug('Employee Data: add user validation')
        employee_payload = employee_api_helper.generate_employee_data()

        files = {
            "image":
            ("duck.png",
             (open(os.path.join(fwork.IN_DATA_PATH, "images/duck.png"), "rb")))
        }
        response = webservice.post(url=base_url +
                                   apis.employee_basic_data_endpoint,
                                   data=employee_payload,
                                   files=files,
                                   token=hr_token,
                                   headers={})

        response_data = response.json()
        assert response.status_code == 200
        assert response_data['responseCode'] == employee_basic_data.get(
            'add_employee_response').get('responseCode')
        assert response_data['message'] == employee_basic_data.get(
            'add_employee_response').get('message')
        delete_user.append(employee_payload['emailId'])
Exemple #6
0
    def test_EWA_3114_check_groups_incorrect_value(self, delete_user):
        employee_payload = employee_api_helper.generate_employee_data()
        employee_payload['emailId'] = delete_user[0]
        employee_payload['selectedGroups'] = str([random.randint(
            1000, 2000)])  # array has to passed as a string
        files = {
            "image":
            ("duck.png",
             (open(os.path.join(fwork.IN_DATA_PATH, "images/duck.png"), "rb")))
        }
        response = webservice.post(url=base_url +
                                   apis.employee_basic_data_endpoint,
                                   data=employee_payload,
                                   files=files,
                                   token=hr_token,
                                   headers={})

        response_data = response.json()
        assert response.status_code == 200
        assert response_data['responseCode'] == employee_basic_data.get(
            'incorrect_group_value').get('responseCode')
        assert response_data['message'] == employee_basic_data.get(
            'incorrect_group_value').get('message')