mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge pull request #2798 from avalonhope/develop
Update test_search.py - test script_search by tag
This commit is contained in:
commit
53a804c05f
1 changed files with 15 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from evennia.scripts.scripts import DefaultScript
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.search import search_script_attribute, search_script_tag
|
||||
from evennia.utils.search import search_script_attribute, search_script_tag, search_script
|
||||
|
||||
class TestSearch(EvenniaTest):
|
||||
|
||||
|
|
@ -48,3 +48,17 @@ class TestSearch(EvenniaTest):
|
|||
script.db.an_attribute = "some value"
|
||||
found = search_script_attribute(key="an_attribute", value="wrong value")
|
||||
self.assertEqual(len(found), 0, errors)
|
||||
|
||||
def test_search_script_key(self):
|
||||
"""Check that a script can be found by its key value."""
|
||||
script, errors = DefaultScript.create("a-script")
|
||||
found = search_script("a-script")
|
||||
self.assertEqual(len(found), 1, errors)
|
||||
self.assertEqual(script.key, found[0].key, errors)
|
||||
|
||||
def test_search_script_wrong_key(self):
|
||||
"""Check that a script cannot be found by a wrong key value."""
|
||||
script, errors = DefaultScript.create("a-script")
|
||||
found = search_script("wrong_key")
|
||||
self.assertEqual(len(found), 0, errors)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue