2019-01-01 19:42:53 -06:00
|
|
|
from __future__ import unicode_literals
|
2018-12-20 11:59:35 -06:00
|
|
|
import unittest
|
2019-01-01 19:42:53 -06:00
|
|
|
from . import testconfig
|
2018-12-20 11:59:35 -06:00
|
|
|
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)
|
2019-01-01 19:42:53 -06:00
|
|
|
self.assertIsInstance(rendered_object[0], str)
|
|
|
|
self.assertIsInstance(rendered_object[1], str)
|
2018-12-20 11:59:35 -06:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|