forked from pandas-dev/pandas
-
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 pandas-dev#13 from manahl/hooks_and_backports
Fixed the hooks and backported some changes
- Loading branch information
Showing
7 changed files
with
123 additions
and
38 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
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,26 @@ | ||
from mock import sentinel, call, Mock | ||
from arctic.hooks import register_get_auth_hook, register_log_exception_hook, \ | ||
register_resolve_mongodb_hook, get_mongodb_uri, log_exception | ||
from arctic.auth import get_auth | ||
|
||
|
||
def test_log_exception_hook(): | ||
logger = Mock() | ||
register_log_exception_hook(logger) | ||
log_exception(sentinel.fn, sentinel.e, sentinel.r) | ||
assert logger.call_args_list == [call(sentinel.fn, sentinel.e, sentinel.r)] | ||
|
||
|
||
def test_get_mongodb_uri_hook(): | ||
resolver = Mock() | ||
resolver.return_value = sentinel.result | ||
register_resolve_mongodb_hook(resolver) | ||
assert get_mongodb_uri(sentinel.host) == sentinel.result | ||
assert resolver.call_args_list == [call(sentinel.host)] | ||
|
||
|
||
def test_get_auth_hook(): | ||
auth_resolver = Mock() | ||
register_get_auth_hook(auth_resolver) | ||
get_auth(sentinel.host, sentinel.app_name, sentinel.database_name) | ||
assert auth_resolver.call_args_list == [call(sentinel.host, sentinel.app_name, sentinel.database_name)] |