-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from jacebrowning/add-logging
Add logging for error conditions
- Loading branch information
Showing
5 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# pylint: disable=unused-variable,expression-not-assigned,singleton-comparison | ||
|
||
from mock import patch, Mock | ||
from expecter import expect | ||
|
||
from coveragespace import cli | ||
|
||
|
||
def describe_call(): | ||
|
||
@patch('coveragespace.cache.Cache.get', Mock()) | ||
def it_handles_invalid_response(): | ||
expect(cli.call('slug', 'metric', 42)) == False | ||
|
||
@patch('coveragespace.cache.Cache.get', Mock(return_value=None)) | ||
@patch('coveragespace.cache.Cache.set', Mock(return_value=None)) | ||
@patch('time.sleep', Mock()) | ||
@patch('requests.put') | ||
def it_retries_500s(requests_put): | ||
requests_put.return_value = Mock(status_code=500) | ||
|
||
cli.call('slug', 'metric', 42) | ||
|
||
expect(requests_put.call_count) == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters