Example #1
0
 def test_repr_with_results(self):
     response = Response("foo")
     response.data = JSONRPCResponse({
         "jsonrpc": "2.0",
         "error": {
             "message": "foo"
         },
         "id": 1
     })
     assert repr(response) == "<Response[0 ok, 1 errors]>"
Example #2
0
    def check_request(self, request, *args, **kwargs):

        data_seats = {
            "0810300ITA": {
                "I": 0,
                "W": 0
            },
            "0810600ITA": {
                "I": 0,
                "W": 0
            },
            "0810700ITA": {
                "I": 0,
                "W": 0
            },
            "0810110ITA": {
                "I": 0,
                "W": 0
            },
            "0100100ITA": {
                "I": 326,
                "W": 98
            },
            "0810500ITA": {
                "I": 0,
                "W": 0
            },
            "0810200ITA": {
                "I": 0,
                "W": 0
            },
            "0810010ITA": {
                "I": 0,
                "W": 0
            },
            "0810800ITA": {
                "I": 0,
                "W": 0
            }
        }
        data_price = {
            "0810300ITA": {
                "I": 17.9,
                "W": 23.9
            },
            "0810600ITA": {
                "I": 15.9,
                "W": 19.9
            },
            "0810700ITA": {
                "I": 16.9,
                "W": 19.9
            },
            "0810110ITA": {
                "I": 14.9,
                "W": 18.9
            },
            "0100100ITA": {
                "I": 21.5,
                "W": 29.0
            },
            "0810500ITA": {
                "I": 15.9,
                "W": 18.9
            },
            "0810200ITA": {
                "I": 17.9,
                "W": 22.9
            },
            "0810010ITA": {
                "I": 17.9,
                "W": 21.9
            },
            "0810800ITA": {
                "I": 16.9,
                "W": 20.9
            }
        }

        class MockData:
            def __init__(self, result):
                self.result = result

        res_seats = Response('')
        res_price = Response('')
        res_seats_data = MockData(data_seats)
        res_price_data = MockData(data_price)
        res_seats.data = res_seats_data
        res_price.data = res_price_data

        if request['method'] == 'get_availability':
            return res_seats
        elif request['method'] == 'get_price':
            return res_price