Example #1
0
    def test_decode(self):
        gen = amf0.decode('\x00?\xf0\x00\x00\x00\x00\x00\x00')
        self.assertTrue(isinstance(gen, types.GeneratorType))

        self.assertEquals(gen.next(), 1)
        self.assertRaises(StopIteration, gen.next)

        self.assertEquals([x for x in amf0.decode('\x02\x00\x03foo\x02\x00\x03bar')], ['foo', 'bar'])
Example #2
0
    def test_decode(self):
        gen = amf0.decode('\x00?\xf0\x00\x00\x00\x00\x00\x00')
        self.assertTrue(isinstance(gen, types.GeneratorType))

        self.assertEquals(gen.next(), 1)
        self.assertRaises(StopIteration, gen.next)

        self.assertEquals([x for x in amf0.decode('\x02\x00\x03foo\x02\x00\x03bar')], ['foo', 'bar'])
Example #3
0
    def test_decode_with_context(self):
        context = amf0.Context()

        obj = object()
        context.addObject(obj)
        self.assertEquals(
            [x for x in amf0.decode('\x07\x00\x00', context=context)], [obj])
Example #4
0
    def test_decode_with_context(self):
        context = amf0.Context()

        obj = object()
        context.addObject(obj)
        self.assertEquals([x for x in amf0.decode('\x07\x00\x00', context=context)], [obj])
Example #5
0
    def test_decode_amf0(self):
        bytes = '\x11\n\x077flex.messaging.io.ArrayList\t\x03\x01\x06\teggs'
        x = amf0.decode(bytes).next()

        self.assertEquals(x.__class__, io.ArrayList)
        self.assertEquals(x, ['eggs'])