Ejemplo n.º 1
0
 def test_consider_ip(self):
     data = LOCATE_V1_SCHEMA.deserialize({"considerIp": False})
     assert data["fallbacks"]["ipf"] is False
     data = LOCATE_V1_SCHEMA.deserialize({"considerIp": "false"})
     assert data["fallbacks"]["ipf"] is False
     data = LOCATE_V1_SCHEMA.deserialize({"considerIp": "true"})
     assert data["fallbacks"]["ipf"] is True
     data = LOCATE_V1_SCHEMA.deserialize({"considerIp": False, "fallbacks": {}})
     assert data["fallbacks"]["ipf"] is True
Ejemplo n.º 2
0
 def test_consider_ip(self):
     data = LOCATE_V1_SCHEMA.deserialize({'considerIp': False})
     assert data['fallbacks']['ipf'] is False
     data = LOCATE_V1_SCHEMA.deserialize({'considerIp': 'false'})
     assert data['fallbacks']['ipf'] is False
     data = LOCATE_V1_SCHEMA.deserialize({'considerIp': 'true'})
     assert data['fallbacks']['ipf'] is True
     data = LOCATE_V1_SCHEMA.deserialize(
         {'considerIp': False, 'fallbacks': {}})
     assert data['fallbacks']['ipf'] is True
Ejemplo n.º 3
0
 def test_consider_ip(self):
     data = LOCATE_V1_SCHEMA.deserialize({'considerIp': False})
     assert data['fallbacks']['ipf'] is False
     data = LOCATE_V1_SCHEMA.deserialize({'considerIp': 'false'})
     assert data['fallbacks']['ipf'] is False
     data = LOCATE_V1_SCHEMA.deserialize({'considerIp': 'true'})
     assert data['fallbacks']['ipf'] is True
     data = LOCATE_V1_SCHEMA.deserialize(
         {'considerIp': False, 'fallbacks': {}})
     assert data['fallbacks']['ipf'] is True
Ejemplo n.º 4
0
 def test_multiple_radio_fields(self):
     data = LOCATE_V1_SCHEMA.deserialize({'cellTowers': [{
         'radio': 'gsm',
         'radioType': 'wcdma',
     }]})
     assert data['cellTowers'][0]['radioType'] == 'wcdma'
     assert 'radio' not in data['cellTowers'][0]
Ejemplo n.º 5
0
 def test_multiple_radio_fields(self):
     data = LOCATE_V1_SCHEMA.deserialize({'cellTowers': [{
         'radio': 'gsm',
         'radioType': 'wcdma',
     }]})
     assert data['cellTowers'][0]['radioType'] == 'wcdma'
     assert 'radio' not in data['cellTowers'][0]
Ejemplo n.º 6
0
 def test_multiple_radio_fields(self):
     data = LOCATE_V1_SCHEMA.deserialize(
         {"cellTowers": [{
             "radio": "gsm",
             "radioType": "wcdma"
         }]})
     assert data["cellTowers"][0]["radioType"] == "wcdma"
     assert "radio" not in data["cellTowers"][0]
Ejemplo n.º 7
0
 def test_empty(self):
     data = LOCATE_V1_SCHEMA.deserialize({})
     assert (data == {
         'bluetoothBeacons': (),
         'carrier': None,
         'cellTowers': (),
         'considerIp': True,
         'fallbacks': {'ipf': True, 'lacf': True},
         'homeMobileCountryCode': None,
         'homeMobileNetworkCode': None,
         'wifiAccessPoints': ()})
Ejemplo n.º 8
0
 def test_empty(self):
     data = LOCATE_V1_SCHEMA.deserialize({})
     assert (data == {
         'bluetoothBeacons': (),
         'carrier': None,
         'cellTowers': (),
         'considerIp': True,
         'fallbacks': {'ipf': True, 'lacf': True},
         'homeMobileCountryCode': None,
         'homeMobileNetworkCode': None,
         'wifiAccessPoints': ()})
Ejemplo n.º 9
0
 def test_empty(self):
     data = LOCATE_V1_SCHEMA.deserialize({})
     assert data == {
         "bluetoothBeacons": (),
         "carrier": None,
         "cellTowers": (),
         "considerIp": True,
         "fallbacks": {"ipf": True, "lacf": True},
         "homeMobileCountryCode": None,
         "homeMobileNetworkCode": None,
         "wifiAccessPoints": (),
     }
Ejemplo n.º 10
0
 def test_invalid_radio_field(self):
     with pytest.raises(colander.Invalid):
         LOCATE_V1_SCHEMA.deserialize({'cellTowers': [{
             'radioType': 'umts',
         }]})
Ejemplo n.º 11
0
 def test_invalid_radio_field(self):
     with pytest.raises(colander.Invalid):
         LOCATE_V1_SCHEMA.deserialize({'cellTowers': [{
             'radioType': 'umts',
         }]})
Ejemplo n.º 12
0
 def test_invalid_radio_field(self):
     with pytest.raises(colander.Invalid):
         LOCATE_V1_SCHEMA.deserialize({"cellTowers": [{"radioType": "umts"}]})