Пример #1
0
    def test_equals_if_data_differs_objects_not_equal(self):
        req1 = echoplugin.EchoRequest()
        req2 = echoplugin.EchoRequest()

        req2.data = 'HELLO'

        self.assertFalse(req1 == req2)
Пример #2
0
    def test_path_parsed(self):
        req1 = echoplugin.EchoRequest()
        req1.path = '/something'

        req2 = echoplugin.parseRequest(req1.serialize())

        self.assertEquals('/something', req2.path)
Пример #3
0
    def test_stderr_parsed(self):
        req1 = echoplugin.EchoRequest()
        req1.stderr = True

        req2 = echoplugin.parseRequest(req1.serialize())

        self.assertEquals(True, req2.stderr)
Пример #4
0
    def test_data_parsed(self):
        req1 = echoplugin.EchoRequest()
        req1.data = 'HELLO'

        req2 = echoplugin.parseRequest(req1.serialize())

        self.assertEquals('HELLO', req2.data)
Пример #5
0
    def test_serialise_deserialise_exit_value(self):
        req1 = echoplugin.EchoRequest()
        args = req1.serialize()

        req2 = echoplugin.parseRequest(args)

        self.assertEquals(None, req2.exitCode)
Пример #6
0
    def test_serialise_deserialise_default_values(self):
        req1 = echoplugin.EchoRequest()
        args = req1.serialize()

        req2 = echoplugin.parseRequest(args)

        self.assertTrue(req1 == req2)
Пример #7
0
    def _assertStdOutCaptured(self):
        sayHelloOnOut = echoplugin.EchoRequest(data='HELLO',
                                               stdout=True,
                                               exitCode=1)
        result = self._callEchoPlugin(sayHelloOnOut)

        self._assertNonZeroStatus(result)

        assertions.assertIn('stdout: HELLO', result)
Пример #8
0
    def _assertStdErrCaptured(self):
        sayHelloOnError = echoplugin.EchoRequest(data='HELLO',
                                                 stderr=True,
                                                 exitCode=1)
        result = self._callEchoPlugin(sayHelloOnError)

        self._assertNonZeroStatus(result)

        assertions.assertIn('stderr: HELLO', result)
Пример #9
0
    def test_init(self):
        req = echoplugin.EchoRequest(
            stdout='stdout',
            stderr='stderr',
            path='path',
            data='data',
            exitCode='exitCode'
        )

        self.assertEquals('stdout', req.stdout)
        self.assertEquals('stderr', req.stderr)
        self.assertEquals('path', req.path)
        self.assertEquals('data', req.data)
        self.assertEquals('exitCode', req.exitCode)
Пример #10
0
    def test_default_values(self):
        null_req = echoplugin.EchoRequest()
        req = echoplugin.parseRequest({})

        self.assertTrue(null_req == req)
Пример #11
0
    def test_fresh_objects_are_equal(self):
        req1 = echoplugin.EchoRequest()
        req2 = echoplugin.EchoRequest()

        self.assertTrue(req1 == req2)
Пример #12
0
    def _assertFileWritten(self):
        sayHelloToFile = echoplugin.EchoRequest(data='HELLO',
                                                path='/var/log/echo')
        result = self._callEchoPlugin(sayHelloToFile)

        self._assertDomZeroPathContents('/var/log/echo', 'HELLO')
Пример #13
0
    def _assertNormalPluginCallWorks(self):
        sayHelloThere = echoplugin.EchoRequest(data='HELLO THERE')
        result = self._callEchoPlugin(sayHelloThere)

        assertions.assertEquals('HELLO THERE', result.strip())