Prepping unit test for later fixes
This commit is contained in:
parent
d57a3550bc
commit
e28f9dd3c4
2 changed files with 6 additions and 5 deletions
|
|
@ -4,7 +4,6 @@ The custom manager for Scripts.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from evennia.server import signals
|
from evennia.server import signals
|
||||||
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
|
from evennia.typeclasses.managers import TypeclassManager, TypedObjectManager
|
||||||
from evennia.utils.utils import class_from_module, dbid_to_obj, make_iter
|
from evennia.utils.utils import class_from_module, dbid_to_obj, make_iter
|
||||||
|
|
|
||||||
|
|
@ -78,26 +78,28 @@ class TestScriptHandler(BaseEvenniaTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.obj, self.errors = DefaultObject.create("test_object")
|
self.obj, self.errors = DefaultObject.create("test_object")
|
||||||
|
self.obj.scripts.add(TestingListIntervalScript)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.obj.delete()
|
self.obj.delete()
|
||||||
|
|
||||||
def test_start(self):
|
def test_start(self):
|
||||||
"Check that ScriptHandler start function works correctly"
|
"Check that ScriptHandler start function works correctly"
|
||||||
self.obj.scripts.add(TestingListIntervalScript)
|
|
||||||
self.num = self.obj.scripts.start(self.obj.scripts.all()[0].key)
|
self.num = self.obj.scripts.start(self.obj.scripts.all()[0].key)
|
||||||
self.assertTrue(self.num == 1)
|
self.assertEqual(self.num, 1)
|
||||||
|
|
||||||
def test_list_script_intervals(self):
|
def test_list_script_intervals(self):
|
||||||
"Checks that Scripthandler __str__ function lists script intervals correctly"
|
"Checks that Scripthandler __str__ function lists script intervals correctly"
|
||||||
self.obj.scripts.add(TestingListIntervalScript)
|
|
||||||
self.str = str(self.obj.scripts)
|
self.str = str(self.obj.scripts)
|
||||||
self.assertTrue("None/1" in self.str)
|
self.assertTrue("None/1" in self.str)
|
||||||
self.assertTrue("1 repeats" in self.str)
|
self.assertTrue("1 repeats" in self.str)
|
||||||
|
|
||||||
|
def test_get_all_scripts(self):
|
||||||
|
"Checks that Scripthandler get_all returns correct number of scripts"
|
||||||
|
self.assertEqual([script.key for script in self.obj.scripts.all()], ["interval_test"])
|
||||||
|
|
||||||
def test_get_script(self):
|
def test_get_script(self):
|
||||||
"Checks that Scripthandler get function returns correct script"
|
"Checks that Scripthandler get function returns correct script"
|
||||||
self.obj.scripts.add(TestingListIntervalScript)
|
|
||||||
script = self.obj.scripts.get("interval_test")
|
script = self.obj.scripts.get("interval_test")
|
||||||
self.assertTrue(bool(script))
|
self.assertTrue(bool(script))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue