summaryrefslogtreecommitdiff
path: root/macaroonbakery/tests/test_httpbakery.py
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2018-10-15 10:58:26 +0100
committerColin Watson <cjwatson@debian.org>2018-10-15 10:58:56 +0100
commitf00e0b7d3ea974ffaa8bc284ad2b7df6fcb77eb2 (patch)
tree5acfe37d50981ef409c3a0753b8d048eaed53558 /macaroonbakery/tests/test_httpbakery.py
parent83e714c5f5f17a4db661ba942f8da617dccac9bb (diff)
parent619cb9d927e2d6955d0b6a97d4d4c5ea9548150a (diff)
Update upstream source from tag 'upstream/1.2.1'
Update to upstream version '1.2.1' with Debian dir ccd0e7fdc6e29a6c6f8c47c3e463ae6e6a3343c3
Diffstat (limited to 'macaroonbakery/tests/test_httpbakery.py')
-rw-r--r--macaroonbakery/tests/test_httpbakery.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/macaroonbakery/tests/test_httpbakery.py b/macaroonbakery/tests/test_httpbakery.py
index 4aac850..c372f13 100644
--- a/macaroonbakery/tests/test_httpbakery.py
+++ b/macaroonbakery/tests/test_httpbakery.py
@@ -1,6 +1,7 @@
from unittest import TestCase
-from macaroonbakery.httpbakery import WebBrowserInteractionInfo
+import macaroonbakery.httpbakery as httpbakery
+import macaroonbakery.bakery as bakery
class TestWebBrowserInteractionInfo(TestCase):
@@ -9,8 +10,35 @@ class TestWebBrowserInteractionInfo(TestCase):
info_dict = {
'VisitURL': 'https://example.com/visit',
'WaitTokenURL': 'https://example.com/wait'}
- interaction_info = WebBrowserInteractionInfo.from_dict(info_dict)
+ interaction_info = httpbakery.WebBrowserInteractionInfo.from_dict(info_dict)
self.assertEqual(
interaction_info.visit_url, 'https://example.com/visit')
self.assertEqual(
interaction_info.wait_token_url, 'https://example.com/wait')
+
+
+class TestError(TestCase):
+
+ def test_from_dict_upper_case_fields(self):
+ err = httpbakery.Error.from_dict({
+ 'Message': 'm',
+ 'Code': 'c',
+ })
+ self.assertEqual(err, httpbakery.Error(
+ code='c',
+ message='m',
+ info=None,
+ version=bakery.LATEST_VERSION,
+ ))
+
+ def test_from_dict_lower_case_fields(self):
+ err = httpbakery.Error.from_dict({
+ 'message': 'm',
+ 'code': 'c',
+ })
+ self.assertEqual(err, httpbakery.Error(
+ code='c',
+ message='m',
+ info=None,
+ version=bakery.LATEST_VERSION,
+ ))