Skip to content

Commit

Permalink
Implemented GET /bugs/:id/coverage on both client- and server-side (#…
Browse files Browse the repository at this point in the history
…204)

* implemented client.bug.coverage

* implemented GET /bugs/:id/coverage on server-side

* increased version to 2.1.1

* avoid mypy errors due to direct use of r.json

* suppress type warning

* still attempting to suppress warnings
  • Loading branch information
ChrisTimperley authored Apr 27, 2018
1 parent 2e38d1c commit 229393a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 2.1.1 (2018-04-27)

### Features

* Added `--debug`, `-p|--port`, and `--host` to `bugzood` executable.
* Implemented `GET /bugs/:id/coverage` endpoint on client and server.

### Bug Fixes

* Fixed bug in server module that was caused by incorrectly handling parameters
in the construction of error responses.


## 2.1.0 (2018-04-26)

### Features
Expand Down
4 changes: 3 additions & 1 deletion bugzoo/client/bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def register(self, bug: Bug) -> None:

def coverage(self, bug: Bug) -> TestSuiteCoverage:
r = self.__api.post('bugs/{}/coverage'.format(bug.name))
raise NotImplementedError
if r.status_code == 200:
return TestSuiteCoverage.from_dict(r.json) # type: ignore
self.__api.handle_erroneous_response(r)

def uninstall(self, bug: Bug) -> bool:
r = self.__api.post('bugs/{}/uninstall'.format(bug.name))
Expand Down
15 changes: 15 additions & 0 deletions bugzoo/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ def build_bug(uid: str):
return ('', 204)


@app.route('/bugs/<uid>/coverage', methods=['GET'])
@throws_errors
def bug_coverage(uid: str):
try:
bug = daemon.bugs[uid]
except KeyError:
return BugNotFound(uid), 404

if not daemon.bugs.is_installed(bug):
return ImageNotInstalled(bug.image), 400

coverage = daemon.bugs.coverage(bug)
return (coverage.to_dict(), 200)


@app.route('/bugs/<uid>/provision', methods=['POST'])
@throws_errors
def provision_bug(uid: str):
Expand Down
2 changes: 1 addition & 1 deletion bugzoo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.0'
__version__ = '2.1.1'

0 comments on commit 229393a

Please sign in to comment.