Beispiel #1
0
 def test_404(self):
     self.fake_session.return_value = MagicMock(post=MagicMock(
         return_value=MagicMock(
             status_code=404,
             json=MagicMock(return_value=WRONG_CREDENTIALS),
         )))
     api = Api("test")
     api.create("http://localhost/", "cool")
Beispiel #2
0
 def test_existing_release(self):
     self.fake_session.return_value = MagicMock(post=MagicMock(
         return_value=MagicMock(
             status_code=422,
             json=MagicMock(return_value=SAMPLE_422_ERROR),
         )))
     api = Api("test")
     api.create("http://localhost/", "cool")
Beispiel #3
0
 def __init__(self, owner, repo):
     self.__template = UriTemplate(REPO_URL)
     self.__template.owner = owner
     self.__template.repo = repo
     try:
         get_token()
         self.__client = Api.get_api()
     except exceptions.NoGeaseConfigFound:
         self.__client = Api.get_public_api()
Beispiel #4
0
 def __init__(self, url=REPO_URL):
     self.__url = url
     self.__client = Api.get_api()
Beispiel #5
0
 def __init__(self, owner, repo):
     self.__template = UriTemplate(RELEASE_URL)
     self.__template.owner = owner
     self.__template.repo = repo
     self.__client = Api.get_api()
Beispiel #6
0
 def test_get_forbidden_url(self):
     self.fake_session.return_value = MagicMock(get=MagicMock(
         side_effect=Forbidden))
     api = Api("test")
     api.get("s")
Beispiel #7
0
 def test_get_unknown_url(self):
     self.fake_session.return_value = MagicMock(get=MagicMock(
         side_effect=UrlNotFound))
     api = Api("test")
     api.get("s")
Beispiel #8
0
 def test_unknown_error(self):
     self.fake_session.return_value = MagicMock(post=MagicMock(
         return_value=MagicMock(status_code=400,
                                json=MagicMock(return_value={}))))
     api = Api("test")
     api.create("http://localhost/", "cool")
Beispiel #9
0
 def __init__(self):
     self.__url = REPO_URL
     self.__client = Api.get_api()