Beispiel #1
0
    def test_create_application(self):
        # Setup Expected Response
        name = "name3373707"
        external_id = "externalId-1153075697"
        profile = "profile-309425751"
        job = "job105405"
        company = "company950484093"
        outcome_notes = "outcomeNotes-355961964"
        job_title_snippet = "jobTitleSnippet-1100512972"
        expected_response = {
            "name": name,
            "external_id": external_id,
            "profile": profile,
            "job": job,
            "company": company,
            "outcome_notes": outcome_notes,
            "job_title_snippet": job_title_snippet,
        }
        expected_response = application_pb2.Application(**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.ApplicationServiceClient()

        # Setup Request
        parent = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]")
        application = {}

        response = client.create_application(parent, application)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = application_service_pb2.CreateApplicationRequest(
            parent=parent, application=application)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_create_application(self):
        # Setup Expected Response
        name = 'name3373707'
        external_id = 'externalId-1153075697'
        profile = 'profile-309425751'
        job = 'job105405'
        company = 'company950484093'
        outcome_notes = 'outcomeNotes-355961964'
        job_title_snippet = 'jobTitleSnippet-1100512972'
        expected_response = {
            'name': name,
            'external_id': external_id,
            'profile': profile,
            'job': job,
            'company': company,
            'outcome_notes': outcome_notes,
            'job_title_snippet': job_title_snippet
        }
        expected_response = application_pb2.Application(**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.ApplicationServiceClient()

        # Setup Request
        parent = client.profile_path('[PROJECT]', '[TENANT]', '[PROFILE]')
        application = {}

        response = client.create_application(parent, application)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = application_service_pb2.CreateApplicationRequest(
            parent=parent, application=application)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request