Exemple #1
0
    def test_position_in_dict_ignored(self):
        a = Request(target=None, body={"a": 1, "b": 2})
        b = Request(target=None, body={"b": 2, "a": 1})
        c = Request(target=None, body={"a": 2, "b": 1})

        assert Amf.get_representation(a) == Amf.get_representation(b)
        assert Amf.get_representation(a) != Amf.get_representation(c)
    def test_amf_parse(self):
        mq = MethodQueryCanonicalizer("POST", "application/x-amf", 0, BytesIO())

        req = Request(target="t", body="")
        ev_1 = Envelope(AMF3)
        ev_1["/0"] = req

        req = Request(target="t", body="alt_content")
        ev_2 = Envelope(AMF3)
        ev_2["/0"] = req

        assert amf_parse(encode(ev_1).getvalue()) != amf_parse(encode(ev_2).getvalue())
Exemple #3
0
    def test_amf_parse(self):
        mq = MethodQueryCanonicalizer('POST', 'application/x-amf', 0, BytesIO())

        req = Request(target='t', body="")
        ev_1 = Envelope(AMF3)
        ev_1['/0'] = req

        req = Request(target='t', body="alt_content")
        ev_2 = Envelope(AMF3)
        ev_2['/0'] = req

        assert mq.amf_parse(encode(ev_1).getvalue(), None) != \
               mq.amf_parse(encode(ev_2).getvalue(), None)
Exemple #4
0
    def test_order_of_array_preserved(self):
        a = Request(target=None, body=[1, 2])
        b = Request(target=None, body=[2, 1])

        assert Amf.get_representation(a) != Amf.get_representation(b)
Exemple #5
0
def generate_amf_request(request_body=None):
    req = Request(target='UserService', body=request_body)
    ev = Envelope(pyamf.AMF3)
    ev['/0'] = req

    return encode(ev).getvalue()