anki-connect/tests/test_misc.py

29 lines
672 B
Python
Raw Normal View History

2018-05-07 01:45:56 +00:00
#!/usr/bin/env python
2017-08-29 04:21:32 +00:00
import unittest
2018-05-07 01:45:56 +00:00
import util
2017-08-29 04:21:32 +00:00
2018-05-08 22:18:21 +00:00
class TestMisc(unittest.TestCase):
2018-05-07 03:21:59 +00:00
def runTest(self):
2018-05-08 22:18:21 +00:00
# version
2018-05-07 21:34:41 +00:00
self.assertEqual(util.invoke('version'), 5)
2018-05-07 01:45:56 +00:00
2018-05-08 22:18:21 +00:00
# upgrade
2018-05-07 02:01:24 +00:00
util.invoke('upgrade')
2018-05-07 01:45:56 +00:00
2018-05-08 22:18:21 +00:00
# sync
2018-05-07 02:01:24 +00:00
util.invoke('sync')
2018-05-07 01:45:56 +00:00
2018-05-08 22:18:21 +00:00
# multi
actions = [util.request('version'), util.request('version'), util.request('version')]
results = util.invoke('multi', actions=actions)
self.assertEqual(len(results), len(actions))
for result in results:
self.assertIsNone(result['error'])
self.assertEqual(result['result'], 5)
2018-05-07 01:45:56 +00:00
if __name__ == '__main__':
unittest.main()