コード例 #1
0
    def test_timestamp(self):
        wifi = WifiShardFactory.build()

        data = SUBMIT_V0_SCHEMA.deserialize(
            {"items": [{"time": "2016-04-07T03:33:20", "wifi": [{"key": wifi.mac}]}]}
        )
        assert data["items"][0]["timestamp"] == 146 * 10 ** 10

        data = SUBMIT_V0_SCHEMA.deserialize(
            {"items": [{"time": "1710-02-28", "wifi": [{"key": wifi.mac}]}]}
        )
        # 1710 was discarded and replaced by 'now'
        assert data["items"][0]["timestamp"] > 10 ** 12
コード例 #2
0
ファイル: test_submit_v0.py プロジェクト: amjadm61/ichnaea
    def test_timestamp(self):
        wifi = WifiShardFactory.build()

        data = SUBMIT_V0_SCHEMA.deserialize(
            {'items': [{'time': '2016-04-07T03:33:20',
                        'wifi': [{'key': wifi.mac}]}]})
        assert data['items'][0]['timestamp'] == 146 * 10 ** 10

        data = SUBMIT_V0_SCHEMA.deserialize(
            {'items': [{'time': '1710-02-28',
                        'wifi': [{'key': wifi.mac}]}]})
        # 1710 was discarded and replaced by 'now'
        assert data['items'][0]['timestamp'] > 10 ** 12
    def test_timestamp(self):
        wifi = WifiShardFactory.build()

        data = SUBMIT_V0_SCHEMA.deserialize(
            {'items': [{'time': '2016-04-07T03:33:20',
                        'wifi': [{'key': wifi.mac}]}]})
        assert data['items'][0]['timestamp'] == 146 * 10 ** 10

        data = SUBMIT_V0_SCHEMA.deserialize(
            {'items': [{'time': '1710-02-28',
                        'wifi': [{'key': wifi.mac}]}]})
        # 1710 was discarded and replaced by 'now'
        assert data['items'][0]['timestamp'] > 10 ** 12
コード例 #4
0
ファイル: test_submit_v0.py プロジェクト: amjadm61/ichnaea
 def test_minimal(self):
     wifi = WifiShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize(
         {'items': [{'lat': wifi.lat, 'lon': wifi.lon,
                     'wifi': [{'key': 'ab'}]}]})
     assert 'items' in data
     assert len(data['items']) == 1
コード例 #5
0
 def test_minimal(self):
     wifi = WifiShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize(
         {"items": [{"lat": wifi.lat, "lon": wifi.lon, "wifi": [{"key": "ab"}]}]}
     )
     assert "items" in data
     assert len(data["items"]) == 1
 def test_minimal(self):
     wifi = WifiShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize(
         {'items': [{'lat': wifi.lat, 'lon': wifi.lon,
                     'wifi': [{'key': 'ab'}]}]})
     assert 'items' in data
     assert len(data['items']) == 1
コード例 #7
0
ファイル: test_submit_v0.py プロジェクト: amjadm61/ichnaea
    def test_cell_radio(self):
        cell = CellShardFactory.build()
        data = SUBMIT_V0_SCHEMA.deserialize({'items': [
            {'lat': cell.lat, 'lon': cell.lon, 'cell': [{
                'radio': 'UMTS', 'mcc': cell.mcc, 'mnc': cell.mnc,
                'lac': cell.lac, 'cid': cell.cid,
            }]}
        ]})
        assert data['items'][0]['cellTowers'][0]['radioType'] == 'wcdma'

        cell = CellShardFactory.build()
        data = SUBMIT_V0_SCHEMA.deserialize({'items': [
            {'lat': cell.lat, 'lon': cell.lon, 'cell': [{
                'radio': 'foo', 'mcc': cell.mcc, 'mnc': cell.mnc,
                'lac': cell.lac, 'cid': cell.cid,
            }]}
        ]})
        assert 'radioType' not in data['items'][0]['cellTowers'][0]
    def test_cell_radio(self):
        cell = CellShardFactory.build()
        data = SUBMIT_V0_SCHEMA.deserialize({'items': [
            {'lat': cell.lat, 'lon': cell.lon, 'cell': [{
                'radio': 'UMTS', 'mcc': cell.mcc, 'mnc': cell.mnc,
                'lac': cell.lac, 'cid': cell.cid,
            }]}
        ]})
        assert data['items'][0]['cellTowers'][0]['radioType'] == 'wcdma'

        cell = CellShardFactory.build()
        data = SUBMIT_V0_SCHEMA.deserialize({'items': [
            {'lat': cell.lat, 'lon': cell.lon, 'cell': [{
                'radio': 'foo', 'mcc': cell.mcc, 'mnc': cell.mnc,
                'lac': cell.lac, 'cid': cell.cid,
            }]}
        ]})
        assert 'radioType' not in data['items'][0]['cellTowers'][0]
