Skip to content

Commit b0377fe

Browse files
authored
Merge pull request #14 from 29next/787-theme-kit-oauth-tokens
PRIME #787 theme kit oauth tokens
2 parents 8abe723 + 71b2694 commit b0377fe

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

ntk/gateway.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, store, apikey):
1111
def _request(self, request_type, url, apikey=None, payload={}, files={}):
1212
headers = {}
1313
if apikey:
14-
headers = {'Authorization': f'Token {apikey}'}
14+
headers = {'Authorization': f'Bearer {apikey}'}
1515

1616
return requests.request(request_type, url, headers=headers, data=payload, files=files)
1717

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import find_packages, setup
22

3-
__version__ = '1.0.1'
3+
__version__ = '1.0.2'
44

55
tests_require = [
66
"flake8==3.9.2",

tests/test_gateway.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_request(self, mock_request):
2929

3030
expected_calls = [call(
3131
'POST', 'http://simple.com/api/admin/themes/5/templates/',
32-
headers={'Authorization': 'Token apikey'},
32+
headers={'Authorization': 'Bearer apikey'},
3333
data={'name': 'assets/base.html', 'content': '{% load i18n %}\n\n<div class="mt-2">My home page</div>'},
3434
files=files)
3535
]
@@ -57,7 +57,7 @@ def test_get_themes(self, mock_request):
5757
self.gateway.get_themes()
5858

5959
expected_call = call('GET', 'http://simple.com/api/admin/themes/',
60-
headers={'Authorization': 'Token apikey'}, data={}, files={})
60+
headers={'Authorization': 'Bearer apikey'}, data={}, files={})
6161
self.assertIn(expected_call, mock_request.mock_calls)
6262

6363
####
@@ -84,7 +84,7 @@ def test_create_theme(self, mock_request):
8484
self.gateway.create_theme(name="Test Init Theme")
8585

8686
expected_call = call('POST', 'http://simple.com/api/admin/themes/',
87-
headers={'Authorization': 'Token apikey'}, data=payload, files={})
87+
headers={'Authorization': 'Bearer apikey'}, data=payload, files={})
8888
self.assertIn(expected_call, mock_request.mock_calls)
8989

9090
#####
@@ -111,7 +111,7 @@ def test_get_templates(self, mock_request):
111111
self.gateway.get_templates(theme_id=6)
112112

113113
expected_call = call('GET', 'http://simple.com/api/admin/themes/6/templates/',
114-
headers={'Authorization': 'Token apikey'}, data={}, files={})
114+
headers={'Authorization': 'Bearer apikey'}, data={}, files={})
115115
self.assertIn(expected_call, mock_request.mock_calls)
116116

117117
#####
@@ -137,7 +137,7 @@ def test_get_template(self, mock_request):
137137
self.gateway.get_template(theme_id=6, template_name=template_name)
138138

139139
expected_call = call('GET', f'http://simple.com/api/admin/themes/6/templates/?name={template_name}',
140-
headers={'Authorization': 'Token apikey'}, data={}, files={})
140+
headers={'Authorization': 'Bearer apikey'}, data={}, files={})
141141
self.assertIn(expected_call, mock_request.mock_calls)
142142

143143
#####
@@ -168,7 +168,7 @@ def test_create_or_update_template(self, mock_request):
168168
theme_id=6, template_name=payload['name'], content=payload['content'], files=files)
169169

170170
expected_call = call('POST', 'http://simple.com/api/admin/themes/6/templates/',
171-
headers={'Authorization': 'Token apikey'}, data=payload, files=files)
171+
headers={'Authorization': 'Bearer apikey'}, data=payload, files=files)
172172
self.assertIn(expected_call, mock_request.mock_calls)
173173

174174
#####
@@ -196,5 +196,5 @@ def test_delete_template(self, mock_request):
196196
self.gateway.delete_template(theme_id=6, template_name='asset/custom.css')
197197

198198
expected_call = call('DELETE', 'http://simple.com/api/admin/themes/6/templates/?name=asset/custom.css',
199-
headers={'Authorization': 'Token apikey'}, data={}, files={})
199+
headers={'Authorization': 'Bearer apikey'}, data={}, files={})
200200
self.assertIn(expected_call, mock_request.mock_calls)

0 commit comments

Comments
 (0)