Ran black on branc
This commit is contained in:
parent
6effb6f456
commit
4ea6209123
230 changed files with 7108 additions and 2395 deletions
|
|
@ -85,7 +85,9 @@ class TestAMPClientSend(_TestAMP):
|
|||
|
||||
self._connect_server(mocktransport)
|
||||
self.amp_server.dataReceived(wire_data)
|
||||
self.portal.sessions.data_out.assert_called_with(self.portalsession, text={"foo": "bar"})
|
||||
self.portal.sessions.data_out.assert_called_with(
|
||||
self.portalsession, text={"foo": "bar"}
|
||||
)
|
||||
|
||||
def test_adminserver2portal(self, mocktransport):
|
||||
self._connect_client(mocktransport)
|
||||
|
|
@ -112,7 +114,9 @@ class TestAMPClientRecv(_TestAMP):
|
|||
|
||||
self._connect_client(mocktransport)
|
||||
self.amp_client.dataReceived(wire_data)
|
||||
self.server.sessions.data_in.assert_called_with(self.session, text={"foo": "bar"})
|
||||
self.server.sessions.data_in.assert_called_with(
|
||||
self.session, text={"foo": "bar"}
|
||||
)
|
||||
|
||||
def test_adminportal2server(self, mocktransport):
|
||||
self._connect_server(mocktransport)
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ class TestLauncher(TwistedTestCase):
|
|||
@patch("evennia.server.evennia_launcher.print")
|
||||
def test_query_status_run(self, mprint):
|
||||
evennia_launcher.query_status()
|
||||
mprint.assert_called_with("Portal: RUNNING (pid 100)\nServer: RUNNING (pid 100)")
|
||||
mprint.assert_called_with(
|
||||
"Portal: RUNNING (pid 100)\nServer: RUNNING (pid 100)"
|
||||
)
|
||||
|
||||
@patch("evennia.server.evennia_launcher.send_instruction", _msend_status_err)
|
||||
@patch("evennia.server.evennia_launcher.NO_REACTOR_STOP", True)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ class TestDeprecations(TestCase):
|
|||
self.assertRaises(DeprecationWarning, check_errors, MockSettings(setting))
|
||||
# test check for WEBSERVER_PORTS having correct value
|
||||
self.assertRaises(
|
||||
DeprecationWarning, check_errors, MockSettings("WEBSERVER_PORTS", value=["not a tuple"])
|
||||
DeprecationWarning,
|
||||
check_errors,
|
||||
MockSettings("WEBSERVER_PORTS", value=["not a tuple"]),
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -81,7 +83,9 @@ class ValidatorTest(EvenniaTest):
|
|||
# This password contains illegal characters and should raise an Exception.
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
self.assertRaises(ValidationError, validator.validate, "(#)[#]<>", user=self.account)
|
||||
self.assertRaises(
|
||||
ValidationError, validator.validate, "(#)[#]<>", user=self.account
|
||||
)
|
||||
|
||||
|
||||
class ThrottleTest(EvenniaTest):
|
||||
|
|
@ -123,4 +127,6 @@ class ThrottleTest(EvenniaTest):
|
|||
self.assertEqual(len(ips), len(cache.keys()))
|
||||
|
||||
# There should only be (cache_size * num_ips) total in the Throttle cache
|
||||
self.assertEqual(sum([len(cache[x]) for x in cache.keys()]), throttle.cache_size * len(ips))
|
||||
self.assertEqual(
|
||||
sum([len(cache[x]) for x in cache.keys()]), throttle.cache_size * len(ips)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ class TestServer(TestCase):
|
|||
) as mocks:
|
||||
mocks["connection"].close = MagicMock()
|
||||
mocks["ServerConfig"].objects.conf = MagicMock(return_value=100)
|
||||
with patch("evennia.server.server.evennia.ScriptDB.objects.validate") as mock:
|
||||
with patch(
|
||||
"evennia.server.server.evennia.ScriptDB.objects.validate"
|
||||
) as mock:
|
||||
self.server._server_maintenance()
|
||||
mocks["_FLUSH_CACHE"].assert_called_with(1000)
|
||||
mock.assert_called()
|
||||
|
|
@ -139,7 +141,9 @@ class TestServer(TestCase):
|
|||
mocks["time"].time = MagicMock(return_value=1000)
|
||||
|
||||
mocks["ServerConfig"].objects.conf = MagicMock(return_value=100)
|
||||
mocks["SESSIONS"].values = MagicMock(return_value=[sess1, sess2, sess3, sess4])
|
||||
mocks["SESSIONS"].values = MagicMock(
|
||||
return_value=[sess1, sess2, sess3, sess4]
|
||||
)
|
||||
mocks["SESSIONS"].disconnect = MagicMock()
|
||||
|
||||
self.server._server_maintenance()
|
||||
|
|
@ -148,7 +152,9 @@ class TestServer(TestCase):
|
|||
mocks["SESSIONS"].disconnect.assert_has_calls(calls, any_order=True)
|
||||
|
||||
def test_evennia_start(self):
|
||||
with patch.multiple("evennia.server.server", time=DEFAULT, service=DEFAULT) as mocks:
|
||||
with patch.multiple(
|
||||
"evennia.server.server", time=DEFAULT, service=DEFAULT
|
||||
) as mocks:
|
||||
|
||||
mocks["time"].time = MagicMock(return_value=1000)
|
||||
evennia = self.server.Evennia(MagicMock())
|
||||
|
|
@ -196,7 +202,9 @@ class TestServer(TestCase):
|
|||
def test_initial_setup(self):
|
||||
from evennia.utils.create import create_account
|
||||
|
||||
acct = create_account("TestSuperuser", "test@test.com", "testpassword", is_superuser=True)
|
||||
acct = create_account(
|
||||
"TestSuperuser", "test@test.com", "testpassword", is_superuser=True
|
||||
)
|
||||
|
||||
with patch.multiple(
|
||||
"evennia.server.initial_setup", reset_server=DEFAULT, AccountDB=DEFAULT
|
||||
|
|
@ -209,7 +217,9 @@ class TestServer(TestCase):
|
|||
def test_initial_setup_retry(self):
|
||||
from evennia.utils.create import create_account
|
||||
|
||||
acct = create_account("TestSuperuser2", "test@test.com", "testpassword", is_superuser=True)
|
||||
acct = create_account(
|
||||
"TestSuperuser2", "test@test.com", "testpassword", is_superuser=True
|
||||
)
|
||||
|
||||
with patch.multiple(
|
||||
"evennia.server.initial_setup",
|
||||
|
|
@ -236,7 +246,9 @@ class TestServer(TestCase):
|
|||
with patch("evennia.objects.models.ObjectDB") as mockobj:
|
||||
with patch("evennia.server.server.AccountDB") as mockacct:
|
||||
|
||||
mockacct.get_all_cached_instances = MagicMock(return_value=[acct1, acct2])
|
||||
mockacct.get_all_cached_instances = MagicMock(
|
||||
return_value=[acct1, acct2]
|
||||
)
|
||||
mockobj.get_all_cached_instances = MagicMock(return_value=[obj1, obj2])
|
||||
mockobj.objects.clear_all_sessids = MagicMock()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue