aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2015-07-17 19:16:20 -0700
committerMike Crute <mcrute@gmail.com>2015-07-17 19:18:42 -0700
commit9e1315960d7bb0b93ca3561bdd4f2b10abc6432c (patch)
tree376f29082bd8559589adeecb8f602c4f0ab8b7f5 /tests
parentb05b149fbc879cd3faca2f624cc8c90725bd431f (diff)
downloadpydora-9e1315960d7bb0b93ca3561bdd4f2b10abc6432c.tar.bz2
pydora-9e1315960d7bb0b93ca3561bdd4f2b10abc6432c.tar.xz
pydora-9e1315960d7bb0b93ca3561bdd4f2b10abc6432c.zip
Login as partner when there is a token error
Fixes #14
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pandora/test_client.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_pandora/test_client.py b/tests/test_pandora/test_client.py
new file mode 100644
index 0000000..cfeebb7
--- /dev/null
+++ b/tests/test_pandora/test_client.py
@@ -0,0 +1,21 @@
1from unittest import TestCase
2
3from pandora.client import BaseAPIClient
4from pandora.transport import APITransport
5from pandora.errors import InvalidAuthToken
6from pandora.py2compat import Mock, MagicMock, call
7
8
9class TestCallingAPIClient(TestCase):
10
11 def test_call_should_retry_on_token_error(self):
12 transport = Mock(side_effect=[InvalidAuthToken(), None])
13
14 client = BaseAPIClient(transport, None, None, None)
15 client._authenticate = Mock()
16
17 client.login("foo", "bar")
18 client("method")
19
20 client._authenticate.assert_called_with()
21 transport.assert_has_calls([call("method"), call("method")])