add test for un-startable script
This commit is contained in:
parent
2e9971dc82
commit
77eccd3033
1 changed files with 54 additions and 42 deletions
|
|
@ -11,6 +11,9 @@ _BASE_TYPECLASS = class_from_module(settings.BASE_SCRIPT_TYPECLASS)
|
|||
class GoodScript(DefaultScript):
|
||||
pass
|
||||
|
||||
class InvalidScript:
|
||||
pass
|
||||
|
||||
class BrokenScript(DefaultScript):
|
||||
"""objects will fail upon call"""
|
||||
@property
|
||||
|
|
@ -64,9 +67,18 @@ class TestGlobalScriptContainer(unittest.TestCase):
|
|||
self.assertIn('script_name', gsc.typeclass_storage)
|
||||
self.assertEqual(gsc.typeclass_storage['script_name'], GoodScript)
|
||||
|
||||
@override_settings(GLOBAL_SCRIPTS={'script_name': {'typeclass': 'evennia.utils.tests.test_containers.BrokenScript'}})
|
||||
def test_start_with_broken_script(self):
|
||||
"""Broken script module should traceback"""
|
||||
@override_settings(GLOBAL_SCRIPTS={'script_name': {'typeclass': 'evennia.utils.tests.test_containers.InvalidScript'}})
|
||||
def test_start_with_invalid_script(self):
|
||||
"""Script class doesn't implement required start methods"""
|
||||
gsc = containers.GlobalScriptContainer()
|
||||
|
||||
with self.assertRaises(Exception) as cm:
|
||||
gsc.start()
|
||||
self.fail("An exception was expected but it didn't occur.")
|
||||
|
||||
@override_settings(GLOBAL_SCRIPTS={'script_name': {'typeclass': 'evennia.utils.tests.test_containers.BrokenScript'}})
|
||||
def test_start_with_broken_script(self):
|
||||
"""Un-importable script should traceback"""
|
||||
gsc = containers.GlobalScriptContainer()
|
||||
|
||||
with self.assertRaises(Exception) as cm:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue