Exemplo n.º 1
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(
         wifi=[
             {
                 "macAddress": wifi.mac,
                 "age": 2000,
                 "channel": 11,
                 "signalStrength": -90,
                 "signalToNoiseRatio": 13,
             }
             for wifi in wifis
         ]
     )
     data = self._call(query.json())
     assert data == {
         "wifiAccessPoints": [
             {
                 "macAddress": wifis[0].mac,
                 "age": 2000,
                 "channel": 11,
                 "signalStrength": -90,
                 "signalToNoiseRatio": 13,
             },
             {
                 "macAddress": wifis[1].mac,
                 "age": 2000,
                 "channel": 11,
                 "signalStrength": -90,
                 "signalToNoiseRatio": 13,
             },
         ],
         "considerIp": False,
     }
Exemplo n.º 2
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[{
         'mac': wifi.mac,
         'age': 2000,
         'signal': -90,
         'ssid': 'wifi'
     } for wifi in wifis])
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(
         data, {
             'wifiAccessPoints': [{
                 'macAddress': wifis[0].mac,
                 'age': 2000,
                 'signalStrength': -90,
                 'ssid': 'wifi',
             }, {
                 'macAddress': wifis[1].mac,
                 'age': 2000,
                 'signalStrength': -90,
                 'ssid': 'wifi',
             }],
             'fallbacks': {
                 'lacf': True
             },
         })
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[{
         'radioType': cell.radio,
         'mobileCountryCode': cell.mcc,
         'mobileNetworkCode': cell.mnc,
         'locationAreaCode': cell.lac,
         'cellId': cell.cid,
         'asu': 17,
         'primaryScramblingCode': 5,
         'signalStrength': -70,
         'timingAdvance': 15,
         'unknown_field': 'foo'
     }])
     data = self._call(query.json())
     assert (data == {
         'cells': [{
             'radio': cell.radio.name,
             'mcc': cell.mcc,
             'mnc': cell.mnc,
             'lac': cell.lac,
             'cid': cell.cid,
             'asu': 17,
             'psc': 5,
             'signal': -70,
             'tA': 15,
         }],
         'fallbacks': {
             'lacf': True
         },
         'token':
         None,
     })
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[{
         'macAddress': wifi.mac,
         'age': 2000,
         'channel': 11,
         'signalStrength': -90,
         'signalToNoiseRatio': 13
     } for wifi in wifis])
     data = self._call(query.json())
     assert (data == {
         'wifiAccessPoints': [{
             'macAddress': wifis[0].mac,
             'age': 2000,
             'channel': 11,
             'signalStrength': -90,
             'signalToNoiseRatio': 13,
         }, {
             'macAddress': wifis[1].mac,
             'age': 2000,
             'channel': 11,
             'signalStrength': -90,
             'signalToNoiseRatio': 13,
         }],
         'considerIp':
         False,
     })
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[{
         'macAddress': wifi.mac,
         'channel': 3,
         'frequency': 2412,
         'signalStrength': -70,
         'signalToNoiseRatio': 13,
         'ssid': 'wifi'
     } for wifi in wifis])
     data = self._call(query.json())
     assert (data == {
         'wifi': [{
             'bssid': wifis[0].mac,
             'channel': 3,
             'frequency': 2412,
             'signal': -70,
             'signalToNoiseRatio': 13,
         }, {
             'bssid': wifis[1].mac,
             'channel': 3,
             'frequency': 2412,
             'signal': -70,
             'signalToNoiseRatio': 13,
         }],
         'fallbacks': {
             'lacf': True
         },
         'token':
         None,
     })
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[{
         'radioType': cell.radio,
         'mobileCountryCode': cell.mcc,
         'mobileNetworkCode': cell.mnc,
         'locationAreaCode': cell.lac,
         'cellId': cell.cid,
         'age': 1200,
         'signalStrength': -70,
         'timingAdvance': 15,
         'unknown_field': 'foo'
     }])
     data = self._call(query.json())
     assert (data == {
         'cellTowers': [{
             'radioType': cell.radio.name,
             'mobileCountryCode': cell.mcc,
             'mobileNetworkCode': cell.mnc,
             'locationAreaCode': cell.lac,
             'cellId': cell.cid,
             'age': 1200,
             'signalStrength': -70,
             'timingAdvance': 15,
         }],
         'considerIp':
         False,
     })
