summaryrefslogtreecommitdiff
path: root/tests/unit/core
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-02-23 00:35:33 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2017-02-24 16:20:52 +0100
commite3999c4906348dadcc85eec1df9a48e776deccd5 (patch)
tree7f8156ba80f367df22c4e823c301360706e06e8d /tests/unit/core
parent6b3ea883a62d40f8e2d68ce95bbefa2ac64b95de (diff)
[feature] require authentication token for api
implements a global auth token for the app. this token is written to .config/leap/authtoken, and passed to the anchor part of the landing URI when opening the index resource by the browser. - Resolves: #8765
Diffstat (limited to 'tests/unit/core')
-rw-r--r--tests/unit/core/test_web_api.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/unit/core/test_web_api.py b/tests/unit/core/test_web_api.py
index 5b51869..10356f0 100644
--- a/tests/unit/core/test_web_api.py
+++ b/tests/unit/core/test_web_api.py
@@ -131,7 +131,7 @@ class RESTApiTests(unittest.TestCase):
def setUp(self):
dispatcher = dummyDispatcherFactory()
- api = web.api.Api(dispatcher)
+ api = web.api.Api(dispatcher, ['aaa'])
root = resource.Resource()
root.putChild(b"API", api)
plainSite = Site(root)
@@ -205,7 +205,8 @@ class RESTApiTests(unittest.TestCase):
uri = networkString("http://127.0.0.1:%d/API/%s" % (
self.plainPortno, path))
return client.getPage(
- uri, method=method, timeout=1, postdata=postdata)
+ uri, method=method, timeout=1, postdata=postdata,
+ headers={'X-Bitmask-Auth': 'aaa'})
def assertCall(self, returned, expected):
data = json.loads(returned)