Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Allow a radio type of lte for the geolocate API.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Sep 30, 2014
1 parent 574e94b commit e824123
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
1.1 (unreleased)
----------------

- Allow a radio type of `lte` for the geolocate API. Relates to
https://bugzilla.mozilla.org/show_bug.cgi?id=1010284.

- #315: Add a `show my location` control to the map.

- Reverse ordering of download files to display latest files first.
Expand Down
2 changes: 1 addition & 1 deletion ichnaea/service/geolocate/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
String,
)

RADIO_TYPE_KEYS = ['gsm', 'cdma', 'wcdma']
RADIO_TYPE_KEYS = ['gsm', 'cdma', 'wcdma', 'lte']


class CellTowerSchema(MappingSchema):
Expand Down
45 changes: 45 additions & 0 deletions ichnaea/service/geolocate/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,51 @@ def test_unknown_api_key(self):
self.check_stats(
counter=[self.metric + '.unknown_api_key'])

def test_lte_radio(self):
app = self.app
session = self.get_session()
cells = [
Cell(lat=PARIS_LAT,
lon=PARIS_LON,
radio=RADIO_TYPE['lte'],
mcc=FRANCE_MCC, mnc=1, lac=2, cid=3,
range=10000),
Cell(lat=PARIS_LAT + 0.002,
lon=PARIS_LON + 0.004,
radio=RADIO_TYPE['lte'],
mcc=FRANCE_MCC, mnc=1, lac=2, cid=4,
range=20000),
]
session.add_all(cells)
session.commit()

res = app.post_json(
'%s?key=test' % self.url, {
"radioType": "lte",
"cellTowers": [
{"radio": "lte",
"mobileCountryCode": FRANCE_MCC,
"mobileNetworkCode": 1,
"locationAreaCode": 2,
"cellId": 3},
{"radio": "lte",
"mobileCountryCode": FRANCE_MCC,
"mobileNetworkCode": 1,
"locationAreaCode": 2,
"cellId": 4},
]},
status=200)

self.check_stats(
counter=[self.metric_url + '.200', self.metric + '.api_key.test']
)

self.assertEqual(res.content_type, 'application/json')
location = res.json['location']
self.assertAlmostEquals(location['lat'], PARIS_LAT + 0.001)
self.assertAlmostEquals(location['lng'], PARIS_LON + 0.002)
self.assertEqual(res.json['accuracy'], CELL_MIN_ACCURACY)


class TestGeolocateFxOSWorkarounds(TestGeolocate):

Expand Down
2 changes: 1 addition & 1 deletion ichnaea/service/geosubmit/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)
from ichnaea.service.geolocate.schema import RADIO_TYPE_KEYS

GEOSUBMIT_RADIO_TYPE_KEYS = list(set(RADIO_TYPE_KEYS + ['lte']))
GEOSUBMIT_RADIO_TYPE_KEYS = RADIO_TYPE_KEYS


class CellTowerSchema(MappingSchema):
Expand Down

0 comments on commit e824123

Please sign in to comment.