Exemplo n.º 7
0
 def test_blue(self):
     blues = BlueShardFactory.build_batch(2)
     query = Query(blue=[{
         'mac': blue.mac,
         'age': 1500,
         'name': 'beacon',
         'signal': -90
     } for blue in blues])
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(
         data, {
             'bluetoothBeacons': [{
                 'macAddress': blues[0].mac,
                 'age': 1500,
                 'name': 'beacon',
                 'signalStrength': -90,
             }, {
                 'macAddress': blues[1].mac,
                 'age': 1500,
                 'name': 'beacon',
                 'signalStrength': -90,
             }],
             'fallbacks': {
                 'lacf': True
             },
         })
Exemplo n.º 8
0
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[{
         'radioType': cell.radio,
         'mobileCountryCode': cell.mcc,
         'mobileNetworkCode': cell.mnc,
         'locationAreaCode': cell.lac,
         'cellId': cell.cid,
         'age': 1200,
         'asu': None,
         'primaryScramblingCode': 5,
         'signalStrength': -70,
         'timingAdvance': 15,
         'unknown_field': 'foo'
     }])
     data = OUTBOUND_SCHEMA.deserialize(query.json())
     assert (data == {
         'cellTowers': [{
             'radioType': cell.radio.name,
             'mobileCountryCode': cell.mcc,
             'mobileNetworkCode': cell.mnc,
             'locationAreaCode': cell.lac,
             'cellId': cell.cid,
             'primaryScramblingCode': 5,
             'age': 1200,
             'signalStrength': -70,
             'timingAdvance': 15,
         }],
         'fallbacks': {
             'lacf': True
         },
     })
Exemplo n.º 9
0
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[
         {'radioType': cell.radio,
          'mobileCountryCode': cell.mcc,
          'mobileNetworkCode': cell.mnc,
          'locationAreaCode': cell.lac,
          'cellId': cell.cid,
          'age': 1200,
          'signalStrength': -70,
          'timingAdvance': 15,
          'unknown_field': 'foo'}])
     data = self._call(query.json())
     assert (data == {
         'cellTowers': [{
             'radioType': cell.radio.name,
             'mobileCountryCode': cell.mcc,
             'mobileNetworkCode': cell.mnc,
             'locationAreaCode': cell.lac,
             'cellId': cell.cid,
             'age': 1200,
             'signalStrength': -70,
             'timingAdvance': 15,
         }],
         'considerIp': False,
     })
Exemplo n.º 10
0
 def test_blue(self):
     blues = BlueShardFactory.build_batch(2)
     query = Query(
         blue=[
             {
                 "macAddress": blue.mac,
                 "age": 1500,
                 "name": "beacon",
                 "signalStrength": -90,
             }
             for blue in blues
         ]
     )
     data = self._call(query.json())
     assert data == {
         "bluetoothBeacons": [
             {
                 "macAddress": blues[0].mac,
                 "age": 1500,
                 "name": "beacon",
                 "signalStrength": -90,
             },
             {
                 "macAddress": blues[1].mac,
                 "age": 1500,
                 "name": "beacon",
                 "signalStrength": -90,
             },
         ],
         "fallbacks": {"lacf": True},
     }
Exemplo n.º 11
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(
         wifi=[
             {
                 "macAddress": wifi.mac,
                 "age": 2000,
                 "signalStrength": -90,
                 "ssid": "wifi",
             }
             for wifi in wifis
         ]
     )
     data = self._call(query.json())
     assert data == {
         "wifiAccessPoints": [
             {
                 "macAddress": wifis[0].mac,
                 "age": 2000,
                 "signalStrength": -90,
                 "ssid": "wifi",
             },
             {
                 "macAddress": wifis[1].mac,
                 "age": 2000,
                 "signalStrength": -90,
                 "ssid": "wifi",
             },
         ],
         "fallbacks": {"lacf": True},
     }
Exemplo n.º 12
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[{
         'macAddress': wifi.mac,
         'age': 2000,
         'signalStrength': -90,
         'ssid': 'wifi'
     } for wifi in wifis])
     data = OUTBOUND_SCHEMA.deserialize(query.json())
     assert (data == {
         'wifiAccessPoints': [{
             'macAddress': wifis[0].mac,
             'age': 2000,
             'signalStrength': -90,
             'ssid': 'wifi',
         }, {
             'macAddress': wifis[1].mac,
             'age': 2000,
             'signalStrength': -90,
             'ssid': 'wifi',
         }],
         'fallbacks': {
             'lacf': True
         },
     })
Exemplo n.º 13
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[
         {'macAddress': wifi.mac, 'channel': 3, 'frequency': 2412,
          'signalStrength': -70, 'signalToNoiseRatio': 13,
          'ssid': 'wifi'}
         for wifi in wifis])
     data = self._call(query.json())
     assert (data == {
         'wifi': [{
             'bssid': wifis[0].mac,
             'channel': 3,
             'frequency': 2412,
             'signal': -70,
             'signalToNoiseRatio': 13,
         }, {
             'bssid': wifis[1].mac,
             'channel': 3,
             'frequency': 2412,
             'signal': -70,
             'signalToNoiseRatio': 13,
         }],
         'fallbacks': {'lacf': True},
         'token': None,
     })
Exemplo n.º 14
0
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[
         {'radioType': cell.radio,
          'mobileCountryCode': cell.mcc,
          'mobileNetworkCode': cell.mnc,
          'locationAreaCode': cell.lac,
          'cellId': cell.cid,
          'asu': 17,
          'primaryScramblingCode': 5,
          'signalStrength': -70,
          'timingAdvance': 15,
          'unknown_field': 'foo'}])
     data = self._call(query.json())
     assert (data == {
         'cells': [{
             'radio': cell.radio.name,
             'mcc': cell.mcc,
             'mnc': cell.mnc,
             'lac': cell.lac,
             'cid': cell.cid,
             'asu': 17,
             'psc': 5,
             'signal': -70,
             'tA': 15,
         }],
         'fallbacks': {'lacf': True},
         'token': None,
     })
Exemplo n.º 15
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[{
         "macAddress": wifi.mac,
         "channel": 3,
         "frequency": 2412,
         "signalStrength": -70,
         "signalToNoiseRatio": 13,
         "ssid": "wifi",
     } for wifi in wifis])
     data = self._call(query.json())
     assert data == {
         "wifi": [
             {
                 "bssid": wifis[0].mac,
                 "channel": 3,
                 "frequency": 2412,
                 "signal": -70,
                 "signalToNoiseRatio": 13,
             },
             {
                 "bssid": wifis[1].mac,
                 "channel": 3,
                 "frequency": 2412,
                 "signal": -70,
                 "signalToNoiseRatio": 13,
             },
         ],
         "fallbacks": {
             "lacf": True
         },
         "token":
         None,
     }
Exemplo n.º 16
0
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(
         cell=[
             {
                 "radioType": cell.radio,
                 "mobileCountryCode": cell.mcc,
                 "mobileNetworkCode": cell.mnc,
                 "locationAreaCode": cell.lac,
                 "cellId": cell.cid,
                 "age": 1200,
                 "signalStrength": -70,
                 "timingAdvance": 15,
                 "unknown_field": "foo",
             }
         ]
     )
     data = self._call(query.json())
     assert data == {
         "cellTowers": [
             {
                 "radioType": cell.radio.name,
                 "mobileCountryCode": cell.mcc,
                 "mobileNetworkCode": cell.mnc,
                 "locationAreaCode": cell.lac,
                 "cellId": cell.cid,
                 "age": 1200,
                 "signalStrength": -70,
                 "timingAdvance": 15,
             }
         ],
         "considerIp": False,
     }
Exemplo n.º 17
0
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[{
         "radioType": cell.radio,
         "mobileCountryCode": cell.mcc,
         "mobileNetworkCode": cell.mnc,
         "locationAreaCode": cell.lac,
         "cellId": cell.cid,
         "asu": 17,
         "primaryScramblingCode": 5,
         "signalStrength": -70,
         "timingAdvance": 15,
         "unknown_field": "foo",
     }])
     data = self._call(query.json())
     assert data == {
         "cells": [{
             "radio": cell.radio.name,
             "mcc": cell.mcc,
             "mnc": cell.mnc,
             "lac": cell.lac,
             "cid": cell.cid,
             "asu": 17,
             "psc": 5,
             "signal": -70,
             "tA": 15,
         }],
         "fallbacks": {
             "lacf": True
         },
         "token":
         None,
     }
Exemplo n.º 18
0
 def test_blue(self):
     blues = BlueShardFactory.build_batch(2)
     query = Query(blue=[{
         'macAddress': blue.mac,
         'age': 1500,
         'name': 'beacon',
         'signalStrength': -90
     } for blue in blues])
     data = OUTBOUND_SCHEMA.deserialize(query.json())
     assert (data == {
         'bluetoothBeacons': [{
             'macAddress': blues[0].mac,
             'age': 1500,
             'name': 'beacon',
             'signalStrength': -90,
         }, {
             'macAddress': blues[1].mac,
             'age': 1500,
             'name': 'beacon',
             'signalStrength': -90,
         }],
         'fallbacks': {
             'lacf': True
         },
     })
Exemplo n.º 19
0
 def test_cell(self):
     cell = CellShardFactory.build(radio=Radio.lte)
     query = Query(cell=[{
         'radio': cell.radio,
         'mcc': cell.mcc,
         'mnc': cell.mnc,
         'lac': cell.lac,
         'cid': cell.cid,
         'age': 1200,
         'psc': 5,
         'signal': -70,
         'ta': 15,
         'unknown_field': 'foo'
     }])
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(
         data, {
             'cellTowers': [{
                 'radioType': cell.radio.name,
                 'mobileCountryCode': cell.mcc,
                 'mobileNetworkCode': cell.mnc,
                 'locationAreaCode': cell.lac,
                 'cellId': cell.cid,
                 'primaryScramblingCode': 5,
                 'age': 1200,
                 'signalStrength': -70,
                 'timingAdvance': 15,
             }],
             'fallbacks': {
                 'lacf': True
             },
         })
Exemplo n.º 20
0
 def _make_query(self, source, result, api_key=None, api_type='locate',
                 cell=(), wifi=(), **kw):
     query = Query(
         api_key=api_key or self.api_key,
         api_type=api_type,
         cell=self.cell_model_query(cell),
         wifi=self.wifi_model_query(wifi),
         geoip_db=self.geoip_db,
         stats_client=self.stats_client,
         **kw)
     query.emit_source_stats(source, result)
     return query
Exemplo n.º 21
0
 def _make_query(self, source, result, api_key=None, api_type='locate',
                 cell=(), wifi=(), **kw):
     query = Query(
         api_key=api_key or self.api_key,
         api_type=api_type,
         cell=self.cell_model_query(cell),
         wifi=self.wifi_model_query(wifi),
         geoip_db=self.geoip_db,
         stats_client=self.stats_client,
         **kw)
     query.emit_source_stats(source, result)
     return query
Exemplo n.º 22
0
 def _make_query(self, api_key=None, api_type='locate',
                 blue=(), cell=(), wifi=(), **kw):
     query = Query(
         api_key=api_key or self.api_key,
         api_type=api_type,
         blue=self.blue_model_query(blue),
         cell=self.cell_model_query(cell),
         wifi=self.wifi_model_query(wifi),
         geoip_db=self.geoip_db,
         stats_client=self.stats_client,
         **kw)
     query.emit_query_stats()
     return query
Exemplo n.º 23
0
 def _make_query(self, geoip_db, stats,
                 source, results, api_key=None, api_type='locate',
                 blue=(), cell=(), wifi=(), **kw):
     query = Query(
         api_key=api_key or KeyFactory(valid_key='test'),
         api_type=api_type,
         blue=self.blue_model_query(blue),
         cell=self.cell_model_query(cell),
         wifi=self.wifi_model_query(wifi),
         geoip_db=geoip_db,
         stats_client=stats,
         **kw)
     query.emit_source_stats(source, results)
     return query
Exemplo n.º 24
0
 def _make_query(
     self, geoip_db, api_key=None, api_type="locate", blue=(), cell=(), wifi=(), **kw
 ):
     query = Query(
         api_key=api_key or KeyFactory(valid_key="test"),
         api_type=api_type,
         blue=self.blue_model_query(blue),
         cell=self.cell_model_query(cell),
         wifi=self.wifi_model_query(wifi),
         geoip_db=geoip_db,
         **kw,
     )
     query.emit_query_stats()
     return query
Exemplo n.º 25
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[
         {'mac': wifi.mac, 'signal': -90} for wifi in wifis])
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(data, {
         'wifiAccessPoints': [{
             'macAddress': wifis[0].mac,
             'signalStrength': -90,
         }, {
             'macAddress': wifis[1].mac,
             'signalStrength': -90,
         }],
         'fallbacks': {'lacf': True},
     })
