Skip to content

Commit

Permalink
Merge pull request #9 from moremoban/dev
Browse files Browse the repository at this point in the history
release 0.0.7
  • Loading branch information
chfw authored Aug 27, 2020
2 parents 9d3de28 + dbce75f commit 51ba25e
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change log
================================================================================

0.0.7 - 28.08.2020
--------------------------------------------------------------------------------

**Updated**

#. raise UrlNotFound when request a non-existent url

0.0.6 - 26.08.2020
--------------------------------------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: gease
organisation: moremoban
releases:
- changes:
- action: Updated
details:
- "raise UrlNotFound when request a non-existent url"
date: 28.08.2020
version: 0.0.7
- changes:
- action: Updated
details:
Expand Down
6 changes: 3 additions & 3 deletions gease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ organisation: "moremoban"
author: "C. W."
contact: "wangc_2011@hotmail.com"
company: "Onni Software Ltd."
version: "0.0.6"
current_version: 0.0.6
release: "0.0.6"
version: "0.0.7"
current_version: 0.0.7
release: "0.0.7"
copyright_year: 2017-2020
command_line_interface: gease
entry_point: "gease.main:main"
Expand Down
2 changes: 1 addition & 1 deletion gease/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.0.6'
__version__ = '0.0.7'
__author__ = 'C. W.'
__description__ = 'simply makes a git release using github api v3'
4 changes: 4 additions & 0 deletions gease/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ class AbnormalGithubResponse(Exception):

class UnhandledException(Exception):
pass


class UrlNotFound(Exception):
pass
6 changes: 4 additions & 2 deletions gease/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def create(self, url, data):

def get(self, url):
r = self.__session.get(url)
return r.json()
if r.status_code == 200:
return r.json()
elif r.status_code == 404:
raise exceptions.UrlNotFound(f"{url} does not exist")

@classmethod
def get_api(cls):
Expand All @@ -63,7 +66,6 @@ def get_api(cls):
cls.__instance = cls(token)
return cls.__instance


@classmethod
def get_public_api(cls):
cls.__instance = cls(None)
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

NAME = "gease"
AUTHOR = "C. W."
VERSION = "0.0.6"
VERSION = "0.0.7"
EMAIL = "wangc_2011@hotmail.com"
LICENSE = "MIT"
ENTRY_POINTS = {
Expand All @@ -45,7 +45,7 @@
"simply makes a git release using github api v3"
)
URL = "https://github.com/moremoban/gease"
DOWNLOAD_URL = "%s/archive/0.0.6.tar.gz" % URL
DOWNLOAD_URL = "%s/archive/0.0.7.tar.gz" % URL
FILES = ["README.rst", "CHANGELOG.rst"]
KEYWORDS = [
"python",
Expand Down Expand Up @@ -78,8 +78,8 @@
}
# You do not need to read beyond this line
PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable)
GS_COMMAND = ("gs gease v0.0.6 " +
"Find 0.0.6 in changelog for more details")
GS_COMMAND = ("gs gease v0.0.7 " +
"Find 0.0.7 in changelog for more details")
NO_GS_MESSAGE = ("Automatic github release is disabled. " +
"Please install gease to enable it.")
UPLOAD_FAILED_MSG = (
Expand Down
9 changes: 9 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from gease.rest import Api
from gease.exceptions import (
UrlNotFound,
RepoNotFoundError,
ReleaseExistException,
AbnormalGithubResponse,
Expand Down Expand Up @@ -90,3 +91,11 @@ def test_unknown_error(self):
)
api = Api("test")
api.create("http://localhost/", "cool")

@raises(UrlNotFound)
def test_get_unknown_url(self):
self.fake_session.return_value = MagicMock(
get=MagicMock(side_effect=UrlNotFound)
)
api = Api("test")
api.get("s")
6 changes: 3 additions & 3 deletions tests/test_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestPublish:
@patch("gease.contributors.Api.get_public_api")
def test_all_contributors(self, fake_api):
sample_reply = [
{"login": "howdy", "url": "https://api.github.com/users/howdy",}
{"login": "howdy", "url": "https://api.github.com/users/howdy"}
]
fake_api.return_value = MagicMock(
get=MagicMock(side_effect=[sample_reply, {"name": "hello world"}])
Expand All @@ -30,7 +30,7 @@ def test_all_contributors(self, fake_api):
@patch("gease.contributors.Api.get_public_api")
def test_no_names(self, fake_api):
sample_reply = [
{"login": "howdy", "url": "https://api.github.com/users/howdy",}
{"login": "howdy", "url": "https://api.github.com/users/howdy"}
]
fake_api.return_value = MagicMock(
get=MagicMock(side_effect=[sample_reply, {"name": None}])
Expand All @@ -41,5 +41,5 @@ def test_no_names(self, fake_api):

eq_(
contributors,
[{"name": "howdy", "url": "https://api.github.com/users/howdy",}],
[{"name": "howdy", "url": "https://api.github.com/users/howdy"}],
)

0 comments on commit 51ba25e

Please sign in to comment.