1
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
2
# See LICENSE for details.
5
Tests for L{twisted.protocols.finger}.
8
from twisted.trial import unittest
9
from twisted.protocols import finger
10
from twisted.test.proto_helpers import StringTransport
13
class FingerTestCase(unittest.TestCase):
15
Tests for L{finger.Finger}.
19
Create and connect a L{finger.Finger} instance.
21
self.transport = StringTransport()
22
self.protocol = finger.Finger()
23
self.protocol.makeConnection(self.transport)
26
def test_simple(self):
28
When L{finger.Finger} receives a CR LF terminated line, it responds
29
with the default user status message - that no such user exists.
31
self.protocol.dataReceived("moshez\r\n")
33
self.transport.value(),
34
"Login: moshez\nNo such user\n")
37
def test_simpleW(self):
39
The behavior for a query which begins with C{"/w"} is the same as the
40
behavior for one which does not. The user is reported as not existing.
42
self.protocol.dataReceived("/w moshez\r\n")
44
self.transport.value(),
45
"Login: moshez\nNo such user\n")
48
def test_forwarding(self):
50
When L{finger.Finger} receives a request for a remote user, it responds
51
with a message rejecting the request.
53
self.protocol.dataReceived("moshez@example.com\r\n")
55
self.transport.value(),
56
"Finger forwarding service denied\n")
61
When L{finger.Finger} receives a blank line, it responds with a message
62
rejecting the request for all online users.
64
self.protocol.dataReceived("\r\n")
66
self.transport.value(),
67
"Finger online list denied\n")