working on deck tests
This commit is contained in:
parent
acad72732f
commit
9e24d82a39
@ -360,6 +360,14 @@ class AnkiConnect:
|
||||
return collection
|
||||
|
||||
|
||||
def decks(self):
|
||||
decks = self.collection().decks
|
||||
if decks is None:
|
||||
raise Exception('decks are not available')
|
||||
else:
|
||||
return decks
|
||||
|
||||
|
||||
def scheduler(self):
|
||||
scheduler = self.collection().sched
|
||||
if scheduler is None:
|
||||
@ -472,7 +480,7 @@ class AnkiConnect:
|
||||
|
||||
@api()
|
||||
def deckNames(self):
|
||||
return self.collection().decks.allNames()
|
||||
return self.decks().allnames()
|
||||
|
||||
|
||||
@api()
|
||||
|
21
tests/test_decks.py
Executable file
21
tests/test_decks.py
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import unittest
|
||||
import util
|
||||
|
||||
|
||||
class TestDeckNames(unittest.TestCase):
|
||||
def runTest(self):
|
||||
result = util.invoke('deckNames')
|
||||
self.assertIn('Default', result)
|
||||
|
||||
|
||||
class TestDeckNamesAndIds(unittest.TestCase):
|
||||
def runTest(self):
|
||||
result = util.invoke('deckNamesAndIds')
|
||||
self.assertIn('Default', result)
|
||||
self.assertEqual(result['Default'], 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user