class RoleHelper: def __init__(self): self.appUrl = appUrl self.rest = RestHelper() def create_role(self): url = f"{appUrl}inrights/api/roles/card/new" headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"id": "INRIGHTS.model.roles.NewRole-1"} response = self.rest.call_request(request_type="POST", url=url, json=json, headers=headers, params=params) def get_role_data_by_oid(self, oid): pass def delete_role(self): pass
def __init__(self): self.rest = RestHelper() self.appUrl = appUrl
class OrgHelper: def __init__(self): self.rest = RestHelper() self.appUrl = appUrl def create_company_type(self, initial_company, parent_company_oid=parentCompanyOid): url = f"{appUrl}/idm/api/companies/card/new" headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"sort": ""} json = initial_company.return_company_data_as_json() # parent_company_value = self._generate_company_parent_value(parent_company_oid=parentCompanyOid) json.update({'parentCompanyRef': parent_company_oid}) response = self.rest.call_request(request_type="POST", url=url, json=json, headers=headers, params=params) json_response = response.json() # self.fill_company_data_from_response(initial_company, json_response) # setattr(initial_company, 'oid', initial_company.oid) print(initial_company) # return initial_company def get_company_by_oid(self, company_oid): url = f'{appUrl}/idm/api/companies/card/{company_oid}' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"sort": ""} json = None company_got_by_oid = Company() response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_response = response.json() self.fill_company_data_from_response(company_object=company_got_by_oid, json_response=json_response) # print(company_got_by_oid) return company_got_by_oid def fill_company_data_from_response(self, company_object, json_response): items = json_response['attributes'] param_list = company_object.__dict__.keys() for param in list(param_list): for item in items: if item['name'] == param: setattr(company_object, param, item['value']) company_oid = json_response['oid'] setattr(company_object, 'oid', company_oid) return company_object def _generate_company_parent_value(self, parent_company_oid): parent_company = self.get_company_by_oid( company_oid=parent_company_oid) parent_company_value = {} parent_company_value.update({ 'id': parent_company.oid, 'name': parent_company.shortName, 'userId': None }) print(parent_company_value) def compare_company_data(self, created_company, company_get_by_oid): if created_company.__eq__(company_get_by_oid) == True: assert True print( f'[INFO] Created company with oid: {created_company.oid} and fullname: {created_company.fullName}' ) else: print( f'[ERROR] EXPECTED: {created_company}, BUT GOT: {company_get_by_oid}' ) assert False def create_division(self, initial_division, parent_id): url = f'{appUrl}/idm/api/division/card/new' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"sort": ""} json = None initial_division_object = initial_division.return_division_data_as_json( ) # division_json = initial_division_object.return_division_data_as_json() parent_orgs_object = self.generate_parent_org_object( parentId=parent_id) initial_division_object.update({'parentOrgs': parent_orgs_object}) # print(division_json) json = initial_division_object response = self.rest.call_request(request_type="POST", url=url, json=json, headers=headers, params=params) json_response = response.json() # initial_division_object = self.fill_division_data_from_response(division_object=initial_division_object, json_response=json_response) created_division = Division() self.fill_division_data_from_response(created_division, json_response) setattr(initial_division, 'oid', created_division.oid) assert initial_division.__eq__(created_division) #print(initial_division) print(created_division) return created_division def fill_division_data_from_response(self, division_object, json_response): items = json_response['attributes'] param_list = division_object.__dict__.keys() for param in list(param_list): for item in items: if item['name'] == param: setattr(division_object, param, item['value']) division_oid = json_response['oid'] setattr(division_object, 'oid', division_oid) return division_object def get_division_by_oid(self, division_oid): url = f'{appUrl}/idm/api/division/card/{division_oid}' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"sort": ""} json = None division_got_by_oid = Division() response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_response = response.json() self.fill_division_data_from_response( division_object=division_got_by_oid, json_response=json_response) # print(division_got_by_oid) return division_got_by_oid def compare_division_data(self, created_division, division_get_by_oid): if created_division.__eq__(division_get_by_oid) == True: assert True print( f'[INFO] Created division with oid: {created_division.oid} and fullname: {created_division.fullName}' ) else: print( f'[ERROR] EXPECTED: {created_division}, BUT GOT: {division_get_by_oid}' ) assert False def generate_parent_org_object(self, parentId): parent_orgs_object = {} url = f'{appUrl}/idm/api/division/card/{parentId}' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"sort": ""} json = None response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_reponse = response.json() if response.status_code == 200: division_object = Division() parent_division_object_filled = self.fill_division_data_from_response( division_object=division_object, json_response=json_reponse) parent_orgs = parent_division_object_filled.parentOrgs parent_orgs_object.update({ 'id': parentId, 'ids': parent_orgs['ids'] + [parent_division_object_filled.oid], 'name': parent_orgs['name'] + [parent_division_object_filled.shortName], 'paths': parent_orgs['name'] + [parent_division_object_filled.shortName], 'type': 'org' }) # print(parent_orgs_object) return parent_orgs_object elif response.status_code == 500: parent_company_filled = self.get_company_by_oid( company_oid=parentId) # print(parent_company_filled) parent_orgs = parent_company_filled.parentCompanyRef parent_orgs_object.update({ 'id': parentId, 'ids': [parent_orgs['id']] + [parent_company_filled.oid], 'name': [parent_orgs['name']] + [parent_company_filled.shortName], 'paths': [parent_orgs['name']] + [parent_company_filled.shortName], 'type': 'org' }) # print(parent_orgs_object) return parent_orgs_object else: print(f'Что то пошло не так, код ответа: {response.status_code}') def make_position_path(self, parentId): clientId = 'root/' parent_division = self.get_division_by_oid(division_oid=parentId) parent_orgs_division = parent_division.parentOrgs parent_ids = parent_orgs_division['ids'] for id in parent_ids: clientId += f'{id}/' clientId += f'{parentId}/' return clientId def create_position(self, parent_division_oid): url = f'{appUrl}/idm/api/catalog/entry/' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {'search': '', 'countType': 'all', "sort": ""} initial_position_object = Position() position_json = initial_position_object.return_position_data_as_json() clientId = self.make_position_path(parentId=parent_division_oid) position_json.update({ 'clientId': clientId, 'parentId': parent_division_oid }) print(position_json) response = self.rest.call_request(request_type="POST", url=url, json=position_json, headers=headers, params=params) json_response = response.json() print(json_response) created_position = Position() self.fill_position_data_from_response(created_position, json_response) setattr(initial_position_object, 'id', created_position.id) assert initial_position_object.__eq__(created_position) return created_position def delete_position(self, position_id): url = f'{appUrl}/idm/api/catalog/entry/{position_id}' headers = { 'WWW-Operation-Context': 'orgStruct', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'ru' } params = {} json = {'id': position_id, 'parentId': None, 'type': 'position'} response = self.rest.call_request(request_type="DELETE", url=url, json=json, headers=headers, params=params) if response.status_code == 500: json_response = response.json() print(json_response) assert False else: print(response.status_code) assert True def get_children_by_parent_node_oid(self, parent_oid=None, child_oid=None): url = f'{appUrl}/idm/api/catalog/entry/{parent_oid}' headers = { 'WWW-Operation-Context': 'orgStruct', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'ru' } params = { 'search': None, 'countType': 'all', 'sort': None, 'node': f'root/{parent_oid}' } json = None response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_response = response.json() print(json_response) children_object = None for children in json_response['children']: if children['id'] == child_oid: children_object = children break if children_object == None: print( f'[ERROR] Cant get children with oid {child_oid} in node with oid {parent_oid}' ) children_got_by_oid = Position() self.fill_position_data_from_response( position_object=children_got_by_oid, json_response=children_object) print(children_got_by_oid) return children_got_by_oid def fill_position_data_from_response(self, position_object, json_response): param_list = position_object.__dict__.keys() for param in list(param_list): for json_key in json_response.keys(): if json_key == param: setattr(position_object, param, json_response[json_key]) position_oid = json_response['id'] setattr(position_object, 'oid', position_oid) return position_object def compare_position_data(self, created_position=None, position_get_by_oid=None): if created_position.__eq__(position_get_by_oid) == True: assert True print( f'[INFO] Created position with oid: {created_position.id} and fullname: {created_position.name}' ) else: print( f'[ERROR] Expected: {created_position}, but got: {position_get_by_oid}' ) assert False def _get_all_children_for_node(self, node_oid=parentCompanyOid): url = f'{appUrl}/idm/api/catalog/entry/{node_oid}' headers = { 'WWW-Operation-Context': 'orgStruct', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'ru' } params = { 'search': None, 'countType': 'all', 'sort': None, 'node': f'root/{node_oid}' } json = None response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) children_list = response.json() #print(children_list['children']) return children_list['children'] def _find_positions_in_org_node(self, node_oid, position_list=[]): node_objects = self._get_all_children_for_node(node_oid=node_oid) for node_object in node_objects: if node_object['type'] == 'position': position_list.append(node_object['id']) # print(position_list) else: self._find_positions_in_org_node(node_oid=node_object['id']) return position_list def _find_random_position_in_org_structure(self): # Проблема: если в орге нет ни одной должности random падает в ошибку # Решено обработкой исключения, если должностей нет возвращает False position_list = [] node_objects = self._get_all_children_for_node( node_oid=parentCompanyOid) for node_object in node_objects: if node_object['type'] == 'position': position_list.append(node_object['id']) else: self._find_position_in_org_node(node_oid=node_object['id'], position_list=position_list) try: return random.choice(position_list) except IndexError: return False def _create_position_object_for_user(self, parent_division_oid, position_oid): position = {} path = 'root/' paths = [] name = [] ids = [] parent_division = self.get_division_by_oid( division_oid=parent_division_oid) parent_orgs_division = parent_division.parentOrgs parent_ids = parent_orgs_division[0]['ids'] parent_names = parent_orgs_division[0]['name'] for id in parent_ids: path += f'{id}/' ids.append(id) path += f'{parent_division_oid}/{position_oid}' ids.append(parent_division_oid) ids.append(position_oid) for item in parent_names: name.append(item) paths.append(item) name.append(parent_division.shortName) paths.append(parent_division.shortName) parent_divison_children = self._get_all_children_for_node( node_oid=parent_division_oid) for child in parent_divison_children: if child['id'] == position_oid: name.append(child['name']) paths.append(child['name']) position.update({ 'id': position_oid, 'ids': ids, 'name': name, 'path': path, 'paths': paths, 'type': 'position' }) # print(position) return position def _find_parent_for_position(self, position_oid, parent_oid=parentCompanyOid): # Проблема: отрабатывает 3 минуты на 186 стенде node_objects = self._get_all_children_for_node(node_oid=parent_oid) for node_object in node_objects: parent_oid = None parent_oid = node_object['id'] #print(parent_oid) children_list = self._get_all_children_for_node( node_oid=parent_oid) for child in children_list: # print(child) if child['id'] == position_oid: print(parent_oid) return parent_oid break else: self._find_parent_for_position(position_oid=position_oid, parent_oid=parent_oid)
class RequestHelper(): def __init__(self): self.rest = RestHelper() self.appUrl = appUrl def create_request(self, employment_oid): url = f'{appUrl}/idm/api/request/submit' headers = { 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/json', 'WWW-Operation-Context': 'request.newRequest' } params = None access_oid = self._get_valid_access_for_request( employmentOid=employment_oid) json = { "comment": "Request created by API", "separate": False, "employments": [employment_oid], "accesses": [{ "id": access_oid, "type": "STANDARD", "contexts": [], "accessType": None }] } # Ответ {"violations":null,"requestNumbers":["01.004.261"]} response = self.rest.call_request(request_type='POST', url=url, json=json, headers=headers, params=params) json_response = response.json() print(json_response) if 'message' in json_response: print(f'[ERROR] Something goes wrong') assert False else: if json_response['requestNumbers'] is not None: print('[INFO] Created request Id: ' + str(json_response['requestNumbers'][0])) assert True else: assert False def _get_random_access_id_for_employment(self, employmentOid): url = f'{appUrl}/idm/api/newrequest/accesses' headers = {'Content-Type': 'application/json;charset=UTF-8'} params = None json = { 'start': 0, 'limit': 200, 'sort': [{ 'property': 'name', 'direction': 'ASC' }], 'filter': [{ 'value': [''], 'property': 'search' }, { 'property': 'employmentOids', 'value': [employmentOid] }, { 'property': 'applicationOids', 'value': [] }, { 'property': 'ownerCompanyOids', 'value': [] }, { 'property': 'ownerEmpOids', 'value': [] }] } response = self.rest.call_request(request_type='POST', url=url, json=json, headers=headers, params=params) json_response = response.json() # print(json_response) access_item = json_response['items'][random.randint( 0, len(json_response['items']) - 1)] # print(access_item['id']) # print(access_item) return access_item['id'] def _validate_access(self, accessesOid, employmentOid): url = f'{appUrl}/idm/api/request/validate' headers = {'Content-Type': 'application/json;charset=UTF-8'} params = None json = { 'employments': [employmentOid], 'accesses': [{ 'id': accessesOid, 'accessType': None, 'contexts': [], 'type': 'STANDART' }] } response = self.rest.call_request(request_type='POST', url=url, params=params, headers=headers, json=json) json_response = response.json() # print(json_response) if len(json_response['items']) == 0: print('Validate access - OK') return True else: print('Validate access - FAILED') return False def _get_valid_access_for_request(self, employmentOid): valid_access = None attempt_number = 0 while attempt_number < 100: attempt_number += 1 accessOid = self._get_random_access_id_for_employment( employmentOid=employmentOid) if self._validate_access(accessesOid=accessOid, employmentOid=employmentOid) == True: valid_access = accessOid break # print(valid_access) return valid_access def assign_user_in_request(self, userOid, requestOid): url = f'{appUrl}/idm/api/requests/assign-user' headers = {'Content-Type': 'application/json;charset=UTF-8'} params = None json = { "requestId": requestOid, "requestItemId": 0, "userId": userOid, "comment": "", "requestType": "CREATE_ROLE_ASSIGNMENTS" } response = self.rest.call_request(request_type='POST', url=url, params=params, headers=headers, json=json) json_response = response.json() print(json_response) def get_application_list(self): url = f'{appUrl}/idm/api/applications/applications' headers = {'Content-Type': 'application/json;charset=UTF-8'} params = None json = { "start": 0, "limit": 50, "sort": [{ "property": "name", "direction": "ASC" }], "filter": [{ "value": [""], "property": "search" }] } response = self.rest.call_request(request_type='POST', url=url, params=params, headers=headers, json=json) application_list = response.json() #print(application_list['items']) return application_list['items'] def _get_application_publications(self, application_oid): url = f'{appUrl}/idm/api/applications/card/{application_oid}/publications' headers = {'Content-Type': 'application/json;charset=UTF-8'} params = {'sort': None} json = None response = self.rest.call_request(request_type='GET', url=url, params=params, headers=headers, json=json) publication_list = response.json() return publication_list def _publicate_application(self, application_oid, org_structure_oid): url = f'{appUrl}/idm/api/applications/card/{application_oid}/publications/create' headers = {'Content-Type': 'application/json;charset=UTF-8'} params = None json = {"oids": [org_structure_oid]} response = self.rest.call_request(request_type='POST', url=url, params=params, headers=headers, json=json) json_response = response.json( ) # ответ [{"id":"04986cf1-7253-46a1-84c6-52b834c60ff6","path":["API Comp","Австралия","секретариата"],"error":false}] def publicate_applications_for_company(self): application_list = self.get_application_list() for application in application_list: publication_list = self._get_application_publications( application_oid=application['id']) print(publication_list) #todo def check_and_publicate_applications_for_position(self, position_oid): application_list = self.get_application_list() for application in application_list: id_list = [] publication_list = self._get_application_publications( application_oid=application['id']) for publication_item in publication_list: id_list.append(publication_item['id']) if position_oid not in id_list: self._publicate_application(application_oid=application['id'], org_structure_oid=position_oid)
class UserHelper: def __init__(self): self.rest = RestHelper() self.appUrl = appUrl def create_user(self, user): url = f'{appUrl}/idm/api/user/card/new' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"id": "users.NewUser-1"} json = user.return_user_data_as_json() response = self.rest.call_request(request_type="PUT", url=url, json=json, headers=headers, params=params) json_response = response.json() created_user = User() self.fill_user_data_from_response(created_user, json_response) # print(created_user) # print(user) assert user.__eq__(created_user) setattr(user, 'oid', created_user.oid) #print(created_user) return created_user def fill_user_data_from_response(self, user_object, json_response): # print(f'This json from def_fill_user_data_with_response {json_response}') items = json_response['items'] param_list = user_object.__dict__.keys() for param in list(param_list): for item in items: if item['name'] == param: setattr(user_object, param, item['value']) user_oid = json_response['oid'] setattr(user_object, 'oid', user_oid) return user_object def get_user_data_by_oid(self, oid): url = f'{appUrl}/idm/api/user/card/{oid}' # url = f'http://10.201.48.186:8080/idm/api/user/card/{oid}' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = None json = None response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_response = response.json() user_get_by_oid = User() self.fill_user_data_from_response(user_get_by_oid, json_response) # print(f'Get by oid {user_get_by_oid}') return user_get_by_oid def compare_user_data(self, created_user, user_get_by_oid): if created_user.__eq__(user_get_by_oid) == True: assert True print( f'Created user with oid: {created_user.oid} and fullname: {created_user.lastName} ' f'{created_user.firstName} {created_user.additionalName}') else: print(f'EXPECTED: {created_user}, BUT GOT: {user_get_by_oid}') assert False def get_employment_by_user_oid(self, oid): url = f'{appUrl}/idm/api/user/{oid}/employments' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = {"sort": None} json = None employment_object = Employment() response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_response = response.json() self.fill_employment_from_response(employment_object=employment_object, json_response=json_response) return employment_object def fill_employment_from_response(self, employment_object, json_response): param_list = employment_object.__dict__.keys() attributes_list = json_response['items'][0]['card']['attributes'] # print(attributes_list) for param in list(param_list): for attribute in attributes_list: if attribute['name'] == param: setattr(employment_object, param, attribute['value']) setattr(employment_object, 'id', json_response['items'][0]['card']['oid']) return employment_object def get_accounts_by_user_oid(self, user_oid): url = f'{appUrl}/idm/api/user/{user_oid}/accounts' headers = {"Accept-Encoding": "gzip, deflate", "Accept-Language": "ru"} params = None json = None response = self.rest.call_request(request_type="GET", url=url, json=json, headers=headers, params=params) json_response = response.json() account = Account() param_list = account.__dict__.keys() print(param_list) items_list = json_response['items'] for item in items_list: print(item) if item.get('resourceName') == 'AD - gk.rosatom.local': for param in list(param_list): setattr(account, param, item.get(param)) return account def check_account_entitlements(self, account): if "Test_S" in account.entitlements: print("Успех") else: assert False def change_user_hr_status(self, user_oid, target_hr_status): url = f"{appUrl}/idm/api/user/{user_oid}/employment" headers = { "Accept-Encoding": "gzip, deflate", "Accept-Language": "ru", "WWW-Operation-Context": "users.card:employments", "Accept": "application/json;charset=UTF-8" } params = None employment = self.get_employment_by_user_oid(user_oid) if target_hr_status == 'active': today = date.today() dateInThePast = (today - timedelta(days=-1)).isoformat() futureDate = (today + timedelta(days=365)).isoformat() employment_data_json = employment.return_employment_data_as_json() employment_data_json.update({ "vacationType": None, "vacstart": None, "vacend": None, "worstart": dateInThePast, "workend": futureDate }) response = self.rest.call_request(request_type="POST", url=url, json=employment_data_json, headers=headers, params=params) print(response) elif target_hr_status == 'vacation': today_date = date.today() today = today_date.isoformat() tomorrow = (today_date + timedelta(days=2)).isoformat() employment_data_json = employment.return_employment_data_as_json() position_object = employment.position position_object.update({ 'path': position_object['name'], 'type': 'position' }) employment_data_json.update({ "position": position_object, 'vacstart': today, 'vacend': tomorrow, 'vacationType': 'vacation' }) response = self.rest.call_request(request_type="POST", url=url, json=employment_data_json, headers=headers, params=params) print(response) elif target_hr_status == 'maternityleave': today_date = date.today() today = today_date.isoformat() tomorrow = (today_date + timedelta(days=2)).isoformat() employment_data_json = employment.return_employment_data_as_json() position_object = employment.position position_object.update({ 'path': position_object['name'], 'type': 'position' }) employment_data_json.update({ "position": position_object, 'vacstart': today, 'vacend': tomorrow, 'vacationType': 'leave' }) response = self.rest.call_request(request_type="POST", url=url, json=employment_data_json, headers=headers, params=params) print(response) elif target_hr_status == 'fired': today_date = date.today() today = today_date.isoformat() employment_data_json = employment.return_employment_data_as_json() position_object = employment.position position_object.update({ 'path': position_object['name'], 'type': 'position' }) employment_data_json.update({ "position": position_object, 'workend': today }) response = self.rest.call_request(request_type="POST", url=url, json=employment_data_json, headers=headers, params=params) print(response) else: print('hr_status is incorrect') assert False self.check_user_hr_status(user_oid=user_oid, status=target_hr_status) def send_user_on_vacation(self, user_oid): url = f"{appUrl}/idm/api/user/{user_oid}/employment" headers = { "Accept-Encoding": "gzip, deflate", "Accept-Language": "ru", "WWW-Operation-Context": "users.card:employments", "Accept": "application/json;charset=UTF-8" } params = None today_date = date.today() today = today_date.isoformat() tomorrow = (today_date + timedelta(days=2)).isoformat() employment = self.get_employment_by_user_oid(user_oid) employment_data_json = employment.return_employment_data_as_json() position_object = employment.position position_object.update({ 'path': position_object['name'], 'type': 'position' }) employment_data_json.update({ "position": position_object, 'vacstart': today, 'vacend': tomorrow, 'vacationType': 'vacation' }) #print(employment_data_json) response = self.rest.call_request(request_type="POST", url=url, json=employment_data_json, headers=headers, params=params) print(response) self.check_user_hr_status(user_oid=user_oid, status='vacation') def make_user_hrstatus_active(self, user_oid): url = f"{appUrl}/idm/api/user/{user_oid}/employment" headers = { "Accept-Encoding": "gzip, deflate", "Accept-Language": "ru", "WWW-Operation-Context": "users.card:employments" } params = None today = date.today() dateInThePast = (today - timedelta(days=-1)).isoformat() futureDate = (today + timedelta(days=365)).isoformat() employment = self.get_employment_by_user_oid(user_oid) employment_data_json = employment.return_employment_data_as_json() employment_data_json.update({ "vacationType": None, "vacstart": None, "vacend": None, "worstart": dateInThePast, "workend": futureDate }) response = self.rest.call_request(request_type="POST", url=url, json=employment_data_json, headers=headers, params=params) print(response) self.check_user_hr_status(user_oid=user_oid, status='active') def fire_user(self, user_oid): url = f"{appUrl}/idm/api/user/{user_oid}/employment" headers = { "Accept-Encoding": "gzip, deflate", "Accept-Language": "ru", "WWW-Operation-Context": "users.card:employments" } params = None today_date = date.today() today = today_date.isoformat() def check_user_hr_status(self, user_oid, status): employment = self.get_employment_by_user_oid(user_oid) employment_data_json = employment.return_employment_data_as_json() if employment_data_json['hrStatus'] == status: assert True else: print( f'User current hrStatus is: {employment_data_json["hrStatus"]}' ) assert False