diff options
author | Colin Watson <cjwatson@debian.org> | 2018-10-15 10:58:25 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2018-10-15 10:58:25 +0100 |
commit | 619cb9d927e2d6955d0b6a97d4d4c5ea9548150a (patch) | |
tree | 4a46618b7c301c0c3e037d4fe3eb61f8d06da743 /macaroonbakery/tests/test_httpbakery.py | |
parent | 883e591e1e08c13d1a8e909a113a621552ae4b55 (diff) |
New upstream version 1.2.1
Diffstat (limited to 'macaroonbakery/tests/test_httpbakery.py')
-rw-r--r-- | macaroonbakery/tests/test_httpbakery.py | 32 |
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, + )) |