def test_get_job(self): # Setup Expected Response name_2 = "name2-1052831874" company = "company950484093" requisition_id = "requisitionId980224926" title = "title110371416" description = "description-1724546052" department = "department848184146" incentives = "incentives-1262874520" language_code = "languageCode-412800396" promotion_value = 353413845 qualifications = "qualifications1903501412" responsibilities = "responsibilities-926952660" company_display_name = "companyDisplayName1982424170" expected_response = { "name": name_2, "company": company, "requisition_id": requisition_id, "title": title, "description": description, "department": department, "incentives": incentives, "language_code": language_code, "promotion_value": promotion_value, "qualifications": qualifications, "responsibilities": responsibilities, "company_display_name": company_display_name, } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = talent_v4beta1.JobServiceClient() # Setup Request name = client.job_path("[PROJECT]", "[TENANT]", "[JOBS]") response = client.get_job(name) assert expected_response == response assert len(channel.requests) == 1 expected_request = job_service_pb2.GetJobRequest(name=name) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_get_job(self): # Setup Expected Response name_2 = 'name2-1052831874' company = 'company950484093' requisition_id = 'requisitionId980224926' title = 'title110371416' description = 'description-1724546052' department = 'department848184146' incentives = 'incentives-1262874520' language_code = 'languageCode-412800396' promotion_value = 353413845 qualifications = 'qualifications1903501412' responsibilities = 'responsibilities-926952660' company_display_name = 'companyDisplayName1982424170' expected_response = { 'name': name_2, 'company': company, 'requisition_id': requisition_id, 'title': title, 'description': description, 'department': department, 'incentives': incentives, 'language_code': language_code, 'promotion_value': promotion_value, 'qualifications': qualifications, 'responsibilities': responsibilities, 'company_display_name': company_display_name } expected_response = job_pb2.Job(**expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) patch = mock.patch('google.api_core.grpc_helpers.create_channel') with patch as create_channel: create_channel.return_value = channel client = talent_v4beta1.JobServiceClient() # Setup Request name = client.job_path('[PROJECT]', '[TENANT]', '[JOBS]') response = client.get_job(name) assert expected_response == response assert len(channel.requests) == 1 expected_request = job_service_pb2.GetJobRequest(name=name) actual_request = channel.requests[0][1] assert expected_request == actual_request