aboutsummaryrefslogtreecommitdiff
path: root/rscalib/tests
diff options
context:
space:
mode:
Diffstat (limited to 'rscalib/tests')
-rw-r--r--rscalib/tests/__init__.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/rscalib/tests/__init__.py b/rscalib/tests/__init__.py
index c3a8afa..6558d0a 100644
--- a/rscalib/tests/__init__.py
+++ b/rscalib/tests/__init__.py
@@ -20,6 +20,7 @@ from rscalib import (
GetMazaDataAPI2,
GetMazaDataAPI3,
GetMazaDataAPI4,
+ GetMazaDataAPI5,
PycURLGetter,
Unauthorized,
)
@@ -118,6 +119,20 @@ class TestGetMazaDataAPI4(TestCase):
self.assertEqual(expected, request.headers['Authorization'])
+class TestGetMazaDataAPI5(TestCase):
+
+ def test_make_request(self):
+ """v5 requests have correct URL and Auth header."""
+ getter = GetMazaDataAPI5('foo', 'bar')
+ request = getter.make_request()
+ credentials = base64.encodebytes(b'foo:bar').decode('ascii')
+ expected = 'Basic %s' % credentials
+ self.assertEqual('GET', request.get_method())
+ self.assertEqual('https://uccs.landscape.canonical.com/api/4/',
+ request.get_full_url())
+ self.assertEqual(expected, request.headers['Authorization'])
+
+
class FakeCurl:
"""Fake pycurl.Curl for testing PycURLGetter."""