コード例 #1
0
ファイル: tests.py プロジェクト: Descyndis/mud
    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!')
コード例 #2
0
 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)
コード例 #3
0
 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.")
コード例 #4
0
 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()
コード例 #5
0
 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()
コード例 #6
0
 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)