Merge pull request #2988 from InspectorCaracal/chargen-test-fix

Fix character creator tests
This commit is contained in:
Griatch 2022-11-21 08:32:20 +01:00 committed by GitHub
commit 15fcb37194

View file

@ -1,3 +1,4 @@
from unittest.mock import patch
from django.conf import settings
from django.test import override_settings
from evennia import DefaultCharacter
@ -8,25 +9,29 @@ from evennia.utils.test_resources import BaseEvenniaCommandTest
from . import character_creator
class TestAccount(BaseEvenniaCommandTest):
class TestCharacterCreator(BaseEvenniaCommandTest):
def setUp(self):
super().setUp()
self.account.swap_typeclass(character_creator.ContribChargenAccount)
def test_ooc_look(self):
if settings.MULTISESSION_MODE < 2:
self.call(
account.CmdOOCLook(), "", "You are out-of-character (OOC).", caller=self.account
)
if settings.MULTISESSION_MODE == 2:
# test both normal output and also inclusion of in-progress character
self.account.db._playable_characters = [self.char1]
self.char1.db.chargen_step = "start"
self.account.db._playable_characters = [self.char1]
self.account.unpuppet_all()
self.char1.db.chargen_step = "start"
with patch("evennia.commands.default.account._AUTO_PUPPET_ON_LOGIN", new=False):
# check that correct output is returning
output = self.call(
account.CmdOOCLook(),
"",
"Account TestAccount (you are Out-of-Character)",
caller=self.account,
)
self.assertIn("|Yin progress|n", output)
# check that char1 is recognized as in progress
self.assertIn("in progress", output)
@override_settings(CHARGEN_MENU="evennia.contrib.base_systems.character_creator.example_menu")
@override_settings(CHARGEN_MENU="evennia.contrib.rpg.character_creator.example_menu")
def test_char_create(self):
self.call(
character_creator.ContribCmdCharCreate(),