def get_tenders(self, tab, mode=production_mode, is_real_tenders_for_test_mode=False, page_number=1): """method returns dict, also store result to obj attribute - no to use get_tenders""" request = post( url=self.base_url + 'api/services/etender/tender/GetTenders', headers=self.headers, data=GetTendersModel(tab, mode, is_real_tenders_for_test_mode, page_number=page_number).get_request_body()) assert True is body_to_dict(request.content)['success'] return body_to_dict(request.content)
def delete_user_from_division(self, user, division): request = post(url=self.base_url + 'api/services/etender/division/RemoveUserFromDivision', headers=self.headers, data=json.dumps({ "userid": user.get('userid'), "divisionid": division.get('id') })) print('Deleting result: ', json.loads(request.content)) return body_to_dict(request.content)
def get_tenders_with_responsibles(self, inner_tab, page_number=1): obj = GetTendersWithResponsiblesModel(page_number=page_number) if inner_tab == 'in_work': obj.set_tenders_in_work_params() elif inner_tab == 'archive': obj.set_tenders_archive_params() elif inner_tab == 'new_tenders': pass request = post( url=self.base_url + 'api/services/etender/tender/GetTendersWithResponsibles', headers=self.headers, data=obj.get_request_body()) assert self.check_success_status(body_to_dict(request.content)) return body_to_dict(request.content)
def set_responsible_user_tender_list(self, chain_list, delete_existing_managers=False): request = post( url=self.base_url + 'api/services/etender/userTender/SetResponsibleUserTenderList', headers=self.headers, data=json.dumps({ 'list': chain_list, "deleteExistingManagers": delete_existing_managers })) return body_to_dict(request.content)
def update_user_role(self, user_id, division, isHead): request = post(url=self.base_url + 'api/services/etender/division/UpdateUserIsHead', headers=self.headers, data=json.dumps({ "userid": user_id.get('userid'), "divisionid": division.get('id'), 'isHead': isHead })) print('Updating role result: ', json.loads(request.content).get('result')) return body_to_dict(request.content)
def set_responsible_user_tender(self, tender_new_id, user_id, delete_existing_managers=False): request = post( url=self.base_url + 'api/services/etender/userTender/SetResponsibleUserTender', headers=self.headers, data=json.dumps({ "tenderNewId": tender_new_id, "userId": user_id, "deleteExistingManagers": delete_existing_managers })) return body_to_dict(request.content)