Removed `Client()` class from `diaspy/__init__.py`
[diaspy.git] / tests.py
1 #!/usr/bin/env python3
2
3 import unittest
4
5 # failing to import any of the modules below indicates failed tests
6 # modules used by diaspy
7 import requests, re
8 # actual diaspy code
9 import diaspy
10
11
12 #### test suite configuration variables: can be adjusted to your liking
13 # pod used by tests (has to be valid)
14 __pod__ = "http://pod.orkz.net"
15
16
17 class ClientTests(unittest.TestCase):
18 def testInit(self):
19 """
20 This test checks initialization of Client() instance.
21 """
22 client = diaspy.client.Client(pod=__pod__, username='testuser', password='testpassword')
23 self.assertEqual(__pod__, client.pod)
24 self.assertEqual('testuser', client._username)
25 self.assertEqual('testpassword', client._password)
26 self.assertEqual(client._token_regex, re.compile(r'content="(.*?)"\s+name="csrf-token'))
27 self.assertEqual(client._login_data['user[username]'], 'testuser')
28 self.assertEqual(client._login_data['user[password]'], 'testpassword')
29 self.assertEqual(client._login_data['authenticity_token'], client.get_token())
30
31
32 if __name__ == "__main__": unittest.main()