A WIP Evennia escape room themed MUD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
1.5 KiB

'''
Tests for Room
'''
from evennia.utils.test_resources import EvenniaTest
from evennia import create_object
from typeclasses import rooms, objects
import re
class TestRoom(EvenniaTest):
'Tests for Room'
def setUp(self):
'''
Create Test Room, place objects in it, and move Char 1 to it
'''
super().setUp()
self.test_room = create_object(rooms.Room, key='Test Room')
self.giant_stone = create_object(objects.ImmovableObject, key='a giant stone',
location=self.test_room, aliases=['stone'])
self.giant_stone.locks.add('get:none()')
self.giant_stone.db.get_err_msg = "You can't possibly lift this"
self.bobble = create_object(objects.Object, key='a bobble',
location=self.test_room, aliases=['bobble'])
self.bobble.db.desc = "A bobble that you can carry"
self.char1.location = self.test_room
self.char2.name = 'John'
self.char2.location = self.test_room
self.char2.account.is_connected = True
def test_return_appearance_when_admin(self):
'Should return output containing "Admin only:"'
self.assertIn('Admin only:', self.test_room.return_appearance(self.char1))
def test_return_appearance_when_not_admin(self):
'Admin only output is not present when user is not an admin'
self.char1.account.permissions.remove('Developer')
self.assertIsNone(re.search(r'Admin only', self.test_room.return_appearance(self.char1)))