feat: #1 coverage for get all scripts on None obj
This commit is contained in:
parent
6e7cf07b75
commit
ec994436cd
1 changed files with 7 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ from evennia.scripts.models import ObjectDoesNotExist, ScriptDB
|
||||||
from evennia.scripts.scripts import DoNothing, ExtendedLoopingCall
|
from evennia.scripts.scripts import DoNothing, ExtendedLoopingCall
|
||||||
from evennia.utils.create import create_script
|
from evennia.utils.create import create_script
|
||||||
from evennia.utils.test_resources import BaseEvenniaTest
|
from evennia.utils.test_resources import BaseEvenniaTest
|
||||||
|
from evennia.scripts.manager import ScriptDBManager
|
||||||
|
|
||||||
class TestScript(BaseEvenniaTest):
|
class TestScript(BaseEvenniaTest):
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
|
|
@ -18,6 +18,11 @@ class TestScript(BaseEvenniaTest):
|
||||||
self.assertFalse(errors, errors)
|
self.assertFalse(errors, errors)
|
||||||
mockinit.assert_called()
|
mockinit.assert_called()
|
||||||
|
|
||||||
|
class Test_improve_coverage(TestCase):
|
||||||
|
def test_not_obj_return_empty_list(self):
|
||||||
|
manager_obj = ScriptDBManager()
|
||||||
|
returned_list = manager_obj.get_all_scripts_on_obj(False)
|
||||||
|
self.assertEqual(returned_list, [])
|
||||||
|
|
||||||
class TestScriptDB(TestCase):
|
class TestScriptDB(TestCase):
|
||||||
"Check the singleton/static ScriptDB object works correctly"
|
"Check the singleton/static ScriptDB object works correctly"
|
||||||
|
|
@ -51,11 +56,9 @@ class TestScriptDB(TestCase):
|
||||||
# Check the script is not recreated as a side-effect
|
# Check the script is not recreated as a side-effect
|
||||||
self.assertFalse(self.scr in ScriptDB.objects.get_all_scripts())
|
self.assertFalse(self.scr in ScriptDB.objects.get_all_scripts())
|
||||||
|
|
||||||
|
|
||||||
class TestExtendedLoopingCall(TestCase):
|
class TestExtendedLoopingCall(TestCase):
|
||||||
"""
|
"""
|
||||||
Test the ExtendedLoopingCall class.
|
Test the ExtendedLoopingCall class.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@mock.patch("evennia.scripts.scripts.LoopingCall")
|
@mock.patch("evennia.scripts.scripts.LoopingCall")
|
||||||
|
|
@ -87,4 +90,4 @@ class TestExtendedLoopingCall(TestCase):
|
||||||
|
|
||||||
loopcall.__call__.assert_not_called()
|
loopcall.__call__.assert_not_called()
|
||||||
self.assertEqual(loopcall.interval, 20)
|
self.assertEqual(loopcall.interval, 20)
|
||||||
loopcall._scheduleFrom.assert_called_with(121)
|
loopcall._scheduleFrom.assert_called_with(121)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue