mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fixes create() method failure where no account was provided.
This commit is contained in:
parent
45abac71f4
commit
6859b2ac0e
2 changed files with 12 additions and 3 deletions
|
|
@ -2076,9 +2076,10 @@ class DefaultCharacter(DefaultObject):
|
|||
|
||||
try:
|
||||
# Check to make sure account does not have too many chars
|
||||
if len(account.characters) >= settings.MAX_NR_CHARACTERS:
|
||||
errors.append("There are too many characters associated with this account.")
|
||||
return obj, errors
|
||||
if account:
|
||||
if len(account.characters) >= settings.MAX_NR_CHARACTERS:
|
||||
errors.append("There are too many characters associated with this account.")
|
||||
return obj, errors
|
||||
|
||||
# Create the Character
|
||||
obj = create.create_object(**kwargs)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,14 @@ class DefaultObjectTest(EvenniaTest):
|
|||
self.assertEqual(description, obj.db.desc)
|
||||
self.assertEqual(obj.db.creator_ip, self.ip)
|
||||
self.assertEqual(obj.db_home, self.room1)
|
||||
|
||||
def test_character_create_noaccount(self):
|
||||
obj, errors = DefaultCharacter.create(
|
||||
"oscar", None, home=self.room1.dbref
|
||||
)
|
||||
self.assertTrue(obj, errors)
|
||||
self.assertFalse(errors, errors)
|
||||
self.assertEqual(obj.db_home, self.room1)
|
||||
|
||||
def test_room_create(self):
|
||||
description = "A dimly-lit alley behind the local Chinese restaurant."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue