Commit 8bd614bf authored by Abhilash Raj's avatar Abhilash Raj
Browse files

Merge branch 'token' into 'master'

Use Token as the authorization type.

See merge request !10
parents d169d062 18816fbd
Pipeline #387326837 passed with stage
in 2 minutes and 58 seconds
......@@ -13,14 +13,24 @@ All documentation on installing HyperKitty can be found in the documentation
provided by the ``HyperKitty`` python package. It is also available online at
the following URL: http://hyperkitty.readthedocs.org.
All documentation on installing HyperKitty Plugin can be found in the documentation
provided by the following URL: http://hyperkitty.readthedocs.io/en/latest/install.html#connecting-to-mailman.
All documentation on installing HyperKitty Plugin can be found in the
documentation provided by the following URL:
http://hyperkitty.readthedocs.io/en/latest/install.html#connecting-to-mailman.
The source code is available on GitLab
https://gitlab.com/mailman/mailman-hyperkitty.
It is developed by the same people who develop HyperKitty, so you can use the
same communication channels to reach them.
Changelog
=========
1.2.0
-----
- Update the authentication to call Hyperkitty using the API key as a part of
Authorization HTTP header instead of url parameter.
Copyright & Licensing
=====================
......@@ -28,4 +38,4 @@ Copyright & Licensing
This module is licensed under the
`GPL v3.0 <http://www.gnu.org/licenses/gpl-3.0.html>`_
Copyright (C) 2014-2019 by the Free Software Foundation, Inc.
Copyright (C) 2014-2021 by the Free Software Foundation, Inc.
......@@ -67,7 +67,7 @@ class Archiver(object):
@property
def headers(self):
return {"Authorization": self._conf["api_key"]}
return {"Authorization": "Token {}".format(self._conf["api_key"])}
def _load_conf(self):
"""
......
......@@ -158,7 +158,7 @@ Not really HTML
self.requests.get.assert_called_with(
"http://localhost/api/mailman/urls",
params={'mlist': 'list@lists.example.com'},
headers={'Authorization': 'DummyKey'},
headers={'Authorization': 'Token DummyKey'},
)
def test_permalink(self):
......@@ -171,7 +171,7 @@ Not really HTML
"http://localhost/api/mailman/urls",
params={'msgid': 'dummy',
'mlist': 'list@lists.example.com'},
headers={'Authorization': 'DummyKey'},
headers={'Authorization': 'Token DummyKey'},
)
......@@ -186,7 +186,7 @@ Not really HTML
self.assertEqual(archive_url, url)
self.requests.post.assert_called_with(
"http://localhost/api/mailman/archive",
headers={'Authorization': 'DummyKey'},
headers={'Authorization': 'Token DummyKey'},
data={'mlist': 'list@lists.example.com'},
files={'message': ('message.txt', msg.as_string())},
)
......@@ -210,7 +210,7 @@ Not really HTML
self.assertEqual(archive_url, url)
self.requests.post.assert_called_with(
"http://localhost/api/mailman/archive",
headers={'Authorization': 'DummyKey'},
headers={'Authorization': 'Token DummyKey'},
data={'mlist': 'list@lists.example.com'},
files={'message': ('message.txt', _sanitize(msg.as_string()))},
)
......@@ -316,12 +316,12 @@ Not really HTML
self.assertEqual(self.requests.post.call_args_list, [
(("http://localhost/api/mailman/archive",), dict(
headers={'Authorization': 'DummyKey'},
headers={'Authorization': 'Token DummyKey'},
data={'mlist': 'list@lists.example.com'},
files={'message': ('message.txt', msg_1.as_string())},
)),
(("http://localhost/api/mailman/archive",), dict(
headers={'Authorization': 'DummyKey'},
headers={'Authorization': 'Token DummyKey'},
data={'mlist': 'list@lists.example.com'},
files={'message': ('message.txt', msg_2.as_string())},
)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment