forked from maiiku/python-intercom
-
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.
Making python-intercom Python 3 compatible.
- Loading branch information
Showing
29 changed files
with
507 additions
and
359 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# | ||
# Development dependencies. | ||
# | ||
https://github.com/jeffh/describe/tarball/dev#egg=describe-dev | ||
httpretty==0.8.8 | ||
mock==1.0.1 |
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
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
certifi | ||
inflection==0.3.0 | ||
requests==2.6.0 | ||
urllib3==1.10.2 | ||
urllib3==1.10.2 | ||
six==1.9.0 |
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 |
---|---|---|
|
@@ -24,17 +24,17 @@ def local_response(**params): | |
def _call(*args, **kwargs): | ||
response = Mock() | ||
reply = {} | ||
for name, value in kwargs.items(): | ||
for name, value in list(kwargs.items()): | ||
reply[name] = value | ||
for name, value in params.items(): | ||
for name, value in list(params.items()): | ||
reply[name] = value | ||
response.content = json.dumps(reply) | ||
response.status_code = 200 | ||
return response | ||
return _call | ||
|
||
|
||
def test_user(email="[email protected]"): | ||
def a_test_user(email="[email protected]"): | ||
return { | ||
"type": "user", | ||
"id": "aaaaaaaaaaaaaaaaaaaaaaaa", | ||
|
@@ -136,7 +136,10 @@ def page_of_users(include_next_link=False): | |
"per_page": 50, | ||
"total_pages": 7 | ||
}, | ||
"users": [test_user("[email protected]"), test_user("[email protected]"), test_user("[email protected]")], | ||
"users": [ | ||
a_test_user("[email protected]"), | ||
a_test_user("[email protected]"), | ||
a_test_user("[email protected]")], | ||
"total_count": 314 | ||
} | ||
if include_next_link: | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
26 changes: 16 additions & 10 deletions
26
tests/unit/lib/flat_store_spec.py → tests/unit/lib/test_flat_store.py
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 |
---|---|---|
@@ -1,31 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from describe import expect | ||
import unittest | ||
from intercom.lib.flat_store import FlatStore | ||
from nose.tools import assert_raises | ||
from nose.tools import eq_ | ||
from nose.tools import istest | ||
|
||
|
||
class DescribeIntercomFlatStore: | ||
class IntercomFlatStore(unittest.TestCase): | ||
|
||
@istest | ||
def it_raises_if_you_try_to_set_or_merge_in_nested_hash_structures(self): | ||
data = FlatStore() | ||
with expect.raise_error(ValueError): | ||
with assert_raises(ValueError): | ||
data["thing"] = [1] | ||
with expect.raise_error(ValueError): | ||
with assert_raises(ValueError): | ||
data["thing"] = {1: 2} | ||
with expect.raise_error(ValueError): | ||
with assert_raises(ValueError): | ||
FlatStore(**{"1": {2: 3}}) | ||
|
||
@istest | ||
def it_raises_if_you_try_to_use_a_non_string_key(self): | ||
data = FlatStore() | ||
with expect.raise_error(ValueError): | ||
with assert_raises(ValueError): | ||
data[1] = "something" | ||
|
||
@istest | ||
def it_sets_and_merges_valid_entries(self): | ||
data = FlatStore() | ||
data["a"] = 1 | ||
data["b"] = 2 | ||
expect(data["a"]) == 1 | ||
expect(data["b"]) == 2 | ||
eq_(data["a"], 1) | ||
eq_(data["b"], 2) | ||
data = FlatStore(a=1, b=2) | ||
expect(data["a"]) == 1 | ||
expect(data["b"]) == 2 | ||
eq_(data["a"], 1) | ||
eq_(data["b"], 2) |
Oops, something went wrong.