Added very basic test
This commit is contained in:
parent
bc863a3345
commit
344d2f3dac
0
src/test/__init__.py
Normal file
0
src/test/__init__.py
Normal file
27
src/test/test_renderers.py
Normal file
27
src/test/test_renderers.py
Normal file
@ -0,0 +1,27 @@
|
||||
import unittest
|
||||
import testconfig
|
||||
import languageHandler
|
||||
from sessionmanager import utils
|
||||
from sessionmanager import renderers
|
||||
|
||||
class renderersTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
languageHandler.setLanguage("en")
|
||||
vk = testconfig.get_vk()
|
||||
self.vk = vk.get_api()
|
||||
|
||||
def test_render_person(self):
|
||||
""" Test the person renderer function."""
|
||||
user = self.vk.users.get(user_ids=1, fields="first_name, last_name, last_seen")
|
||||
self.assertIsInstance(user, list)
|
||||
self.assertEquals(len(user), 1)
|
||||
user = user[0]
|
||||
rendered_object = renderers.render_person(user, user["last_seen"])
|
||||
self.assertIsInstance(rendered_object, list)
|
||||
self.assertEquals(len(rendered_object), 2)
|
||||
self.assertIsInstance(rendered_object[0], unicode)
|
||||
self.assertIsInstance(rendered_object[1], unicode)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
9
src/test/testconfig.py
Normal file
9
src/test/testconfig.py
Normal file
@ -0,0 +1,9 @@
|
||||
import os
|
||||
from vk_api import VkApi
|
||||
|
||||
def get_vk():
|
||||
login = os.environ['LOGIN']
|
||||
password = os.environ['PASSWORD']
|
||||
vk = VkApi(login, password)
|
||||
vk.auth(token_only=True)
|
||||
return vk
|
Loading…
Reference in New Issue
Block a user