Skip to content

Commit

Permalink
Fix client test
Browse files Browse the repository at this point in the history
Need to reset the mock object before asserting that client.open()
wasn't called.
  • Loading branch information
wfscheper committed Jun 7, 2017
1 parent 7c0f3ba commit f99a287
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ def test_get_artifact(self, _LocalRepository):
_repo.exists.assert_called_with("foo/bar/2.0.0/bar-2.0.0.jar")
_repo.open.assert_called_with("foo/bar/2.0.0/bar-2.0.0.jar")

_repo.reset_mock()
self.assertRaises(MissingArtifactError, client.get_artifact,
"foo:bar:3.0")
_repo.exists.assert_called_with("foo/bar/3.0/bar-3.0.jar")
_repo.open.assert_not_called()

_repo.reset_mock()
self.assertRaises(AssertionError, client.get_artifact,
"foo:bar:[1.0,2.0]")
_repo.open.assert_not_called()


@mock.patch("pymaven.client.HttpRepository._request")
Expand Down

0 comments on commit f99a287

Please sign in to comment.