Clean up all test suites
This commit is contained in:
parent
0f3b96886c
commit
19f920b6d4
41 changed files with 237 additions and 169 deletions
|
|
@ -4,11 +4,11 @@ Test Color markup.
|
|||
"""
|
||||
|
||||
import re
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import color_markups
|
||||
|
||||
|
||||
class TestColorMarkup(EvenniaTest):
|
||||
class TestColorMarkup(BaseEvenniaTest):
|
||||
"""
|
||||
Note: Normally this would be tested by importing the ansi parser and run
|
||||
the mappings through it. This is not possible since the ansi module creates
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Testing custom game time
|
|||
|
||||
# Testing custom_gametime
|
||||
from mock import Mock, patch
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from .. import custom_gametime
|
||||
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ def _testcallback():
|
|||
|
||||
|
||||
@patch("evennia.utils.gametime.gametime", new=Mock(return_value=2975000898.46))
|
||||
class TestCustomGameTime(EvenniaTest):
|
||||
class TestCustomGameTime(BaseEvenniaTest):
|
||||
def tearDown(self):
|
||||
if hasattr(self, "timescript"):
|
||||
self.timescript.stop()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ 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
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from .commands import CmdCallback
|
||||
from .callbackhandler import CallbackHandler
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ settings.EVENTS_CALENDAR = "standard"
|
|||
OLD_EVENTS = {}
|
||||
|
||||
|
||||
class TestEventHandler(EvenniaTest):
|
||||
class TestEventHandler(BaseEvenniaTest):
|
||||
|
||||
"""
|
||||
Test cases of the event handler to add, edit or delete events.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import pkgutil
|
|||
from os import path
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia import InterruptCommand
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from evennia.utils import mod_import
|
||||
from . import commands
|
||||
from . import state as basestate
|
||||
|
|
@ -191,7 +191,7 @@ class TestEvscaperoomCommands(EvenniaCommandTest):
|
|||
self.call(commands.CmdFocusInteraction(), "", "Hm?")
|
||||
|
||||
|
||||
class TestUtils(EvenniaTest):
|
||||
class TestUtils(BaseEvenniaTest):
|
||||
def test_overwrite(self):
|
||||
room = utils.create_evscaperoom_object("evscaperoom.room.EvscapeRoom", key="Testroom")
|
||||
obj1 = utils.create_evscaperoom_object(
|
||||
|
|
@ -227,7 +227,7 @@ class TestUtils(EvenniaTest):
|
|||
self.assertEqual(utils.parse_for_things(string, 2), "Looking at |y[book]|n and |y[key]|n.")
|
||||
|
||||
|
||||
class TestEvScapeRoom(EvenniaTest):
|
||||
class TestEvScapeRoom(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.room = utils.create_evscaperoom_object(
|
||||
|
|
@ -256,7 +256,7 @@ class TestEvScapeRoom(EvenniaTest):
|
|||
self.assertEqual(self.char1.tags.get(category=self.roomtag), None)
|
||||
|
||||
|
||||
class TestStates(EvenniaTest):
|
||||
class TestStates(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.room = utils.create_evscaperoom_object(
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@ Clothing contrib - Tim Ashley Jenkins 2017
|
|||
|
||||
from .clothing import ClothedCharacter # noqa
|
||||
from .clothing import ClothedCharacterCmdSet # noqa
|
||||
from .clothing import ContribClothing # noqa
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ game's commands/default_cmdsets.py:
|
|||
From here, you can use the default builder commands to create clothes
|
||||
with which to test the system:
|
||||
|
||||
@create a pretty shirt : evennia.contrib.game_systems.clothing.Clothing
|
||||
@create a pretty shirt : evennia.contrib.game_systems.clothing.ContribClothing
|
||||
@set shirt/clothing_type = 'top'
|
||||
wear shirt
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ from evennia.utils import evtable
|
|||
# Maximum character length of 'wear style' strings, or None for unlimited.
|
||||
WEARSTYLE_MAXLENGTH = 50
|
||||
|
||||
# The rest of these options have to do with clothing types. Clothing types are optional,
|
||||
# The rest of these options have to do with clothing types. ContribClothing types are optional,
|
||||
# but can be used to give better control over how different items of clothing behave. You
|
||||
# can freely add, remove, or change clothing types to suit the needs of your game and use
|
||||
# the options below to affect their behavior.
|
||||
|
|
@ -228,7 +228,7 @@ def single_type_count(clothes_list, type):
|
|||
return type_count
|
||||
|
||||
|
||||
class Clothing(DefaultObject):
|
||||
class ContribClothing(DefaultObject):
|
||||
def wear(self, wearer, wearstyle, quiet=False):
|
||||
"""
|
||||
Sets clothes to 'worn' and optionally echoes to the room.
|
||||
|
|
@ -389,7 +389,7 @@ class CmdWear(MuxCommand):
|
|||
if not clothing:
|
||||
self.caller.msg("Thing to wear must be in your inventory.")
|
||||
return
|
||||
if not clothing.is_typeclass("evennia.contrib.game_systems.clothing.Clothing", exact=False):
|
||||
if not clothing.is_typeclass(ContribClothing, exact=False):
|
||||
self.caller.msg("That's not clothes!")
|
||||
return
|
||||
|
||||
|
|
@ -492,10 +492,10 @@ class CmdCover(MuxCommand):
|
|||
cover_with = self.caller.search(self.arglist[1], candidates=self.caller.contents)
|
||||
if not to_cover or not cover_with:
|
||||
return
|
||||
if not to_cover.is_typeclass("evennia.contrib.game_systems.clothing.Clothing", exact=False):
|
||||
if not to_cover.is_typeclass(ContribClothing, exact=False):
|
||||
self.caller.msg("%s isn't clothes!" % to_cover.name)
|
||||
return
|
||||
if not cover_with.is_typeclass("evennia.contrib.game_systems.clothing.Clothing", exact=False):
|
||||
if not cover_with.is_typeclass(ContribClothing, exact=False):
|
||||
self.caller.msg("%s isn't clothes!" % cover_with.name)
|
||||
return
|
||||
if cover_with.db.clothing_type:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Testing clothing contrib
|
|||
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 evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import clothing
|
||||
|
||||
|
||||
|
|
@ -18,11 +18,11 @@ class TestClothingCmd(EvenniaCommandTest):
|
|||
wearer.location = room
|
||||
friend.location = room
|
||||
# Make a test hat
|
||||
test_hat = create_object(clothing.Clothing, key="test hat")
|
||||
test_hat = create_object(clothing.ContribClothing, key="test hat")
|
||||
test_hat.db.clothing_type = "hat"
|
||||
test_hat.location = wearer
|
||||
# Make a test scarf
|
||||
test_scarf = create_object(clothing.Clothing, key="test scarf")
|
||||
test_scarf = create_object(clothing.ContribClothing, key="test scarf")
|
||||
test_scarf.db.clothing_type = "accessory"
|
||||
test_scarf.location = wearer
|
||||
# Test wear command
|
||||
|
|
@ -89,21 +89,21 @@ class TestClothingCmd(EvenniaCommandTest):
|
|||
)
|
||||
|
||||
|
||||
class TestClothingFunc(EvenniaTest):
|
||||
class TestClothingFunc(BaseEvenniaTest):
|
||||
def test_clothingfunctions(self):
|
||||
wearer = create_object(clothing.ClothedCharacter, key="Wearer")
|
||||
room = create_object(DefaultRoom, key="room")
|
||||
wearer.location = room
|
||||
# Make a test hat
|
||||
test_hat = create_object(clothing.Clothing, key="test hat")
|
||||
test_hat = create_object(clothing.ContribClothing, key="test hat")
|
||||
test_hat.db.clothing_type = "hat"
|
||||
test_hat.location = wearer
|
||||
# Make a test shirt
|
||||
test_shirt = create_object(clothing.Clothing, key="test shirt")
|
||||
test_shirt = create_object(clothing.ContribClothing, key="test shirt")
|
||||
test_shirt.db.clothing_type = "top"
|
||||
test_shirt.location = wearer
|
||||
# Make a test pants
|
||||
test_pants = create_object(clothing.Clothing, key="test pants")
|
||||
test_pants = create_object(clothing.ContribClothing, key="test pants")
|
||||
test_pants.db.clothing_type = "bottom"
|
||||
test_pants.location = wearer
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ Cooldowns tests.
|
|||
"""
|
||||
|
||||
from mock import patch
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import cooldowns
|
||||
|
||||
|
||||
@patch("evennia.contrib.game_systems.cooldowns.cooldowns.time.time", return_value=0.0)
|
||||
class TestCooldowns(EvenniaTest):
|
||||
class TestCooldowns(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.handler = cooldowns.CooldownHandler(self.char1)
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ from unittest import mock
|
|||
from django.test import override_settings
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.test_resources import EvenniaTestCase
|
||||
from evennia.utils.test_resources import BaseEvenniaTestCase
|
||||
from evennia.utils.create import create_object
|
||||
from . import crafting, example_recipes
|
||||
|
||||
|
||||
class TestCraftUtils(EvenniaTestCase):
|
||||
class TestCraftUtils(BaseEvenniaTestCase):
|
||||
"""
|
||||
Test helper utils for crafting.
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class _TestMaterial:
|
|||
return self.name
|
||||
|
||||
|
||||
class TestCraftingRecipeBase(EvenniaTestCase):
|
||||
class TestCraftingRecipeBase(BaseEvenniaTestCase):
|
||||
"""
|
||||
Test the parent recipe class.
|
||||
"""
|
||||
|
|
@ -137,7 +137,7 @@ class _MockRecipe(crafting.CraftingRecipe):
|
|||
|
||||
|
||||
@override_settings(CRAFT_RECIPE_MODULES=[])
|
||||
class TestCraftingRecipe(EvenniaTestCase):
|
||||
class TestCraftingRecipe(BaseEvenniaTestCase):
|
||||
"""
|
||||
Test the CraftingRecipe class with one recipe
|
||||
"""
|
||||
|
|
@ -474,7 +474,7 @@ class TestCraftingRecipe(EvenniaTestCase):
|
|||
self.assertIsNotNone(self.tool2.pk)
|
||||
|
||||
|
||||
class TestCraftSword(EvenniaTestCase):
|
||||
class TestCraftSword(BaseEvenniaTestCase):
|
||||
"""
|
||||
Test the `craft` function by crafting the example sword.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Turnbattle tests.
|
|||
from mock import patch, MagicMock
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from evennia.objects.objects import DefaultRoom
|
||||
from . import tb_basic, tb_equip, tb_range, tb_items, tb_magic
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ class TestTurnBattleMagicCmd(EvenniaCommandTest):
|
|||
self.call(tb_magic.CmdRest(), "", "Char rests to recover HP and MP.")
|
||||
|
||||
|
||||
class TestTurnBattleBasicFunc(EvenniaTest):
|
||||
class TestTurnBattleBasicFunc(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super(TestTurnBattleBasicFunc, self).setUp()
|
||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||
|
|
@ -186,7 +186,7 @@ class TestTurnBattleBasicFunc(EvenniaTest):
|
|||
self.assertTrue(self.turnhandler.db.fighters == [self.joiner, self.attacker, self.defender])
|
||||
|
||||
|
||||
class TestTurnBattleEquipFunc(EvenniaTest):
|
||||
class TestTurnBattleEquipFunc(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super(TestTurnBattleEquipFunc, self).setUp()
|
||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||
|
|
@ -278,7 +278,7 @@ class TestTurnBattleEquipFunc(EvenniaTest):
|
|||
self.assertTrue(self.turnhandler.db.fighters == [self.joiner, self.attacker, self.defender])
|
||||
|
||||
|
||||
class TestTurnBattleRangeFunc(EvenniaTest):
|
||||
class TestTurnBattleRangeFunc(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super(TestTurnBattleRangeFunc, self).setUp()
|
||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||
|
|
@ -387,7 +387,7 @@ class TestTurnBattleRangeFunc(EvenniaTest):
|
|||
self.assertTrue(tb_range.get_range(self.attacker, self.defender) == 1)
|
||||
|
||||
|
||||
class TestTurnBattleItemsFunc(EvenniaTest):
|
||||
class TestTurnBattleItemsFunc(BaseEvenniaTest):
|
||||
@patch("evennia.contrib.game_systems.turnbattle.tb_items.tickerhandler", new=MagicMock())
|
||||
def setUp(self):
|
||||
super(TestTurnBattleItemsFunc, self).setUp()
|
||||
|
|
@ -511,7 +511,7 @@ class TestTurnBattleItemsFunc(EvenniaTest):
|
|||
self.assertTrue(self.user.db.conditions == {})
|
||||
|
||||
|
||||
class TestTurnBattleMagicFunc(EvenniaTest):
|
||||
class TestTurnBattleMagicFunc(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super(TestTurnBattleMagicFunc, self).setUp()
|
||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ Test wilderness
|
|||
|
||||
"""
|
||||
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from evennia import DefaultCharacter
|
||||
from evennia.utils.create import create_object
|
||||
from . import wilderness
|
||||
|
||||
|
||||
class TestWilderness(EvenniaTest):
|
||||
class TestWilderness(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.char1 = create_object(DefaultCharacter, key="char1")
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Tests for the XYZgrid system.
|
|||
from random import randint
|
||||
from parameterized import parameterized
|
||||
from django.test import TestCase
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import xymap, xyzgrid, xymap_legend, xyzroom
|
||||
|
||||
|
||||
|
|
@ -340,7 +340,7 @@ MAP12b = r"""
|
|||
"""
|
||||
|
||||
|
||||
class _MapTest(EvenniaTest):
|
||||
class _MapTest(BaseEvenniaTest):
|
||||
"""
|
||||
Parent for map tests
|
||||
|
||||
|
|
@ -1147,7 +1147,7 @@ class TestMapStressTest(TestCase):
|
|||
# f"slower than expected {max_time}s.")
|
||||
|
||||
|
||||
class TestXYZGrid(EvenniaTest):
|
||||
class TestXYZGrid(BaseEvenniaTest):
|
||||
"""
|
||||
Test base grid class with a single map, including spawning objects.
|
||||
|
||||
|
|
@ -1196,7 +1196,7 @@ class Map12bTransition(xymap_legend.TransitionMapNode):
|
|||
target_map_xyz = (0, 1, "map12a")
|
||||
|
||||
|
||||
class TestXYZGridTransition(EvenniaTest):
|
||||
class TestXYZGridTransition(BaseEvenniaTest):
|
||||
"""
|
||||
Test the XYZGrid class and transitions between maps.
|
||||
|
||||
|
|
@ -1254,7 +1254,7 @@ class TestXYZGridTransition(EvenniaTest):
|
|||
self.assertEqual(west_exit.db_destination, room1)
|
||||
|
||||
|
||||
class TestBuildExampleGrid(EvenniaTest):
|
||||
class TestBuildExampleGrid(BaseEvenniaTest):
|
||||
"""
|
||||
Test building the map-example (this takes about 30s)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ Test health bar contrib
|
|||
|
||||
"""
|
||||
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import health_bar
|
||||
|
||||
|
||||
class TestHealthBar(EvenniaTest):
|
||||
class TestHealthBar(BaseEvenniaTest):
|
||||
def test_healthbar(self):
|
||||
expected_bar_str = "|[R|w|n|[B|w test0 / 200test |n"
|
||||
self.assertEqual(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Tests for RP system
|
|||
import time
|
||||
from anything import Anything
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from evennia import create_object
|
||||
|
||||
from . import rpsystem
|
||||
|
|
@ -21,7 +21,7 @@ text = (
|
|||
)
|
||||
|
||||
|
||||
class TestLanguage(EvenniaTest):
|
||||
class TestLanguage(BaseEvenniaTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
rplanguage.add_language(
|
||||
|
|
@ -99,7 +99,7 @@ emote = 'With a flair, /me looks at /first and /colliding sdesc-guy. She says "T
|
|||
case_emote = "/me looks at /first, then /FIRST, /First and /Colliding twice."
|
||||
|
||||
|
||||
class TestRPSystem(EvenniaTest):
|
||||
class TestRPSystem(BaseEvenniaTest):
|
||||
maxDiff = None
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Unit test module for Trait classes.
|
|||
from copy import copy
|
||||
from anything import Something
|
||||
from mock import MagicMock, patch
|
||||
from evennia.utils.test_resources import EvenniaTestCase
|
||||
from evennia.utils.test_resources import BaseEvenniaTestCase
|
||||
from . import traits
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ _TEST_TRAIT_CLASS_PATHS = [
|
|||
]
|
||||
|
||||
|
||||
class _TraitHandlerBase(EvenniaTestCase):
|
||||
class _TraitHandlerBase(BaseEvenniaTestCase):
|
||||
"Base for trait tests"
|
||||
|
||||
@patch("evennia.contrib.rpg.traits.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||
|
|
@ -826,7 +826,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
|||
self.assertEqual(self._get_timer_data(), (70, 70, 1, None, 70))
|
||||
|
||||
|
||||
class TestNumericTraitOperators(EvenniaTestCase):
|
||||
class TestNumericTraitOperators(BaseEvenniaTestCase):
|
||||
"""Test case for numeric magic method implementations."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -909,7 +909,7 @@ class DummyCharacter(_MockObj):
|
|||
health = traits.TraitProperty("Health value", trait_type="gauge", base=100)
|
||||
|
||||
|
||||
class TestTraitFields(EvenniaTestCase):
|
||||
class TestTraitFields(BaseEvenniaTestCase):
|
||||
"""
|
||||
Test the TraitField class.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ Tests for the bodyfunctions.
|
|||
|
||||
"""
|
||||
from mock import Mock, patch
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from .bodyfunctions import BodyFunctions
|
||||
|
||||
|
||||
@patch("evennia.contrib.tutorials.bodyfunctions.bodyfunctions.random")
|
||||
class TestBodyFunctions(EvenniaTest):
|
||||
class TestBodyFunctions(BaseEvenniaTest):
|
||||
script_typeclass = BodyFunctions
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ def info2(caller):
|
|||
|
||||
|
||||
def info3(caller):
|
||||
text = "'Well ... I'm sort of busy so, have to go. NPC business. Important stuff. You wouldn't understand.'"
|
||||
text = ("'Well ... I'm sort of busy so, have to go. NPC business. "
|
||||
"Important stuff. You wouldn't understand.'")
|
||||
|
||||
options = (
|
||||
{"desc": "Oookay ... I won't keep you. Bye.", "goto": "END"},
|
||||
|
|
@ -112,7 +113,8 @@ class CmdTalk(default_cmds.MuxCommand):
|
|||
|
||||
# Initiate the menu. Change this if you are putting this on
|
||||
# some other custom NPC class.
|
||||
EvMenu(self.caller, "evennia.contrib.tutorials.talking_npc", startnode="menu_start_node")
|
||||
EvMenu(self.caller, "evennia.contrib.tutorials.talking_npc.talking_npc",
|
||||
startnode="menu_start_node")
|
||||
|
||||
|
||||
class TalkingCmdSet(CmdSet):
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ from twisted.trial.unittest import TestCase as TwistedTestCase
|
|||
from twisted.internet.base import DelayedCall
|
||||
from evennia.commands.default.tests import EvenniaCommandTest
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.utils.test_resources import EvenniaTest, mockdelay, mockdeferLater
|
||||
from evennia.utils.test_resources import BaseEvenniaTest, mockdelay, mockdeferLater
|
||||
from . import mob, objects as tutobjects, rooms as tutrooms
|
||||
|
||||
|
||||
class TestTutorialWorldMob(EvenniaTest):
|
||||
class TestTutorialWorldMob(BaseEvenniaTest):
|
||||
def test_mob(self):
|
||||
mobobj = create_object(mob.Mob, key="mob")
|
||||
self.assertEqual(mobobj.db.is_dead, True)
|
||||
|
|
|
|||
|
|
@ -4,17 +4,36 @@ Module containing the test cases for the Audit system.
|
|||
"""
|
||||
|
||||
from anything import Anything
|
||||
from mock import patch
|
||||
from django.test import override_settings
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
import re
|
||||
from .server import AuditedServerSession
|
||||
from evennia.server.sessionhandler import SESSIONS
|
||||
|
||||
|
||||
@override_settings(
|
||||
AUDIT_CALLBACK="evennia.contrib.utils.auditing.outputs.to_syslog",
|
||||
AUDIT_IN=True,
|
||||
AUDIT_OUT=True,
|
||||
AUDIT_ALLOW_SPARSE=True)
|
||||
class AuditingTest(EvenniaTest):
|
||||
AUDIT_MASKS=[])
|
||||
class AuditingTest(BaseEvenniaTest):
|
||||
|
||||
@patch("evennia.server.sessionhandler._ServerSession", AuditedServerSession)
|
||||
def setup_session(self):
|
||||
"""Overrides default one in EvenniaTest"""
|
||||
dummysession = AuditedServerSession()
|
||||
dummysession.init_session("telnet", ("localhost", "testmode"), SESSIONS)
|
||||
dummysession.sessid = 1
|
||||
SESSIONS.portal_connect(
|
||||
dummysession.get_sync_data()
|
||||
) # note that this creates a new Session!
|
||||
session = SESSIONS.session_from_sessid(1) # the real session
|
||||
SESSIONS.login(session, self.account, testmode=True)
|
||||
self.session = session
|
||||
print("session", type(self.session), self.session)
|
||||
|
||||
@patch("evennia.contrib.utils.auditing.server.AUDIT_CALLBACK",
|
||||
"evennia.contrib.utils.auditing.outputs.to_syslog")
|
||||
@patch("evennia.contrib.utils.auditing.server.AUDIT_IN", True)
|
||||
@patch("evennia.contrib.utils.auditing.server.AUDIT_OUT", True)
|
||||
def test_mask(self):
|
||||
"""
|
||||
Make sure the 'mask' function is properly masking potentially sensitive
|
||||
|
|
@ -82,6 +101,10 @@ class AuditingTest(EvenniaTest):
|
|||
for secret in secrets:
|
||||
self.assertEqual(self.session.mask(secret), secret)
|
||||
|
||||
@patch("evennia.contrib.utils.auditing.server.AUDIT_CALLBACK",
|
||||
"evennia.contrib.utils.auditing.outputs.to_syslog")
|
||||
@patch("evennia.contrib.utils.auditing.server.AUDIT_IN", True)
|
||||
@patch("evennia.contrib.utils.auditing.server.AUDIT_OUT", True)
|
||||
def test_audit(self):
|
||||
"""
|
||||
Make sure the 'audit' function is returning a dictionary based on values
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ Random string tests.
|
|||
|
||||
"""
|
||||
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import random_string_generator
|
||||
|
||||
SIMPLE_GENERATOR = random_string_generator.RandomStringGenerator("simple", "[01]{2}")
|
||||
|
||||
|
||||
class TestRandomStringGenerator(EvenniaTest):
|
||||
class TestRandomStringGenerator(BaseEvenniaTest):
|
||||
def test_generate(self):
|
||||
"""Generate and fail when exhausted."""
|
||||
generated = []
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Test tree select
|
|||
|
||||
"""
|
||||
|
||||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia.utils.test_resources import BaseEvenniaTest
|
||||
from . import tree_select
|
||||
from evennia.contrib.utils.fieldfill import fieldfill
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ Bar
|
|||
-Qux"""
|
||||
|
||||
|
||||
class TestTreeSelectFunc(EvenniaTest):
|
||||
class TestTreeSelectFunc(BaseEvenniaTest):
|
||||
def test_tree_functions(self):
|
||||
# Dash counter
|
||||
self.assertTrue(tree_select.dashcount("--test") == 2)
|
||||
|
|
@ -57,6 +57,6 @@ FIELD_TEST_TEMPLATE = [
|
|||
FIELD_TEST_DATA = {"TextTest": None, "NumberTest": None, "DefaultText": "Test", "DefaultNum": 3}
|
||||
|
||||
|
||||
class TestFieldFillFunc(EvenniaTest):
|
||||
class TestFieldFillFunc(BaseEvenniaTest):
|
||||
def test_field_functions(self):
|
||||
self.assertTrue(fieldfill.form_template_to_dict(FIELD_TEST_TEMPLATE) == FIELD_TEST_DATA)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue