Skip to content

Commit

Permalink
Mock requests in test setup to speed up agent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
plars committed Oct 31, 2023
1 parent 7f853a1 commit dd9938e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion agent/testflinger_agent/tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class TestClient:
@pytest.fixture
def agent(self):
def agent(self, requests_mock):
self.tmpdir = tempfile.mkdtemp()
self.config = {
"agent_id": "test01",
Expand All @@ -31,6 +31,8 @@ def agent(self):
}
testflinger_agent.configure_logging(self.config)
client = _TestflingerClient(self.config)
requests_mock.get(rmock.ANY)
requests_mock.post(rmock.ANY)
yield _TestflingerAgent(client)
# Inside tests, we patch rmtree so that we can check files after the
# run, so we need to clean up the tmpdirs here
Expand Down

0 comments on commit dd9938e

Please sign in to comment.