Skip to content

Commit 2a15bca

Browse files
committed
Add unit test
1 parent 20ca0b8 commit 2a15bca

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

tests/python/unit/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pytest==6.2.1
2+
allure-pytest==2.8.29

tests/python/unit/test_common.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from dku_utils import template_dict
2+
import pytest
3+
4+
5+
class TestCommonMethods:
6+
def setup_class(self):
7+
self.template = {
8+
'url': 'https://api.spotify.com/v1/users/{{user_id}}/playlists',
9+
'headers': {
10+
'Content-Type': 'application/json',
11+
'Authorization': 'Bearer {{access_token}}'
12+
},
13+
'recipe_columns_parameter_names': ['user_id'],
14+
'key_to_next_page_url': 'next', 'items_key': 'items'
15+
}
16+
self.kwargs = {
17+
u'column': u'profiles id',
18+
'access_token': u'12341234secretcode-4321shhhhhh',
19+
'user_id': '1234abcde'
20+
}
21+
self.endpoint_ok = {
22+
'url': 'https://api.spotify.com/v1/users/1234abcde/playlists',
23+
'headers': {
24+
'Content-Type': 'application/json',
25+
'Authorization': 'Bearer 12341234secretcode-4321shhhhhh'
26+
},
27+
'key_to_next_page_url': 'next',
28+
'items_key': 'items',
29+
'recipe_columns_parameter_names': ['user_id']
30+
}
31+
32+
def test_template_dict(self):
33+
endpoint = template_dict(self.template, **self.kwargs)
34+
assert endpoint == self.endpoint_ok

0 commit comments

Comments
 (0)