Example #1
0
 def test_listdir(self, _request):
     res = mock.MagicMock(spec=Struct)
     res.__enter__.return_value = StringIO(SIMPLE_METADATA)
     _request.side_effect = [res, requests.exceptions.HTTPError]
     expected = ["1.0-SNAPSHOT",
                 "1.0",
                 "3.0-SNAPSHOT",
                 "2.0.0",
                 "1.1",
                 ]
     repo = HttpRepository("http://foo.com/repo")
     actual = repo.listdir("foo/bar")
     assert expected == actual
     self.assertRaises(MissingPathError, repo.listdir, "/baz")
Example #2
0
 def test_listdir(self, _request):
     res = mock.MagicMock(spec=Struct)
     res.__enter__.return_value = StringIO(SIMPLE_METADATA)
     _request.side_effect = [res, requests.exceptions.HTTPError]
     expected = ["1.0-SNAPSHOT",
                 "1.0",
                 "3.0-SNAPSHOT",
                 "2.0.0",
                 "1.1",
                 ]
     repo = HttpRepository("http://foo.com/repo")
     actual = repo.listdir("foo/bar")
     assert expected == actual
     self.assertRaises(MissingPathError, repo.listdir, "/baz")