anki-connect/tests/test_decks.py

35 lines
820 B
Python
Raw Normal View History

2018-05-07 05:13:21 +00:00
#!/usr/bin/env python
import unittest
import util
2018-05-09 00:22:42 +00:00
class TestDecks(unittest.TestCase):
2018-05-07 05:13:21 +00:00
def runTest(self):
2018-05-09 00:22:42 +00:00
# deckNames (part 1)
deckNames = util.invoke('deckNames')
self.assertIn('Default', deckNames)
2018-05-07 05:13:21 +00:00
2018-05-09 00:22:42 +00:00
# deckNamesAndIds
2018-05-07 05:13:21 +00:00
result = util.invoke('deckNamesAndIds')
self.assertIn('Default', result)
self.assertEqual(result['Default'], 1)
2018-05-09 00:22:42 +00:00
# createDeck
2018-05-07 21:34:41 +00:00
util.invoke('createDeck', deck='test')
2018-05-07 21:18:20 +00:00
2018-05-09 00:22:42 +00:00
# deckNames (part 2)
deckNames = util.invoke('deckNames')
self.assertIn('test', deckNames)
2018-05-07 21:18:20 +00:00
2018-05-09 00:22:42 +00:00
# deleteDecks
2018-05-07 21:34:41 +00:00
util.invoke('deleteDecks', decks=['test'])
2018-05-09 00:22:42 +00:00
# deckNames (part 3)
deckNames = util.invoke('deckNames')
self.assertNotIn('test', deckNames)
2018-05-07 21:18:20 +00:00
2018-05-07 05:13:21 +00:00
if __name__ == '__main__':
unittest.main()