Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
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.

test_finger.py 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Tests for L{twisted.protocols.finger}.
  5. """
  6. from twisted.protocols import finger
  7. from twisted.test.proto_helpers import StringTransport
  8. from twisted.trial import unittest
  9. class FingerTests(unittest.TestCase):
  10. """
  11. Tests for L{finger.Finger}.
  12. """
  13. def setUp(self):
  14. """
  15. Create and connect a L{finger.Finger} instance.
  16. """
  17. self.transport = StringTransport()
  18. self.protocol = finger.Finger()
  19. self.protocol.makeConnection(self.transport)
  20. def test_simple(self):
  21. """
  22. When L{finger.Finger} receives a CR LF terminated line, it responds
  23. with the default user status message - that no such user exists.
  24. """
  25. self.protocol.dataReceived(b"moshez\r\n")
  26. self.assertEqual(self.transport.value(), b"Login: moshez\nNo such user\n")
  27. def test_simpleW(self):
  28. """
  29. The behavior for a query which begins with C{"/w"} is the same as the
  30. behavior for one which does not. The user is reported as not existing.
  31. """
  32. self.protocol.dataReceived(b"/w moshez\r\n")
  33. self.assertEqual(self.transport.value(), b"Login: moshez\nNo such user\n")
  34. def test_forwarding(self):
  35. """
  36. When L{finger.Finger} receives a request for a remote user, it responds
  37. with a message rejecting the request.
  38. """
  39. self.protocol.dataReceived(b"moshez@example.com\r\n")
  40. self.assertEqual(self.transport.value(), b"Finger forwarding service denied\n")
  41. def test_list(self):
  42. """
  43. When L{finger.Finger} receives a blank line, it responds with a message
  44. rejecting the request for all online users.
  45. """
  46. self.protocol.dataReceived(b"\r\n")
  47. self.assertEqual(self.transport.value(), b"Finger online list denied\n")