def test_authenticate(self): # Create a guest account account, errors = DefaultGuest.authenticate(ip=self.ip) self.assertTrue(account, 'Guest account should have been created.') # Create a second guest account account, errors = DefaultGuest.authenticate(ip=self.ip) self.assertFalse(account, 'Two guest accounts were created with a single entry on the guest list!')
def test_create(self, get_channel): get_channel.connect = MagicMock(return_value=True) account, errors = DefaultGuest.create() self.assertTrue(account, "Guest account should have been created.") self.assertFalse(errors)
def test_create_not_enabled(self): # Guest account should not be permitted account, errors = DefaultGuest.authenticate(ip=self.ip) self.assertFalse(account, "Guest account was created despite being disabled.")
def test_at_post_disconnect(self): account, errors = DefaultGuest.create(ip=self.ip) self.char1.delete = MagicMock() account.db._playable_characters = [self.char1] account.at_post_disconnect() self.char1.delete.assert_called()
def test_at_server_shutdown(self): account, errors = DefaultGuest.create(ip=self.ip) self.char1.delete = MagicMock() account.db._playable_characters = [self.char1] account.at_server_shutdown() self.char1.delete.assert_called()
def test_create(self, get_channel): get_channel.connect = MagicMock(return_value=True) with override_settings(GUEST_HOME=self.room1.dbref): account, errors = DefaultGuest.create() self.assertTrue(account, "Guest account should have been created.") self.assertFalse(errors)