def test_create_profile(self):
        # Setup Expected Response
        name = "name3373707"
        external_id = "externalId-1153075697"
        source = "source-896505829"
        uri = "uri116076"
        group_id = "groupId506361563"
        resume_hrxml = "resumeHrxml1834730555"
        processed = True
        keyword_snippet = "keywordSnippet1325317319"
        expected_response = {
            "name": name,
            "external_id": external_id,
            "source": source,
            "uri": uri,
            "group_id": group_id,
            "resume_hrxml": resume_hrxml,
            "processed": processed,
            "keyword_snippet": keyword_snippet,
        }
        expected_response = profile_pb2.Profile(**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.ProfileServiceClient()

        # Setup Request
        parent = client.tenant_path("[PROJECT]", "[TENANT]")
        profile = {}

        response = client.create_profile(parent, profile)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = profile_service_pb2.CreateProfileRequest(
            parent=parent, profile=profile)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_create_profile(self):
        # Setup Expected Response
        name = 'name3373707'
        external_id = 'externalId-1153075697'
        source = 'source-896505829'
        uri = 'uri116076'
        group_id = 'groupId506361563'
        resume_hrxml = 'resumeHrxml1834730555'
        processed = True
        keyword_snippet = 'keywordSnippet1325317319'
        expected_response = {
            'name': name,
            'external_id': external_id,
            'source': source,
            'uri': uri,
            'group_id': group_id,
            'resume_hrxml': resume_hrxml,
            'processed': processed,
            'keyword_snippet': keyword_snippet
        }
        expected_response = profile_pb2.Profile(**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.ProfileServiceClient()

        # Setup Request
        parent = client.company_path('[PROJECT]', '[COMPANY]')
        profile = {}

        response = client.create_profile(parent, profile)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = profile_service_pb2.CreateProfileRequest(
            parent=parent, profile=profile)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
Ejemplo n.º 3
0
    def test_get_profile(self):
        # Setup Expected Response
        name_2 = "name2-1052831874"
        external_id = "externalId-1153075697"
        source = "source-896505829"
        uri = "uri116076"
        group_id = "groupId506361563"
        processed = True
        keyword_snippet = "keywordSnippet1325317319"
        expected_response = {
            "name": name_2,
            "external_id": external_id,
            "source": source,
            "uri": uri,
            "group_id": group_id,
            "processed": processed,
            "keyword_snippet": keyword_snippet,
        }
        expected_response = profile_pb2.Profile(**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.ProfileServiceClient()

        # Setup Request
        name = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]")

        response = client.get_profile(name)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = profile_service_pb2.GetProfileRequest(name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_get_profile(self):
        # Setup Expected Response
        name_2 = 'name2-1052831874'
        external_id = 'externalId-1153075697'
        source = 'source-896505829'
        uri = 'uri116076'
        group_id = 'groupId506361563'
        processed = True
        keyword_snippet = 'keywordSnippet1325317319'
        expected_response = {
            'name': name_2,
            'external_id': external_id,
            'source': source,
            'uri': uri,
            'group_id': group_id,
            'processed': processed,
            'keyword_snippet': keyword_snippet
        }
        expected_response = profile_pb2.Profile(**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.ProfileServiceClient()

        # Setup Request
        name = client.profile_path('[PROJECT]', '[TENANT]', '[PROFILE]')

        response = client.get_profile(name)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = profile_service_pb2.GetProfileRequest(name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request