Cleaned up tests to use newly-renamed Account hooks for add/remove characters.

This commit is contained in:
Andrew Bastien 2023-05-07 21:27:33 -04:00
parent f782cd8fc8
commit 4b80b200d8
20 changed files with 774 additions and 50 deletions

View file

@ -179,7 +179,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
"puppet:id(%i) or pid(%i) or perm(Developer) or pperm(Developer);delete:id(%i) or"
" perm(Admin)" % (new_character.id, account.id, account.id)
)
account.add_character(new_character)
account.add_character_to_playable_list(new_character)
if desc:
new_character.db.desc = desc
elif not new_character.db.desc:
@ -238,7 +238,7 @@ class CmdCharDelete(COMMAND_DEFAULT_CLASS):
# only take action
delobj = caller.ndb._char_to_delete
key = delobj.key
caller.remove_character(delobj)
caller.remove_character_from_playable_list(delobj)
delobj.delete()
self.msg(f"Character '{key}' was permanently deleted.")
logger.log_sec(

View file

@ -589,7 +589,7 @@ class TestAccount(BaseEvenniaCommandTest):
]
)
def test_ooc_look(self, multisession_mode, auto_puppet, max_nr_chars, expected_result):
self.account.db._playable_characters = [self.char1]
self.account.add_character_to_playable_list(self.char1)
self.account.unpuppet_all()
with self.settings(MULTISESSION=multisession_mode):
@ -609,14 +609,14 @@ class TestAccount(BaseEvenniaCommandTest):
self.call(account.CmdOOC(), "", "You go OOC.", caller=self.account)
def test_ic(self):
self.account.db._playable_characters = [self.char1]
self.account.add_character_to_playable_list(self.char1)
self.account.unpuppet_object(self.session)
self.call(
account.CmdIC(), "Char", "You become Char.", caller=self.account, receiver=self.char1
)
def test_ic__other_object(self):
self.account.db._playable_characters = [self.obj1]
self.account.add_character_to_playable_list(self.obj1)
self.account.unpuppet_object(self.session)
self.call(
account.CmdIC(), "Obj", "You become Obj.", caller=self.account, receiver=self.obj1
@ -670,7 +670,7 @@ class TestAccount(BaseEvenniaCommandTest):
# whether permissions are being checked
# Add char to account playable characters
self.account.db._playable_characters.append(self.char1)
self.account.add_character_to_playable_list(self.char1)
# Try deleting as Developer
self.call(

View file

@ -507,7 +507,7 @@ def _create_character(session, new_account, typeclass, home, permissions):
typeclass, key=new_account.key, home=home, permissions=permissions
)
# set playable character list
new_account.add_character(new_character)
new_account.add_character_to_playable_list(new_character)
# allow only the character itself and the account to puppet this character (and Developers).
new_character.locks.add(