コード例 #9
0
 def test_empty_wifi_entry(self):
     wifi = WifiShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize(
         {"items": [{
             "lat": wifi.lat,
             "lon": wifi.lon,
             "wifi": [{}]
         }]})
     assert data == {"items": []}
コード例 #10
0
 def test_empty_blue_entry(self):
     blue = BlueShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize(
         {"items": [{
             "lat": blue.lat,
             "lon": blue.lon,
             "blue": [{}]
         }]})
     assert data == {"items": []}
コード例 #11
0
    def test_cell_radio(self):
        cell = CellShardFactory.build()
        data = SUBMIT_V0_SCHEMA.deserialize(
            {
                "items": [
                    {
                        "lat": cell.lat,
                        "lon": cell.lon,
                        "cell": [
                            {
                                "radio": "UMTS",
                                "mcc": cell.mcc,
                                "mnc": cell.mnc,
                                "lac": cell.lac,
                                "cid": cell.cid,
                            }
                        ],
                    }
                ]
            }
        )
        assert data["items"][0]["cellTowers"][0]["radioType"] == "wcdma"

        cell = CellShardFactory.build()
        data = SUBMIT_V0_SCHEMA.deserialize(
            {
                "items": [
                    {
                        "lat": cell.lat,
                        "lon": cell.lon,
                        "cell": [
                            {
                                "radio": "foo",
                                "mcc": cell.mcc,
                                "mnc": cell.mnc,
                                "lac": cell.lac,
                                "cid": cell.cid,
                            }
                        ],
                    }
                ]
            }
        )
        assert "radioType" not in data["items"][0]["cellTowers"][0]
コード例 #12
0
ファイル: test_submit_v0.py プロジェクト: amjadm61/ichnaea
 def test_empty_wifi_entry(self):
     wifi = WifiShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize({'items': [
         {'lat': wifi.lat, 'lon': wifi.lon, 'wifi': [{}]},
     ]})
     assert data == {'items': []}
コード例 #13
0
ファイル: test_submit_v0.py プロジェクト: amjadm61/ichnaea
 def test_empty(self):
     with pytest.raises(colander.Invalid):
         SUBMIT_V0_SCHEMA.deserialize({})
 def test_empty_wifi_entry(self):
     wifi = WifiShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize({'items': [
         {'lat': wifi.lat, 'lon': wifi.lon, 'wifi': [{}]},
     ]})
     assert data == {'items': []}
コード例 #15
0
ファイル: test_submit_v0.py プロジェクト: amjadm61/ichnaea
 def test_empty_blue_entry(self):
     blue = BlueShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize({'items': [
         {'lat': blue.lat, 'lon': blue.lon, 'blue': [{}]},
     ]})
     assert data == {'items': []}
 def test_empty_blue_entry(self):
     blue = BlueShardFactory.build()
     data = SUBMIT_V0_SCHEMA.deserialize({'items': [
         {'lat': blue.lat, 'lon': blue.lon, 'blue': [{}]},
     ]})
     assert data == {'items': []}
 def test_empty(self):
     with pytest.raises(colander.Invalid):
         SUBMIT_V0_SCHEMA.deserialize({})