Exemplo n.º 26
0
 def test_fallback(self):
     query = Query(fallback={'ipf': False}, ip=self.london_ip)
     self.assertEqual(query.fallback.ipf, False)
     self.assertEqual(query.fallback.lacf, True)
     self.assertEqual(query.ip, self.london_ip)
     self.assertEqual(query.expected_accuracy, DataAccuracy.none)
     self.assertTrue(query.geoip is None)
Exemplo n.º 27
0
    def test_cell(self):
        cell = CellShardFactory.build()
        cell_query = self.cell_model_query([cell])
        query = Query(cell=cell_query)

        self.assertEqual(len(query.cell), 1)
        self.assertEqual(query.expected_accuracy, DataAccuracy.medium)

        query_cell = query.cell[0]
        for key, value in cell_query[0].items():
            query_value = getattr(query_cell, key, None)
            if key == 'radio':
                self.assertEqual(query_value, cell.radio)
            else:
                self.assertEqual(query_value, value)

        self.assertEqual(len(query.cell_area), 1)
        query_area = query.cell_area[0]
        for key, value in cell_query[0].items():
            query_value = getattr(query_area, key, None)
            if key == 'radio':
                self.assertEqual(query_value, cell.radio)
            elif key in ('cid', 'psc'):
                pass
            else:
                self.assertEqual(query_value, value)
Exemplo n.º 28
0
 def test_cell_area_region_no_fallback(self):
     cell = CellAreaFactory.build()
     cell_query = self.cell_model_query([cell])
     query = Query(cell=cell_query,
                   api_type='region',
                   fallback={'lacf': False})
     assert query.expected_accuracy is DataAccuracy.none
Exemplo n.º 29
0
    def test_cell(self):
        cell = CellShardFactory.build(radio=Radio.lte)
        cell_query = self.cell_model_query([cell])
        query = Query(cell=cell_query)

        assert len(query.cell) == 1
        assert query.expected_accuracy is DataAccuracy.medium
        assert query.geoip_only is False

        query_cell = query.cell[0]
        for key, value in cell_query[0].items():
            query_value = getattr(query_cell, key, None)
            if key == 'radioType':
                assert query_value is cell.radio
            else:
                assert query_value == value

        assert len(query.cell_area) == 1
        query_area = query.cell_area[0]
        for key, value in cell_query[0].items():
            query_value = getattr(query_area, key, None)
            if key == 'radioType':
                assert query_value is cell.radio
            elif key in ('cellId', 'primaryScramblingCode'):
                pass
            else:
                assert query_value == value
Exemplo n.º 30
0
 def test_satisfies_fail(self):
     wifis = WifiShardFactory.build_batch(2)
     wifi_query = [{'macAddress': wifi.mac} for wifi in wifis]
     positions = PositionResultList(
         Position(lat=1.0, lon=1.0, accuracy=2500.0, score=2.0))
     query = Query(api_type='locate', wifi=wifi_query)
     assert not positions.satisfies(query)
Exemplo n.º 31
0
    def test_mixed_cell_wifi(self):
        cells = CellShardFactory.build_batch(1)
        wifis = WifiShardFactory.build_batch(2)

        query = Query(cell=self.cell_model_query(cells),
                      wifi=self.wifi_model_query(wifis))
        self.assertEqual(query.expected_accuracy, DataAccuracy.high)
Exemplo n.º 32
0
 def test_blue(self):
     blues = BlueShardFactory.build_batch(2)
     query = Query(blue=[
         {'mac': blue.mac, 'signal': -90, 'name': 'my'} for blue in blues])
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(data, {
         'bluetoothBeacons': [{
             'macAddress': blues[0].mac,
             'signalStrength': -90,
             'name': 'my',
         }, {
             'macAddress': blues[1].mac,
             'signalStrength': -90,
             'name': 'my',
         }],
         'fallbacks': {'lacf': True},
     })
Exemplo n.º 33
0
    def test_cell_area_no_fallback(self):
        cell = CellAreaFactory.build()
        cell_query = self.cell_model_query([cell])
        query = Query(cell=cell_query, fallback={'lacf': False})

        assert len(query.cell) == 0
        assert len(query.cell_area) == 0
        assert query.expected_accuracy is DataAccuracy.none
Exemplo n.º 34
0
 def test_wifi_duplicates(self):
     wifi = WifiShardFactory.build()
     query = Query(wifi=[
         {'macAddress': wifi.mac, 'signalStrength': -90},
         {'macAddress': wifi.mac, 'signalStrength': -82},
         {'macAddress': wifi.mac, 'signalStrength': -85},
     ])
     assert len(query.wifi) == 0
