mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix typo in prototype
This commit is contained in:
parent
3cd5be6e82
commit
2ab37d3988
2 changed files with 34 additions and 1 deletions
|
|
@ -187,7 +187,7 @@ def homogenize_prototype(prototype, custom_keys=None):
|
|||
"prototype-{}".format(hashlib.md5(bytes(str(time.time()), "utf-8")).hexdigest()[:7]),
|
||||
)
|
||||
homogenized["prototype_tags"] = homogenized.get("prototype_tags", [])
|
||||
homogenized["prototype_locks"] = homogenized.get("prototype_lock", _PROTOTYPE_FALLBACK_LOCK)
|
||||
homogenized["prototype_locks"] = homogenized.get("prototype_locks", _PROTOTYPE_FALLBACK_LOCK)
|
||||
homogenized["prototype_desc"] = homogenized.get("prototype_desc", "")
|
||||
if "typeclass" not in prototype and "prototype_parent" not in prototype:
|
||||
homogenized["typeclass"] = settings.BASE_OBJECT_TYPECLASS
|
||||
|
|
|
|||
|
|
@ -402,6 +402,39 @@ class TestProtLib(BaseEvenniaTest):
|
|||
match = protlib.search_prototype(self.prot["prototype_key"].upper())
|
||||
self.assertEqual(match, [self.prot])
|
||||
|
||||
def test_homogenize_prototype_locks_preserved(self):
|
||||
"""Test that homogenize_prototype preserves custom prototype_locks. (Bug 3828)"""
|
||||
from evennia.prototypes.prototypes import _PROTOTYPE_FALLBACK_LOCK
|
||||
|
||||
prot_with_locks = {
|
||||
"prototype_key": "test_prot_with_locks",
|
||||
"typeclass": "evennia.objects.objects.DefaultObject",
|
||||
"prototype_locks": "spawn:perm(Builder);edit:perm(Admin)",
|
||||
}
|
||||
homogenized = protlib.homogenize_prototype(prot_with_locks)
|
||||
self.assertEqual(
|
||||
homogenized["prototype_locks"],
|
||||
"spawn:perm(Builder);edit:perm(Admin)",
|
||||
)
|
||||
self.assertNotEqual(
|
||||
homogenized["prototype_locks"],
|
||||
_PROTOTYPE_FALLBACK_LOCK,
|
||||
)
|
||||
|
||||
def test_homogenize_prototype_locks_default_fallback(self):
|
||||
"""Test that homogenize_prototype uses default when prototype_locks not provided."""
|
||||
from evennia.prototypes.prototypes import _PROTOTYPE_FALLBACK_LOCK
|
||||
|
||||
prot_without_locks = {
|
||||
"prototype_key": "test_prot_without_locks",
|
||||
"typeclass": "evennia.objects.objects.DefaultObject",
|
||||
}
|
||||
homogenized = protlib.homogenize_prototype(prot_without_locks)
|
||||
self.assertEqual(
|
||||
homogenized["prototype_locks"],
|
||||
_PROTOTYPE_FALLBACK_LOCK,
|
||||
)
|
||||
|
||||
|
||||
class TestProtFuncs(BaseEvenniaTest):
|
||||
@override_settings(PROT_FUNC_MODULES=["evennia.prototypes.protfuncs"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue