-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_vk_profile.py
More file actions
33 lines (25 loc) · 1.23 KB
/
Copy pathtest_vk_profile.py
File metadata and controls
33 lines (25 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
from vk_profile import VkApi
class TestVkApi(unittest.TestCase):
def test_try_get_city_correct(self):
correct = {'city': {'title': 'DA'}}
assert VkApi.try_get_city(correct) == 'DA'
def test_try_get_city_wrong1(self):
correct = {'town': {'tilte': 'DA'}}
assert VkApi.try_get_city(correct) is None
def test_try_get_city_Wrong2(self):
correct = {'city': {'asd': "asd"}}
assert VkApi.try_get_city(correct) is None
def test_albumList_correct(self):
correct = [{'title': 'asd', 'size': 123, 'description': 'asdastfwr'},
{'title': 'awesd', 'size': 123, 'description': 'asdastfwr'},
{'title': 'asdsd', 'size': 123, 'description': 'asdastfwr'}]
assert VkApi.get_album_info(correct)
def test_albumList_empty(self):
wrong = None
assert not VkApi.get_album_info(wrong)
def test_get_user_subscriptions_info_correct(self):
correct = [{'id': '1', 'name': "12332", 'type': 'post'},
{'id': '2', 'name': "12233", 'type': 'post'},
{'id': '3', 'name': "11123", 'type': 'post'}]
assert VkApi.get_user_subscriptions_info(correct)