Work to merge develop and resolve unit tests
This commit is contained in:
parent
981119b640
commit
585cca90ae
4 changed files with 339 additions and 333 deletions
|
|
@ -115,7 +115,7 @@ class TestDefaultAccountAuth(EvenniaTest):
|
||||||
|
|
||||||
def test_throttle(self):
|
def test_throttle(self):
|
||||||
"Confirm throttle activates on too many failures."
|
"Confirm throttle activates on too many failures."
|
||||||
for x in xrange(20):
|
for x in range(20):
|
||||||
obj, errors = DefaultAccount.authenticate(self.account.name, 'xyzzy', ip='12.24.36.48')
|
obj, errors = DefaultAccount.authenticate(self.account.name, 'xyzzy', ip='12.24.36.48')
|
||||||
self.assertFalse(obj, 'Authentication was provided a bogus password; this should NOT have returned an account!')
|
self.assertFalse(obj, 'Authentication was provided a bogus password; this should NOT have returned an account!')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@ from django.test import TestCase
|
||||||
from mock import Mock, patch, mock_open
|
from mock import Mock, patch, mock_open
|
||||||
from .dummyrunner_settings import (c_creates_button, c_creates_obj, c_digs, c_examines, c_help, c_idles, c_login,
|
from .dummyrunner_settings import (c_creates_button, c_creates_obj, c_digs, c_examines, c_help, c_idles, c_login,
|
||||||
c_login_nodig, c_logout, c_looks, c_moves, c_moves_n, c_moves_s, c_socialize)
|
c_login_nodig, c_logout, c_looks, c_moves, c_moves_n, c_moves_s, c_socialize)
|
||||||
|
|
||||||
|
try:
|
||||||
import memplot
|
import memplot
|
||||||
|
except ImportError:
|
||||||
|
memplot = Mock()
|
||||||
|
|
||||||
|
|
||||||
class TestDummyrunnerSettings(TestCase):
|
class TestDummyrunnerSettings(TestCase):
|
||||||
|
|
@ -100,6 +104,8 @@ class TestMemPlot(TestCase):
|
||||||
@patch.object(memplot, "open", new_callable=mock_open, create=True)
|
@patch.object(memplot, "open", new_callable=mock_open, create=True)
|
||||||
@patch.object(memplot, "time")
|
@patch.object(memplot, "time")
|
||||||
def test_memplot(self, mock_time, mocked_open, mocked_os, mocked_idmapper):
|
def test_memplot(self, mock_time, mocked_open, mocked_os, mocked_idmapper):
|
||||||
|
if isinstance(memplot, Mock):
|
||||||
|
return
|
||||||
from evennia.utils.create import create_script
|
from evennia.utils.create import create_script
|
||||||
mocked_idmapper.cache_size.return_value = (9, 5000)
|
mocked_idmapper.cache_size.return_value = (9, 5000)
|
||||||
mock_time.time = Mock(return_value=6000.0)
|
mock_time.time = Mock(return_value=6000.0)
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,8 @@ class CharacterDeleteView(EvenniaWebTest):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# Make sure it deleted
|
# Make sure it deleted
|
||||||
self.assertFalse(self.char1 in self.account.db._playable_characters, 'Char1 is still in Account playable characters list.')
|
self.assertFalse(self.char1 in self.account.db._playable_characters,
|
||||||
|
'Char1 is still in Account playable characters list.')
|
||||||
|
|
||||||
def test_invalid_access(self):
|
def test_invalid_access(self):
|
||||||
"Account1 should not be able to delete Account2:Char2"
|
"Account1 should not be able to delete Account2:Char2"
|
||||||
|
|
@ -278,4 +279,3 @@ class CharacterDeleteView(EvenniaWebTest):
|
||||||
}
|
}
|
||||||
response = self.client.get(reverse(self.url_name, kwargs=kwargs), follow=True)
|
response = self.client.get(reverse(self.url_name, kwargs=kwargs), follow=True)
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue