def test_put_characteristics_sends_minimal_json(self): """ The tado internet bridge will fail if a there are spaces in the json data transmitted to it. An iPhone client sends minimalistic json with the whitespace stripped out: b'{"characteristics":[{"aid":2,"iid":12,"ev":true},...,{"aid":2,"iid":17,"ev":true}]}' https://github.com/jlusiardi/homekit_python/issues/181 https://github.com/jlusiardi/homekit_python/pull/182 """ session = __class__.prepare_mock_function() pairing = IpPairing(session.pairing_data) pairing.session = session pairing.put_characteristics([(1, 2, 3)])
def test_get_events_sends_minimal_json(self): """ The tado internet bridge will fail if a there are spaces in the json data transmitted to it. An iPhone client sends minimalistic json with the whitespace stripped out: b'{"characteristics":[{"aid":2,"iid":12,"ev":true},...,{"aid":2,"iid":17,"ev":true}]}' https://github.com/jlusiardi/homekit_python/issues/181 https://github.com/jlusiardi/homekit_python/pull/182 """ session = __class__.prepare_mock_function() pairing = IpPairing(session.pairing_data) pairing.session = session pairing.get_events([(1, 2)], lambda *_: None) assert session.put.call_args[0][0] == '/characteristics' payload = session.put.call_args[0][1] assert ' ' not in payload, 'Regression of https://github.com/jlusiardi/homekit_python/issues/181'