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")
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")
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()
def __init__(self, url=REPO_URL): self.__url = url self.__client = Api.get_api()
def __init__(self, owner, repo): self.__template = UriTemplate(RELEASE_URL) self.__template.owner = owner self.__template.repo = repo self.__client = Api.get_api()
def test_get_forbidden_url(self): self.fake_session.return_value = MagicMock(get=MagicMock( side_effect=Forbidden)) api = Api("test") api.get("s")
def test_get_unknown_url(self): self.fake_session.return_value = MagicMock(get=MagicMock( side_effect=UrlNotFound)) api = Api("test") api.get("s")
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")
def __init__(self): self.__url = REPO_URL self.__client = Api.get_api()