Exemplo n.º 35
0
 def test_cell_area_duplicated(self):
     cell = CellShardFactory.build()
     cell_query = self.cell_model_query([cell, cell, cell])
     cell_query[1]['cellId'] += 2
     cell_query[2]['cellId'] += 1
     query = Query(cell=cell_query)
     assert len(query.cell) == 3
     assert len(query.cell_area) == 1
Exemplo n.º 36
0
 def test_blue_duplicates(self):
     blue = BlueShardFactory.build()
     query = Query(blue=[
         {'macAddress': blue.mac, 'signalStrength': -90},
         {'macAddress': blue.mac, 'signalStrength': -82},
         {'macAddress': blue.mac, 'signalStrength': -85},
     ])
     assert len(query.blue) == 0
Exemplo n.º 37
0
    def test_mixed_cell_wifi(self):
        cells = CellShardFactory.build_batch(1)
        wifis = WifiShardFactory.build_batch(2)

        query = Query(cell=self.cell_model_query(cells),
                      wifi=self.wifi_model_query(wifis))
        assert query.expected_accuracy is DataAccuracy.high
        assert query.geoip_only is False
Exemplo n.º 38
0
 def test_cell(self):
     cell = CellFactory.build()
     query = Query(cell=[
         {'radio': cell.radio, 'mcc': cell.mcc, 'mnc': cell.mnc,
          'lac': cell.lac, 'cid': cell.cid, 'signal': -70, 'ta': 15,
          'unknown_field': 'foo'}])
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(data, {
         'cellTowers': [{
             'radioType': cell.radio.name,
             'mobileCountryCode': cell.mcc,
             'mobileNetworkCode': cell.mnc,
             'locationAreaCode': cell.lac,
             'cellId': cell.cid,
             'signalStrength': -70,
             'timingAdvance': 15,
         }],
         'fallbacks': {'lacf': True},
     })
Exemplo n.º 39
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[
         {'macAddress': wifi.mac, 'age': 2000,
          'signalStrength': -90, 'ssid': 'wifi'}
         for wifi in wifis])
     data = self._call(query.json())
     assert (data == {
         'wifiAccessPoints': [{
             'macAddress': wifis[0].mac,
             'age': 2000,
             'signalStrength': -90,
             'ssid': 'wifi',
         }, {
             'macAddress': wifis[1].mac,
             'age': 2000,
             'signalStrength': -90,
             'ssid': 'wifi',
         }],
         'fallbacks': {'lacf': True},
     })
Exemplo n.º 40
0
 def test_blue(self):
     blues = BlueShardFactory.build_batch(2)
     query = Query(blue=[
         {'macAddress': blue.mac, 'age': 1500, 'name': 'beacon',
          'signalStrength': -90}
         for blue in blues])
     data = self._call(query.json())
     assert (data == {
         'bluetoothBeacons': [{
             'macAddress': blues[0].mac,
             'age': 1500,
             'name': 'beacon',
             'signalStrength': -90,
         }, {
             'macAddress': blues[1].mac,
             'age': 1500,
             'name': 'beacon',
             'signalStrength': -90,
         }],
         'fallbacks': {'lacf': True},
     })
Exemplo n.º 41
0
 def test_wifi(self):
     wifis = WifiShardFactory.build_batch(2)
     query = Query(wifi=[
         {'macAddress': wifi.mac, 'age': 2000, 'channel': 11,
          'signalStrength': -90, 'signalToNoiseRatio': 13}
         for wifi in wifis])
     data = self._call(query.json())
     assert (data == {
         'wifiAccessPoints': [{
             'macAddress': wifis[0].mac,
             'age': 2000,
             'channel': 11,
             'signalStrength': -90,
             'signalToNoiseRatio': 13,
         }, {
             'macAddress': wifis[1].mac,
             'age': 2000,
             'channel': 11,
             'signalStrength': -90,
             'signalToNoiseRatio': 13,
         }],
         'considerIp': False,
     })
Exemplo n.º 42
0
 def test_query(self):
     query = Query()
     data = self._call(query.json())
     assert data == {'considerIp': False}
Exemplo n.º 43
0
 def test_query(self):
     query = Query()
     data = self._call(query.json())
     assert data == {'fallbacks': {'lacf': True}, 'token': None}
Exemplo n.º 44
0
 def test_query(self):
     query = Query()
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(data, {'fallbacks': {'lacf': True}})