Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #27 from jenca-cloud/branch-coverage
Browse files Browse the repository at this point in the history
Test branch coverage and fix missing coverage
  • Loading branch information
px3l committed Jan 12, 2016
2 parents 7a9319a + 2948f49 commit fda0dc5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -33,7 +33,7 @@ script:
# Check spelling in the documentation.
- sphinx-build -W -b spelling -d build/doctrees docs/source build/spelling
# Run all discoverable tests, but set the source directories so that the coverage tool knows not to include coverage for all dependencies.
- "coverage run --source=authentication,storage -m unittest discover"
- "coverage run --branch --source=authentication,storage -m unittest discover"
after_success:
# Sends the coverage report to coveralls.io which can report to Pull Requests
# and track test coverage over time.
Expand Down
8 changes: 7 additions & 1 deletion authentication/tests/test_authentication.py
Expand Up @@ -493,7 +493,13 @@ def test_fake_token(self):
"""
If a token does not belong to a user, ``None`` is returned.
"""
self.assertIsNone(load_user_from_token(auth_token='fake_token'))
self.app.post(
'/signup',
content_type='application/json',
data=json.dumps(USER_DATA))

with app.app_context():
self.assertIsNone(load_user_from_token(auth_token='fake'))


class DeleteUserTests(AuthenticationTests):
Expand Down
19 changes: 10 additions & 9 deletions storage/storage.py
Expand Up @@ -180,15 +180,16 @@ def users_route():

if request.method == 'POST':
return create_user()
elif request.method == 'GET':
details = [
{'email': user.email, 'password_hash': user.password_hash} for user
in User.query.all()]

return make_response(
json.dumps(details),
codes.OK,
{'Content-Type': 'application/json'})

# It the method type is not POST it is GET.
details = [
{'email': user.email, 'password_hash': user.password_hash} for user
in User.query.all()]

return make_response(
json.dumps(details),
codes.OK,
{'Content-Type': 'application/json'})

if __name__ == '__main__': # pragma: no cover
# Specifying 0.0.0.0 as the host tells the operating system to listen on
Expand Down

0 comments on commit fda0dc5

Please sign in to comment.