feat: #4 add tests to increase code coverage

add test_store_key_raises_RunTimeError and
test_remove_raises_RunTimeError to scripts/tests.py to increase code
coverage for scripts/tickethandler.py
This commit is contained in:
hapeters 2023-03-01 22:26:10 +01:00
parent 6e7cf07b75
commit 3a06c7dc91

View file

@ -7,6 +7,7 @@ from evennia.scripts.models import ObjectDoesNotExist, ScriptDB
from evennia.scripts.scripts import DoNothing, ExtendedLoopingCall
from evennia.utils.create import create_script
from evennia.utils.test_resources import BaseEvenniaTest
from evennia.scripts.tickerhandler import TickerHandler
class TestScript(BaseEvenniaTest):
@ -18,6 +19,17 @@ class TestScript(BaseEvenniaTest):
self.assertFalse(errors, errors)
mockinit.assert_called()
class Test_improve_coverage(TestCase):
def test_store_key_raises_RunTimeError(self):
with self.assertRaises(RuntimeError):
th=TickerHandler()
th._store_key(None, None, 0, None)
def test_remove_raises_RunTimeError(self):
with self.assertRaises(RuntimeError):
th=TickerHandler()
th.remove(callback=1)
class TestScriptDB(TestCase):
"Check the singleton/static ScriptDB object works correctly"