work on tests

This commit is contained in:
Alex Yatskov 2018-05-06 20:21:59 -07:00
parent 8b78a4d2f7
commit acad72732f
3 changed files with 11 additions and 21 deletions

3
test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/sh
python -m unittest discover -v tests

View File

@ -1,16 +0,0 @@
# -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from util import callAnkiConnectEndpoint
class TestDeckNames(TestCase):
def test_deckNames(self):
response = callAnkiConnectEndpoint({'action': 'deckNames'})
self.assertEqual(['Default'], response)
class TestGetDeckConfig(TestCase):
def test_getDeckConfig(self):
response = callAnkiConnectEndpoint({'action': 'getDeckConfig', 'params': {'deck': 'Default'}})
self.assertDictContainsSubset({'name': 'Default', 'replayq': True}, response)

View File

@ -4,21 +4,24 @@ import unittest
import util import util
class TestMisc(unittest.TestCase): class TestVersion(unittest.TestCase):
def test_version(self): def runTest(self):
result = util.invoke('version') result = util.invoke('version')
self.assertEqual(result, 5) self.assertEqual(result, 5)
def test_upgrade(self): class TestUpgrade(unittest.TestCase):
def runTest(self):
util.invoke('upgrade') util.invoke('upgrade')
def test_sync(self): class TestSync(unittest.TestCase):
def runTest(self):
util.invoke('sync') util.invoke('sync')
def test_multi(self): class TestMulti(unittest.TestCase):
def runTest(self):
result = util.invoke( result = util.invoke(
'multi', { 'multi', {
'actions': [ 'actions': [