Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaphoenix committed Jul 8, 2024
1 parent 7cb32c3 commit 1d56889
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions tests/dfcx_scrapi/core/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,6 @@ def mock_list_agents_pager(mock_list_agents_response):
mock_list_agents_response,
)

# Test _list_agents_client_request
@patch("dfcx_scrapi.core.agents.services.agents.AgentsClient")
def test__list_agents_client_request(
mock_client, mock_list_agents_pager, test_config):
mock_client.return_value.list_agents.return_value = mock_list_agents_pager
agent = Agents()
agents = agent._list_agents_client_request(
location_id=f"projects/{test_config['project_id']}/locations/global"
)

assert isinstance(agents, list)
assert len(agents) == 1
assert isinstance(agents[0], types.Agent)
assert agents[0].name == test_config["agent_id"]
assert agents[0].display_name == test_config["display_name"]

# Test list_agents with location_id
@patch("dfcx_scrapi.core.agents.Agents._list_agents_client_request")
def test_list_agents_with_location(mock_list_agents_client_request,
Expand Down Expand Up @@ -145,19 +129,19 @@ def test_get_agent(mock_client, mock_agent_obj_flow, test_config):
@patch("dfcx_scrapi.core.agents.services.agents.AgentsClient")
def test_get_agent_by_display_name_no_location(
mock_client, mock_agent_obj_flow, mock_list_agents_pager, test_config):
mock_client.return_value.get_agent_by_display_name.return_value = mock_agent_obj_flow
mock_client.return_value.get_agent_by_display_name.return_value = mock_agent_obj_flow # pylint: disable=C0301
mock_client.return_value.list_agents.return_value = mock_list_agents_pager
agent = Agents()
response = agent.get_agent_by_display_name(
test_config["project_id"], test_config["display_name"]
)

assert response == None
assert response is None

@patch("dfcx_scrapi.core.agents.services.agents.AgentsClient")
def test_get_agent_by_display_name_with_region(
mock_client, mock_agent_obj_flow, mock_list_agents_pager, test_config):
mock_client.return_value.get_agent_by_display_name.return_value = mock_agent_obj_flow
mock_client.return_value.get_agent_by_display_name.return_value = mock_agent_obj_flow # pylint: disable=C0301
mock_client.return_value.list_agents.return_value = mock_list_agents_pager
agent = Agents()
response = agent.get_agent_by_display_name(
Expand All @@ -172,7 +156,8 @@ def test_get_agent_by_display_name_with_region(

# Test create_agent
@patch("dfcx_scrapi.core.agents.services.agents.AgentsClient")
def test_create_agent_with_kwargs(mock_client, mock_agent_obj_flow, test_config):
def test_create_agent_with_kwargs(
mock_client, mock_agent_obj_flow, test_config):
mock_client.return_value.create_agent.return_value = mock_agent_obj_flow
agent = Agents()
response = agent.create_agent(
Expand Down

0 comments on commit 1d56889

Please sign in to comment.