Example #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,
     }
Example #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,
     })
Example #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
             },
         })
Example #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
         },
     })
Example #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,
     })
Example #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},
     }
Example #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},
     }
Example #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
         },
     })
Example #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,
     })
Example #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,
     })
Example #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,
     }
Example #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,
     }
Example #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,
     }
Example #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
         },
     })
Example #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
             },
         })
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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},
     })
Example #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)
Example #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)
Example #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
Example #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
Example #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)
Example #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)
Example #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},
     })
Example #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
Example #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
Example #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
Example #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
Example #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
Example #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},
     })
Example #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},
     })
Example #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},
     })
Example #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,
     })
Example #42
0
 def test_query(self):
     query = Query()
     data = self._call(query.json())
     assert data == {'considerIp': False}
Example #43
0
 def test_query(self):
     query = Query()
     data = self._call(query.json())
     assert data == {'fallbacks': {'lacf': True}, 'token': None}
Example #44
0
 def test_query(self):
     query = Query()
     data = self.schema.deserialize(query.internal_query())
     self.assertEqual(data, {'fallbacks': {'lacf': True}})