anki-connect/tests/test_graphical.py
Jason Won 591ac06aa3
allow guiAddCards to add media (#266)
* add media to editing note

* update readme
2021-06-20 20:35:09 -07:00

71 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python
import unittest
import util
class TestGui(unittest.TestCase):
def runTest(self):
# guiBrowse
util.invoke('guiBrowse', query='deck:Default')
# guiAddCards
util.invoke('guiAddCards')
# guiAddCards with preset
util.invoke('createDeck', deck='test')
note = {
'deckName': 'test',
'modelName': 'Basic',
'fields': {
'Front': 'front1',
'Back': 'back1'
},
'tags': ['tag1'],
}
util.invoke('guiAddCards', note=note)
# guiAddCards with preset and closeAfterAdding
util.invoke('guiAddCards', note={
**note,
'options': { 'closeAfterAdding': True },
})
util.invoke('guiAddCards', note={
**note,
'picture': [{
'url': 'https://via.placeholder.com/150.png',
'filename': 'placeholder.png',
'fields': ['Front'],
}]
})
# guiCurrentCard
# util.invoke('guiCurrentCard')
# guiStartCardTimer
util.invoke('guiStartCardTimer')
# guiShowQuestion
util.invoke('guiShowQuestion')
# guiShowAnswer
util.invoke('guiShowAnswer')
# guiAnswerCard
util.invoke('guiAnswerCard', ease=1)
# guiDeckOverview
util.invoke('guiDeckOverview', name='Default')
# guiDeckBrowser
util.invoke('guiDeckBrowser')
# guiExitAnki
# util.invoke('guiExitAnki')
if __name__ == '__main__':
unittest.main()