ShellBanner
System:Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686
Software:Apache. PHP/5.3.6-13ubuntu3.10
ID:uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Safe Mode:OFF
Open_Basedir:OFF
Freespace:25.79 GB of 70.42 GB (36.63%)
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

/ usr/ share/ pyshared/ twisted/ test/ - drwxr-xr-x

Directory:
Viewing file:     test_postfix.py (3.48 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Test cases for twisted.protocols.postfix module.
"""

from twisted.trial import unittest
from twisted.protocols import postfix
from twisted.test.proto_helpers import StringTransport


class PostfixTCPMapQuoteTestCase(unittest.TestCase):
    data = [
        # (raw, quoted, [aliasQuotedForms]),
        ('foo', 'foo'),
        ('foo bar', 'foo%20bar'),
        ('foo\tbar', 'foo%09bar'),
        ('foo\nbar', 'foo%0Abar', 'foo%0abar'),
        ('foo\r\nbar', 'foo%0D%0Abar', 'foo%0D%0abar', 'foo%0d%0Abar', 'foo%0d%0abar'),
        ('foo ', 'foo%20'),
        (' foo', '%20foo'),
        ]

    def testData(self):
        for entry in self.data:
            raw = entry[0]
            quoted = entry[1:]

            self.assertEquals(postfix.quote(raw), quoted[0])
            for q in quoted:
                self.assertEquals(postfix.unquote(q), raw)

class PostfixTCPMapServerTestCase:
    data = {
        # 'key': 'value',
        }

    chat = [
        # (input, expected_output),
        ]

    def test_chat(self):
        """
        Test that I{get} and I{put} commands are responded to correctly by
        L{postfix.PostfixTCPMapServer} when its factory is an instance of
        L{postifx.PostfixTCPMapDictServerFactory}.
        """
        factory = postfix.PostfixTCPMapDictServerFactory(self.data)
        transport = StringTransport()

        protocol = postfix.PostfixTCPMapServer()
        protocol.service = factory
        protocol.factory = factory
        protocol.makeConnection(transport)

        for input, expected_output in self.chat:
            protocol.lineReceived(input)
            self.assertEquals(
                transport.value(), expected_output,
                'For %r, expected %r but got %r' % (
                    input, expected_output, transport.value()))
            transport.clear()
        protocol.setTimeout(None)


    def test_deferredChat(self):
        """
        Test that I{get} and I{put} commands are responded to correctly by
        L{postfix.PostfixTCPMapServer} when its factory is an instance of
        L{postifx.PostfixTCPMapDeferringDictServerFactory}.
        """
        factory = postfix.PostfixTCPMapDeferringDictServerFactory(self.data)
        transport = StringTransport()

        protocol = postfix.PostfixTCPMapServer()
        protocol.service = factory
        protocol.factory = factory
        protocol.makeConnection(transport)

        for input, expected_output in self.chat:
            protocol.lineReceived(input)
            self.assertEquals(
                transport.value(), expected_output,
                'For %r, expected %r but got %r' % (
                    input, expected_output, transport.value()))
            transport.clear()
        protocol.setTimeout(None)



class Valid(PostfixTCPMapServerTestCase, unittest.TestCase):
    data = {
        'foo': 'ThisIs Foo',
        'bar': ' bar really is found\r\n',
        }
    chat = [
        ('get', "400 Command 'get' takes 1 parameters.\n"),
        ('get foo bar', "500 \n"),
        ('put', "400 Command 'put' takes 2 parameters.\n"),
        ('put foo', "400 Command 'put' takes 2 parameters.\n"),
        ('put foo bar baz', "500 put is not implemented yet.\n"),
        ('put foo bar', '500 put is not implemented yet.\n'),
        ('get foo', '200 ThisIs%20Foo\n'),
        ('get bar', '200 %20bar%20really%20is%20found%0D%0A\n'),
        ('get baz', '500 \n'),
        ('foo', '400 unknown command\n'),
        ]
Command:
Quick Commands:
Upload:
[Read-Only] Max size: 100MB
PHP Filesystem: <@ Ú
Search File:
regexp
Create File:
Overwrite [Read-Only]
View File:
Mass Defacement:
[+] Main Directory: [+] Defacement Url:
LmfaoX Shell - Private Build [BETA] - v0.1 -; Generated: 0.2585 seconds