anki-connect/tests/test_misc.py

41 lines
852 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-07 03:21:59 +00:00
class TestVersion(unittest.TestCase):
def runTest(self):
2018-05-07 21:34:41 +00:00
self.assertEqual(util.invoke('version'), 5)
2018-05-07 01:45:56 +00:00
2018-05-07 03:21:59 +00:00
class TestUpgrade(unittest.TestCase):
def runTest(self):
2018-05-07 02:01:24 +00:00
util.invoke('upgrade')
2018-05-07 01:45:56 +00:00
2018-05-07 03:21:59 +00:00
class TestSync(unittest.TestCase):
def runTest(self):
2018-05-07 02:01:24 +00:00
util.invoke('sync')
2018-05-07 01:45:56 +00:00
2018-05-07 03:21:59 +00:00
class TestMulti(unittest.TestCase):
def runTest(self):
2018-05-07 02:01:24 +00:00
result = util.invoke(
2018-05-07 21:34:41 +00:00
'multi',
actions=[
util.request('version'),
util.request('version'),
util.request('version')
]
2018-05-07 01:45:56 +00:00
)
self.assertEqual(len(result), 3)
for response in result:
self.assertIsNone(response['error'])
self.assertEqual(response['result'], 5)
if __name__ == '__main__':
unittest.main()