Isolate EvenniaTestCase/EvenniaCommandTest for pristine settings
This commit is contained in:
parent
541e5a116a
commit
498a031662
40 changed files with 223 additions and 123 deletions
|
|
@ -3,7 +3,7 @@ Building menu tests.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . building_menu import BuildingMenu, CmdNoMatch
|
||||
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ class Submenu(BuildingMenu):
|
|||
self.add_choice("title", key="t", attr="key")
|
||||
|
||||
|
||||
class TestBuildingMenu(CommandTest):
|
||||
class TestBuildingMenu(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super(TestBuildingMenu, self).setUp()
|
||||
self.menu = BuildingMenu(caller=self.char1, obj=self.room1, title="test")
|
||||
|
|
|
|||
|
|
@ -3,4 +3,10 @@ Custom gametime contrib - Griatch, vlgeoff 2017
|
|||
|
||||
"""
|
||||
|
||||
from .custom_gametime import * # noqa
|
||||
from .custom_gametime import time_to_tuple, UNITS # noqa
|
||||
from .custom_gametime import gametime_to_realtime # noqa
|
||||
from .custom_gametime import realtime_to_gametime # noqa
|
||||
from .custom_gametime import custom_gametime # noqa
|
||||
from .custom_gametime import real_seconds_until # noqa
|
||||
from .custom_gametime import schedule # noqa
|
||||
from .custom_gametime import GametimeScript # noqa
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Testing custom game time
|
|||
# Testing custom_gametime
|
||||
from mock import Mock, patch
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from . import custom_gametime
|
||||
from .. import custom_gametime
|
||||
|
||||
|
||||
def _testcallback():
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ Test email login.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import email_login
|
||||
|
||||
|
||||
class TestEmailLogin(CommandTest):
|
||||
class TestEmailLogin(EvenniaCommandTest):
|
||||
def test_connect(self):
|
||||
self.call(
|
||||
email_login.CmdUnconnectedConnect(),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from textwrap import dedent
|
|||
|
||||
from django.conf import settings
|
||||
from evennia import ScriptDB
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.objects.objects import ExitCommand
|
||||
from evennia.utils import ansi, utils
|
||||
from evennia.utils.create import create_object, create_script
|
||||
|
|
@ -246,7 +246,7 @@ class TestEventHandler(EvenniaTest):
|
|||
self.assertEqual(self.room1.callbacks.all(), {})
|
||||
|
||||
|
||||
class TestCmdCallback(CommandTest):
|
||||
class TestCmdCallback(EvenniaCommandTest):
|
||||
|
||||
"""Test the @callback command."""
|
||||
|
||||
|
|
@ -425,7 +425,7 @@ class TestCmdCallback(CommandTest):
|
|||
self.assertEqual(callback.valid, True)
|
||||
|
||||
|
||||
class TestDefaultCallbacks(CommandTest):
|
||||
class TestDefaultCallbacks(EvenniaCommandTest):
|
||||
|
||||
"""Test the default callbacks."""
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ Menu-login - Vinvent-lg 2016, Griatch 2019
|
|||
"""
|
||||
|
||||
from .menu_login import UnloggedinCmdSet # noqa
|
||||
from .menu_login import connection_screens # noqa
|
||||
from . import connection_screens # noqa
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ Test menu_login
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import menu_login
|
||||
|
||||
|
||||
class TestMenuLogin(CommandTest):
|
||||
class TestMenuLogin(EvenniaCommandTest):
|
||||
def test_cmdunloggedlook(self):
|
||||
self.call(menu_login.CmdUnloggedinLook(), "", "======")
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ Legacy Mux comms tests (extracted from 0.9.5)
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import mux_comms_cmds as comms
|
||||
|
||||
|
||||
class TestLegacyMuxComms(CommandTest):
|
||||
class TestLegacyMuxComms(EvenniaCommandTest):
|
||||
"""
|
||||
Test the legacy comms contrib.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CommandTest, self).setUp()
|
||||
super().setUp()
|
||||
self.call(
|
||||
comms.CmdChannelCreate(),
|
||||
"testchan;test=Test Channel",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Test of the Unixcommand.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from .unixcommand import UnixCommand
|
||||
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class CmdDummy(UnixCommand):
|
|||
self.msg("{} * {} = {}".format(nb1, nb2, result))
|
||||
|
||||
|
||||
class TestUnixCommand(CommandTest):
|
||||
class TestUnixCommand(EvenniaCommandTest):
|
||||
def test_success(self):
|
||||
"""See the command parsing succeed."""
|
||||
self.call(CmdDummy(), "5 10", "5 * 10 = 50")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
"""
|
||||
Complete game implementations/engines.
|
||||
|
||||
"""
|
||||
|
|
@ -3,11 +3,11 @@ Evscaperoom - Griatch 2019
|
|||
|
||||
"""
|
||||
|
||||
from .evscaperoom import commands # noqa
|
||||
from .evscaperoom import menu # noqa
|
||||
from .evscaperoom import objects # noqa
|
||||
from .evscaperoom import room # noqa
|
||||
from .evscaperoom import scripts # noqa
|
||||
from .evscaperoom import state # noqa
|
||||
from .evscaperoom import tests # noqa
|
||||
from .evscaperoom import utils # noqa
|
||||
from . import commands # noqa
|
||||
from . import menu # noqa
|
||||
from . import objects # noqa
|
||||
from . import room # noqa
|
||||
from . import scripts # noqa
|
||||
from . import state # noqa
|
||||
from . import tests # noqa
|
||||
from . import utils # noqa
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Just start this global script manually or at server creation.
|
|||
|
||||
from evennia import DefaultScript
|
||||
|
||||
from evscaperoom.room import EvscapeRoom
|
||||
from .room import EvscapeRoom
|
||||
|
||||
|
||||
class CleanupScript(DefaultScript):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Unit tests for the Evscaperoom
|
|||
import inspect
|
||||
import pkgutil
|
||||
from os import path
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia import InterruptCommand
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils import mod_import
|
||||
|
|
@ -15,7 +15,7 @@ from . import objects
|
|||
from . import utils
|
||||
|
||||
|
||||
class TestEvscaperoomCommands(CommandTest):
|
||||
class TestEvscaperoomCommands(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.room1 = utils.create_evscaperoom_object("evscaperoom.room.EvscapeRoom", key="Testroom")
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ Test the contrib barter system
|
|||
"""
|
||||
|
||||
from mock import Mock
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from . import barter
|
||||
|
||||
|
||||
class TestBarter(CommandTest):
|
||||
class TestBarter(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.tradeitem1 = create_object(key="TradeItem1", location=self.char1)
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ Testing clothing contrib
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.objects.objects import DefaultRoom
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from . import clothing
|
||||
|
||||
|
||||
class TestClothingCmd(CommandTest):
|
||||
class TestClothingCmd(EvenniaCommandTest):
|
||||
def test_clothingcommands(self):
|
||||
wearer = create_object(clothing.ClothedCharacter, key="Wearer")
|
||||
friend = create_object(clothing.ClothedCharacter, key="Friend")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from evennia.utils.test_resources import EvenniaTest
|
|||
from . import cooldowns
|
||||
|
||||
|
||||
@patch("evennia.contrib.game_systems.cooldowns.time.time", return_value=0.0)
|
||||
@patch("evennia.contrib.game_systems.cooldowns.cooldowns.time.time", return_value=0.0)
|
||||
class TestCooldowns(EvenniaTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ Unit tests for the crafting system contrib.
|
|||
from unittest import mock
|
||||
from django.test import override_settings
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.utils.test_resources import TestCase
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.test_resources import EvenniaTestCase
|
||||
from evennia.utils.create import create_object
|
||||
from . import crafting, example_recipes
|
||||
|
||||
|
||||
class TestCraftUtils(TestCase):
|
||||
class TestCraftUtils(EvenniaTestCase):
|
||||
"""
|
||||
Test helper utils for crafting.
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class _TestMaterial:
|
|||
return self.name
|
||||
|
||||
|
||||
class TestCraftingRecipeBase(TestCase):
|
||||
class TestCraftingRecipeBase(EvenniaTestCase):
|
||||
"""
|
||||
Test the parent recipe class.
|
||||
"""
|
||||
|
|
@ -137,7 +137,7 @@ class _MockRecipe(crafting.CraftingRecipe):
|
|||
|
||||
|
||||
@override_settings(CRAFT_RECIPE_MODULES=[])
|
||||
class TestCraftingRecipe(TestCase):
|
||||
class TestCraftingRecipe(EvenniaTestCase):
|
||||
"""
|
||||
Test the CraftingRecipe class with one recipe
|
||||
"""
|
||||
|
|
@ -474,7 +474,7 @@ class TestCraftingRecipe(TestCase):
|
|||
self.assertIsNotNone(self.tool2.pk)
|
||||
|
||||
|
||||
class TestCraftSword(TestCase):
|
||||
class TestCraftSword(EvenniaTestCase):
|
||||
"""
|
||||
Test the `craft` function by crafting the example sword.
|
||||
|
||||
|
|
@ -655,7 +655,7 @@ class TestCraftSword(TestCase):
|
|||
@mock.patch("evennia.contrib.game_systems.crafting.crafting._load_recipes", new=mock.MagicMock())
|
||||
@mock.patch("evennia.contrib.game_systems.crafting.crafting._RECIPE_CLASSES", new={"testrecipe": _MockRecipe})
|
||||
@override_settings(CRAFT_RECIPE_MODULES=[], DEFAULT_HOME="#999999")
|
||||
class TestCraftCommand(CommandTest):
|
||||
class TestCraftCommand(EvenniaCommandTest):
|
||||
"""Test the crafting command"""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ Test gendersub contrib.
|
|||
"""
|
||||
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from mock import patch
|
||||
from . import gendersub
|
||||
|
||||
|
||||
class TestGenderSub(CommandTest):
|
||||
class TestGenderSub(EvenniaCommandTest):
|
||||
def test_setgender(self):
|
||||
self.call(gendersub.SetGender(), "male", "Your gender was set to male.")
|
||||
self.call(gendersub.SetGender(), "ambiguous", "Your gender was set to ambiguous.")
|
||||
|
|
@ -22,7 +22,7 @@ class TestGenderSub(CommandTest):
|
|||
self.assertEqual(
|
||||
gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender"
|
||||
)
|
||||
with patch("evennia.contrib.game_systems.gendersub.DefaultCharacter.msg") as mock_msg:
|
||||
with patch("evennia.contrib.game_systems.gendersub.gendersub.DefaultCharacter.msg") as mock_msg:
|
||||
char.db.gender = "female"
|
||||
char.msg("Test |p gender")
|
||||
mock_msg.assert_called_with("Test her gender", from_obj=None, session=None)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ Test mail contrib
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import mail
|
||||
|
||||
|
||||
class TestMail(CommandTest):
|
||||
class TestMail(EvenniaCommandTest):
|
||||
def test_mail(self):
|
||||
self.call(mail.CmdMail(), "2", "'2' is not a valid mail id.", caller=self.account)
|
||||
self.call(mail.CmdMail(), "test", "'test' is not a valid mail id.", caller=self.account)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ Test multidescer contrib.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import multidescer
|
||||
|
||||
|
||||
class TestMultidescer(CommandTest):
|
||||
class TestMultidescer(EvenniaCommandTest):
|
||||
def test_cmdmultidesc(self):
|
||||
self.call(multidescer.CmdMultiDesc(), "/list", "Stored descs:\ncaller:")
|
||||
self.call(
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import re
|
|||
import itertools
|
||||
from mock import Mock
|
||||
from evennia.utils import search
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from . import puzzles
|
||||
|
||||
|
||||
class TestPuzzles(CommandTest):
|
||||
class TestPuzzles(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super(TestPuzzles, self).setUp()
|
||||
self.steel = create_object(self.object_typeclass, key="steel", location=self.char1.location)
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ Turnbattle tests.
|
|||
"""
|
||||
|
||||
from mock import patch, MagicMock
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.objects.objects import DefaultRoom
|
||||
from . import tb_basic, tb_equip, tb_range, tb_items, tb_magic
|
||||
|
||||
|
||||
class TestTurnBattleBasicCmd(CommandTest):
|
||||
class TestTurnBattleBasicCmd(EvenniaCommandTest):
|
||||
|
||||
# Test basic combat commands
|
||||
def test_turnbattlecmd(self):
|
||||
|
|
@ -22,7 +22,7 @@ class TestTurnBattleBasicCmd(CommandTest):
|
|||
self.call(tb_basic.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
class TestTurnBattleEquipCmd(CommandTest):
|
||||
class TestTurnBattleEquipCmd(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super(TestTurnBattleEquipCmd, self).setUp()
|
||||
self.testweapon = create_object(tb_equip.TBEWeapon, key="test weapon")
|
||||
|
|
@ -45,7 +45,7 @@ class TestTurnBattleEquipCmd(CommandTest):
|
|||
self.call(tb_equip.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
class TestTurnBattleRangeCmd(CommandTest):
|
||||
class TestTurnBattleRangeCmd(EvenniaCommandTest):
|
||||
# Test range commands
|
||||
def test_turnbattlerangecmd(self):
|
||||
# Start with range module specific commands.
|
||||
|
|
@ -61,7 +61,7 @@ class TestTurnBattleRangeCmd(CommandTest):
|
|||
self.call(tb_range.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
class TestTurnBattleItemsCmd(CommandTest):
|
||||
class TestTurnBattleItemsCmd(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super(TestTurnBattleItemsCmd, self).setUp()
|
||||
self.testitem = create_object(key="test item")
|
||||
|
|
@ -78,7 +78,7 @@ class TestTurnBattleItemsCmd(CommandTest):
|
|||
self.call(tb_items.CmdRest(), "", "Char rests to recover HP.")
|
||||
|
||||
|
||||
class TestTurnBattleMagicCmd(CommandTest):
|
||||
class TestTurnBattleMagicCmd(EvenniaCommandTest):
|
||||
|
||||
# Test magic commands
|
||||
def test_turnbattlemagiccmd(self):
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Testing of ExtendedRoom contrib
|
|||
import datetime
|
||||
from mock import patch, Mock
|
||||
from django.conf import settings
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.objects.objects import DefaultRoom
|
||||
from . import extended_room
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ class ForceUTCDatetime(datetime.datetime):
|
|||
@patch("evennia.contrib.grid.extended_room.extended_room.datetime.datetime", ForceUTCDatetime)
|
||||
# mock gametime to return April 9, 2064, at 21:06 (spring evening)
|
||||
@patch("evennia.utils.gametime.gametime", new=Mock(return_value=2975000766))
|
||||
class TestExtendedRoom(CommandTest):
|
||||
class TestExtendedRoom(EvenniaCommandTest):
|
||||
room_typeclass = extended_room.ExtendedRoom
|
||||
DETAIL_DESC = "A test detail."
|
||||
SPRING_DESC = "A spring description."
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Test map builder.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import mapbuilder
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
|
@ -187,7 +187,7 @@ EXAMPLE2_LEGEND = {
|
|||
}
|
||||
|
||||
|
||||
class TestMapBuilder(CommandTest):
|
||||
class TestMapBuilder(EvenniaCommandTest):
|
||||
def test_cmdmapbuilder(self):
|
||||
self.call(
|
||||
mapbuilder.CmdMapBuilder(),
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ Tests of simpledoor.
|
|||
"""
|
||||
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from . import simpledoor
|
||||
|
||||
|
||||
class TestSimpleDoor(CommandTest):
|
||||
class TestSimpleDoor(EvenniaCommandTest):
|
||||
def test_cmdopen(self):
|
||||
self.call(
|
||||
simpledoor.CmdOpen(),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Slow exit tests.
|
|||
"""
|
||||
|
||||
from mock import Mock, patch
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from . import slow_exit
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ def _cancellable_mockdelay(time, callback, *args, **kwargs):
|
|||
return Mock()
|
||||
|
||||
|
||||
class TestSlowExit(CommandTest):
|
||||
class TestSlowExit(EvenniaCommandTest):
|
||||
@patch("evennia.utils.delay", _cancellable_mockdelay)
|
||||
def test_exit(self):
|
||||
exi = create_object(
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ Testing of TestDice.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from mock import patch
|
||||
from . import dice
|
||||
|
||||
|
||||
@patch("evennia.contrib.dice.randint", return_value=5)
|
||||
class TestDice(CommandTest):
|
||||
@patch("evennia.contrib.rpg.dice.dice.randint", return_value=5)
|
||||
class TestDice(EvenniaCommandTest):
|
||||
def test_roll_dice(self, mocked_randint):
|
||||
self.assertEqual(dice.roll_dice(6, 6, modifier=("+", 4)), mocked_randint() * 6 + 4)
|
||||
self.assertEqual(dice.roll_dice(6, 6, conditional=("<", 35)), True)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Tests for RP system
|
|||
"""
|
||||
import time
|
||||
from anything import Anything
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia import create_object
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ class TestRPSystem(EvenniaTest):
|
|||
self.assertEqual(result, (Anything, self.speaker, self.speaker.key))
|
||||
|
||||
|
||||
class TestRPSystemCommands(CommandTest):
|
||||
class TestRPSystemCommands(EvenniaCommandTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.char1.swap_typeclass(rpsystem.ContribRPCharacter)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Unit test module for Trait classes.
|
|||
from copy import copy
|
||||
from anything import Something
|
||||
from mock import MagicMock, patch
|
||||
from django.test import TestCase
|
||||
from evennia.utils.test_resources import EvenniaTestCase
|
||||
from . import traits
|
||||
|
||||
|
||||
|
|
@ -39,10 +39,10 @@ _TEST_TRAIT_CLASS_PATHS = [
|
|||
]
|
||||
|
||||
|
||||
class _TraitHandlerBase(TestCase):
|
||||
class _TraitHandlerBase(EvenniaTestCase):
|
||||
"Base for trait tests"
|
||||
|
||||
@patch("evennia.contrib.rpg.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||
@patch("evennia.contrib.rpg.traits.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||
def setUp(self):
|
||||
self.obj = _MockObj()
|
||||
self.traithandler = traits.TraitHandler(self.obj)
|
||||
|
|
@ -494,7 +494,7 @@ class TestTraitCounterTimed(_TraitHandlerBase):
|
|||
Test for trait with timer component
|
||||
"""
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.time", new=MagicMock(return_value=1000))
|
||||
@patch("evennia.contrib.rpg.traits.traits.time", new=MagicMock(return_value=1000))
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.traithandler.add(
|
||||
|
|
@ -522,7 +522,7 @@ class TestTraitCounterTimed(_TraitHandlerBase):
|
|||
self.trait.ratetarget,
|
||||
)
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.time")
|
||||
@patch("evennia.contrib.rpg.traits.traits.time")
|
||||
def test_timer_rate(self, mock_time):
|
||||
"""Test time stepping"""
|
||||
mock_time.return_value = 1000
|
||||
|
|
@ -549,7 +549,7 @@ class TestTraitCounterTimed(_TraitHandlerBase):
|
|||
mock_time.return_value = 1218
|
||||
self.assertEqual(self._get_timer_data(), (0, -2, -10, None, None))
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.time")
|
||||
@patch("evennia.contrib.rpg.traits.traits.time")
|
||||
def test_timer_ratetarget(self, mock_time):
|
||||
"""test ratetarget"""
|
||||
mock_time.return_value = 1000
|
||||
|
|
@ -751,7 +751,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
|||
Test for trait with timer component
|
||||
"""
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.time", new=MagicMock(return_value=1000))
|
||||
@patch("evennia.contrib.rpg.traits.traits.time", new=MagicMock(return_value=1000))
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.traithandler.add(
|
||||
|
|
@ -778,7 +778,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
|||
self.trait.ratetarget,
|
||||
)
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.time")
|
||||
@patch("evennia.contrib.rpg.traits.traits.time")
|
||||
def test_timer_rate(self, mock_time):
|
||||
"""Test time stepping"""
|
||||
mock_time.return_value = 1000
|
||||
|
|
@ -806,7 +806,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
|||
mock_time.return_value = 1218
|
||||
self.assertEqual(self._get_timer_data(), (0, 0, -10, None, None))
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.time")
|
||||
@patch("evennia.contrib.rpg.traits.traits.time")
|
||||
def test_timer_ratetarget(self, mock_time):
|
||||
"""test ratetarget"""
|
||||
mock_time.return_value = 1000
|
||||
|
|
@ -826,7 +826,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
|||
self.assertEqual(self._get_timer_data(), (70, 70, 1, None, 70))
|
||||
|
||||
|
||||
class TestNumericTraitOperators(TestCase):
|
||||
class TestNumericTraitOperators(EvenniaTestCase):
|
||||
"""Test case for numeric magic method implementations."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -909,13 +909,13 @@ class DummyCharacter(_MockObj):
|
|||
health = traits.TraitProperty("Health value", trait_type="gauge", base=100)
|
||||
|
||||
|
||||
class TestTraitFields(TestCase):
|
||||
class TestTraitFields(EvenniaTestCase):
|
||||
"""
|
||||
Test the TraitField class.
|
||||
|
||||
"""
|
||||
|
||||
@patch("evennia.contrib.rpg.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||
@patch("evennia.contrib.rpg.traits.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||
def test_traitfields(self):
|
||||
obj = DummyCharacter()
|
||||
obj2 = DummyCharacter()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from evennia.utils.test_resources import EvenniaTest
|
|||
from .bodyfunctions import BodyFunctions
|
||||
|
||||
|
||||
@patch("evennia.contrib.tutorials.bodyfunctions.random")
|
||||
@patch("evennia.contrib.tutorials.bodyfunctions.bodyfunctions.random")
|
||||
class TestBodyFunctions(EvenniaTest):
|
||||
script_typeclass = BodyFunctions
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
Tutorial - talking NPC tests.
|
||||
|
||||
"""
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from . import talking_npc
|
||||
|
||||
|
||||
class TestTalkingNPC(CommandTest):
|
||||
class TestTalkingNPC(EvenniaCommandTest):
|
||||
def test_talkingnpc(self):
|
||||
npc = create_object(talking_npc.TalkingNPC, key="npctalker", location=self.room1)
|
||||
self.call(talking_npc.CmdTalk(), "", "(You walk up and talk to Char.)")
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ Tutorial world - Griatch, 2011, 2015
|
|||
|
||||
"""
|
||||
|
||||
from . import mob, objects, rooms # noqa
|
||||
from . import mob, objects, rooms, intro_menu # noqa
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Test tutorial_world/mob
|
|||
from mock import patch
|
||||
from twisted.trial.unittest import TestCase as TwistedTestCase
|
||||
from twisted.internet.base import DelayedCall
|
||||
from evennia.commands.default.tests import CommandTest
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.utils.test_resources import EvenniaTest, mockdelay, mockdeferLater
|
||||
from . import mob, objects as tutobjects, rooms as tutrooms
|
||||
|
|
@ -30,7 +30,7 @@ class TestTutorialWorldMob(EvenniaTest):
|
|||
DelayedCall.debug = True
|
||||
|
||||
|
||||
class TestTutorialWorldObjects(TwistedTestCase, CommandTest):
|
||||
class TestTutorialWorldObjects(TwistedTestCase, EvenniaCommandTest):
|
||||
def test_tutorialobj(self):
|
||||
obj1 = create_object(tutobjects.TutorialObject, key="tutobj")
|
||||
obj1.reset()
|
||||
|
|
@ -129,7 +129,7 @@ class TestTutorialWorldObjects(TwistedTestCase, CommandTest):
|
|||
self.call(tutobjects.CmdGetWeapon(), "", "You find Rusty sword.", obj=rack)
|
||||
|
||||
|
||||
class TestTutorialWorldRooms(CommandTest):
|
||||
class TestTutorialWorldRooms(EvenniaCommandTest):
|
||||
def test_cmdtutorial(self):
|
||||
room = create_object(tutrooms.TutorialRoom, key="tutroom")
|
||||
self.char1.location = room
|
||||
|
|
|
|||
|
|
@ -4,20 +4,16 @@ Module containing the test cases for the Audit system.
|
|||
"""
|
||||
|
||||
from anything import Anything
|
||||
from django.conf import settings
|
||||
from django.test import override_settings
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
import re
|
||||
|
||||
# Configure session auditing settings - TODO: This is bad practice that leaks over to other tests
|
||||
settings.AUDIT_CALLBACK = "evennia.contrib.utils.auditing.outputs.to_syslog"
|
||||
settings.AUDIT_IN = True
|
||||
settings.AUDIT_OUT = True
|
||||
settings.AUDIT_ALLOW_SPARSE = True
|
||||
|
||||
# Configure settings to use custom session - TODO: This is bad practice, changing global settings
|
||||
settings.SERVER_SESSION_CLASS = "evennia.contrib.utils.auditing.server.AuditedServerSession"
|
||||
|
||||
|
||||
@override_settings(
|
||||
AUDIT_CALLBACK="evennia.contrib.utils.auditing.outputs.to_syslog",
|
||||
AUDIT_IN=True,
|
||||
AUDIT_OUT=True,
|
||||
AUDIT_ALLOW_SPARSE=True)
|
||||
class AuditingTest(EvenniaTest):
|
||||
def test_mask(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,3 +4,5 @@ Pseudo-random generator - vlgeoff 2017
|
|||
"""
|
||||
|
||||
from .random_string_generator import RandomStringGenerator # noqa
|
||||
from .random_string_generator import RandomStringGeneratorScript # noqa
|
||||
from .random_string_generator import RejectedRegex, ExhaustedGenerator # noqa
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Random string tests.
|
|||
"""
|
||||
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.contrib import random_string_generator
|
||||
from . import random_string_generator
|
||||
|
||||
SIMPLE_GENERATOR = random_string_generator.RandomStringGenerator("simple", "[01]{2}")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ Test tree select
|
|||
"""
|
||||
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.contrib import tree_select
|
||||
from evennia.contrib import fieldfill
|
||||
from . import tree_select
|
||||
from evennia.contrib.utils.fieldfill import fieldfill
|
||||
|
||||
TREE_MENU_TESTSTR = """Foo
|
||||
Bar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue