Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions jupyterlab_git/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def post(self, path: str = ""):
)

if response["code"] != 0:
self.set_status(500)
self.set_status(401)
self.finish(json.dumps(response))


Expand Down Expand Up @@ -198,7 +198,7 @@ async def post(self, path: str = ""):
)

if result["code"] != 0:
self.set_status(500)
self.set_status(401)
self.finish(json.dumps(result))


Expand Down Expand Up @@ -601,7 +601,7 @@ async def post(self, path: str = ""):
)

if response["code"] != 0:
self.set_status(500)
self.set_status(401)

self.finish(json.dumps(response))

Expand Down Expand Up @@ -683,6 +683,8 @@ async def post(self, path: str = ""):
set_upstream=True,
force=force,
)
if response["code"] != 0:
self.set_status(401)
else:
response = {
"code": 128,
Expand All @@ -691,9 +693,8 @@ async def post(self, path: str = ""):
),
"remotes": remotes, # Returns the list of known remotes
}

if response["code"] != 0:
self.set_status(500)
if response["code"] != 0:
self.set_status(404)

self.finish(json.dumps(response))

Expand Down
4 changes: 2 additions & 2 deletions jupyterlab_git/tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ async def test_push_handler_noupstream(mock_git, jp_fetch, jp_root_dir):
mock_git.remote_show.assert_called_with(str(local_path))
mock_git.push.assert_not_called()

assert response.code == 500
assert response.code == 404
payload = json.loads(response.body)
assert payload == {
"code": 128,
Expand Down Expand Up @@ -449,7 +449,7 @@ async def test_push_handler_multipleupstream(mock_git, jp_fetch, jp_root_dir):
mock_git.remote_show.assert_called_with(str(local_path))
mock_git.push.assert_not_called()

assert response.code == 500
assert response.code == 404
payload = json.loads(response.body)
assert payload == {
"code": 128,
Expand Down