mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge pull request #7 from pontuspr/1-increase-test-coverage-for-scriptsmanagerpy
feat: #1 coverage for get all scripts on None obj
This commit is contained in:
commit
548e20f683
1 changed files with 8 additions and 4 deletions
|
|
@ -8,7 +8,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.manager import ScriptDBManager
|
||||
|
||||
class TestScript(BaseEvenniaTest):
|
||||
def test_create(self):
|
||||
|
|
@ -19,6 +19,12 @@ class TestScript(BaseEvenniaTest):
|
|||
self.assertFalse(errors, errors)
|
||||
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 ListIntervalsScript(DefaultScript):
|
||||
"""
|
||||
A script that does nothing. Used to test listing of script with nonzero intervals.
|
||||
|
|
@ -88,11 +94,9 @@ class TestScriptDB(TestCase):
|
|||
# Check the script is not recreated as a side-effect
|
||||
self.assertFalse(self.scr in ScriptDB.objects.get_all_scripts())
|
||||
|
||||
|
||||
class TestExtendedLoopingCall(TestCase):
|
||||
"""
|
||||
Test the ExtendedLoopingCall class.
|
||||
|
||||
"""
|
||||
|
||||
@mock.patch("evennia.scripts.scripts.LoopingCall")
|
||||
|
|
@ -124,4 +128,4 @@ class TestExtendedLoopingCall(TestCase):
|
|||
|
||||
loopcall.__call__.assert_not_called()
|
||||
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