From bff8339da54224de3515285972051f888bddd6f2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 11 Jun 2021 12:42:07 +0100 Subject: [PATCH] Seattle test --- locations.txt | 3 +- locations_nogo.txt | 4 +++ tests.py | 86 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/locations.txt b/locations.txt index da0db7945..43bec85a4 100644 --- a/locations.txt +++ b/locations.txt @@ -1285,7 +1285,6 @@ BAUDETTE, USA:48.7283:W94.6122 WINDSOR LOCKS, USA:41.9389:W72.6831 STRATFORD, USA:41.1633:W73.1261 BEDFORD, USA:42.4697:W71.2889 -SEATTLE, USA:47.5297:W122.302:217 BAKERSFIELD, USA:35.4333:W119.057 MOBILE, USA:30.6264:W88.0678 BANGOR, USA:44.8072:W68.8281 @@ -1594,7 +1593,7 @@ GWINN, USA:46.3536:W87.3958 SANTA BARBARA, USA:32.6083:W82.3686 SALISBURY, USA:38.3403:W75.5103 STOCKTON, USA:37.8942:W121.239 -SEATTLE, USA:47.59840153253106:W122.31143714060059 +SEATTLE, USA:47.59840153253106:W122.31143714060059:217 SELMA, USA:32.3439:W86.9878 SPOKANE, USA:47.6828:W117.322 SAN FRANCISCO, USA:37.74594738515095:W122.44299445520019:121 diff --git a/locations_nogo.txt b/locations_nogo.txt index 4349505ef..dc7a19687 100644 --- a/locations_nogo.txt +++ b/locations_nogo.txt @@ -13,3 +13,7 @@ SAN JOSE, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37 OAKLAND, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37.505, 122.056W,37.54, 122.077W,37.578, 122.098W,37.618, 122.131W,37.637, 122.189W,37.706, 122.227W,37.775, 122.279W,37.798, 122.315W,37.802, 122.291W,37.832, 122.309W,37.902, 122.382W,37.915, 122.368W,37.927, 122.514W,37.882, 122.473W,37.83, 122.481W,37.788, 122.394W,37.796, 122.384W,37.729, 122.4W,37.688, 122.382W,37.654, 122.406W,37.637, 122.392W,37.612, 122.356W,37.586, 122.332W,37.586, 122.275W,37.529, 122.228W,37.488, 122.181W,37.482, 122.134W,37.48, 122.128W,37.471, 122.122W,37.448, 122.095W,37.428, 122.07W,37.413, 122.036W,37.402, 122.035W,37.421 SAN FRANCISCO, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37.505, 122.056W,37.54, 122.077W,37.578, 122.098W,37.618, 122.131W,37.637, 122.189W,37.706, 122.227W,37.775, 122.279W,37.798, 122.315W,37.802, 122.291W,37.832, 122.309W,37.902, 122.382W,37.915, 122.368W,37.927, 122.514W,37.882, 122.473W,37.83, 122.481W,37.788, 122.394W,37.796, 122.384W,37.729, 122.4W,37.688, 122.382W,37.654, 122.406W,37.637, 122.392W,37.612, 122.356W,37.586, 122.332W,37.586, 122.275W,37.529, 122.228W,37.488, 122.181W,37.482, 122.134W,37.48, 122.128W,37.471, 122.122W,37.448, 122.095W,37.428, 122.07W,37.413, 122.036W,37.402, 122.035W,37.421 SAN FRANCISCO, USA: 122.446W,37.794, 122.511W,37.778, 122.51W,37.771, 122.454W,37.775, 122.452W,37.766, 122.510W,37.763, 122.506W,37.735, 122.498W,37.733, 122.496W,37.729, 122.491W,37.729, 122.475W,37.73, 122.474W,37.72, 122.484W,37.72, 122.485W,37.703, 122.495W,37.702, 122.493W,37.679, 122.486W,37.667, 122.492W,37.664, 122.493W,37.629, 122.456W,37.625, 122.450W,37.617, 122.455W,37.621, 122.41W,37.586, 122.383W,37.561, 122.335W,37.509, 122.655W,37.48, 122.67W,37.9, 122.272W,37.93, 122.294W,37.801, 122.448W,37.804 +SEATTLE, USA: 122.247W,47.918, 122.39W,47.802, 122.389W,47.769, 122.377W,47.758, 122.371W,47.726, 122.379W,47.706, 122.4W,47.696, 122.405W,47.673, 122.416W,47.65, 122.414W,47.642, 122.391W,47.632, 122.373W,47.633, 122.336W,47.602, 122.288W,47.501, 122.299W,47.503, 122.386W,47.592, 122.412W,47.574, 122.394W,47.549, 122.388W,47.507, 122.35W,47.481, 122.365W,47.459, 122.33W,47.406, 122.323W,47.392, 122.321W,47.346, 122.441W,47.302, 122.696W,47.085, 122.926W,47.066, 122.929W,48.383 +SEATTLE, USA: 122.267W,47.758, 122.29W,47.471, 122.272W,47.693, 122.256W,47.672, 122.278W,47.652, 122.29W,47.583, 122.262W,47.548, 122.265W,47.52, 122.218W,47.498, 122.194W,47.501, 122.193W,47.55, 122.173W,47.58, 122.22W,47.617, 122.238W,47.617, 122.239W,47.637, 122.2W,47.644, 122.207W,47.703, 122.22W,47.705, 122.231W,47.699, 122.255W,47.751 +SEATTLE, USA: 122.347W,47.675, 122.344W,47.681, 122.337W,47.685, 122.324W,47.679, 122.331W,47.677, 122.34W,47.669, 122.34W,47.664, 122.348W,47.665 +SEATTLE, USA: 122.423W,47.669, 122.345W,47.641, 122.34W,47.625, 122.327W,47.626, 122.274W,47.64, 122.268W,47.654, 122.327W,47.654, 122.336W,47.647, 122.429W,47.684 diff --git a/tests.py b/tests.py index 478c4da1b..91043e0af 100644 --- a/tests.py +++ b/tests.py @@ -3631,7 +3631,8 @@ def testSpoofGeolocation() -> None: 'MANCHESTER, ENGLAND:53.4794892:W2.2451148:1276', 'BERLIN, GERMANY:52.5170365:13.3888599:891', 'ANKARA, TURKEY:39.93:32.85:24521', - 'LONDON, ENGLAND:51.5073219:W0.1276474:1738' + 'LONDON, ENGLAND:51.5073219:W0.1276474:1738', + 'SEATTLE, USA:47.59840153253106:W122.31143714060059:217' ] testSquare = [ [[0.03, 0.01], [0.02, 10], [10.01, 10.02], [10.03, 0.02]] @@ -3743,10 +3744,32 @@ def testSpoofGeolocation() -> None: kmlStr += '\n' nogoLine = \ - 'SAN FRANCISCO, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37.505, 122.056W,37.54, 122.077W,37.578, 122.098W,37.618, 122.131W,37.637, 122.189W,37.706, 122.227W,37.775, 122.279W,37.798, 122.315W,37.802, 122.291W,37.832, 122.309W,37.902, 122.382W,37.915, 122.368W,37.927, 122.514W,37.882, 122.473W,37.83, 122.481W,37.788, 122.394W,37.796, 122.384W,37.729, 122.4W,37.688, 122.382W,37.654, 122.406W,37.637, 122.392W,37.612, 122.356W,37.586, 122.332W,37.586, 122.275W,37.529, 122.228W,37.488, 122.181W,37.482, 122.134W,37.48, 122.128W,37.471, 122.122W,37.448, 122.095W,37.428, 122.07W,37.413, 122.036W,37.402, 122.035W,37.421' + 'SAN FRANCISCO, USA: 121.988W,37.408, 121.924W,37.452, ' + \ + '121.951W,37.498, 121.992W,37.505, 122.056W,37.54, ' + \ + '122.077W,37.578, 122.098W,37.618, 122.131W,37.637, ' + \ + '122.189W,37.706, 122.227W,37.775, 122.279W,37.798, ' + \ + '122.315W,37.802, 122.291W,37.832, 122.309W,37.902, ' + \ + '122.382W,37.915, 122.368W,37.927, 122.514W,37.882, ' + \ + '122.473W,37.83, 122.481W,37.788, 122.394W,37.796, ' + \ + '122.384W,37.729, 122.4W,37.688, 122.382W,37.654, ' + \ + '122.406W,37.637, 122.392W,37.612, 122.356W,37.586, ' + \ + '122.332W,37.586, 122.275W,37.529, 122.228W,37.488, ' + \ + '122.181W,37.482, 122.134W,37.48, 122.128W,37.471, ' + \ + '122.122W,37.448, 122.095W,37.428, 122.07W,37.413, ' + \ + '122.036W,37.402, 122.035W,37.421' polygon = parseNogoString(nogoLine) nogoLine2 = \ - 'SAN FRANCISCO, USA: 122.446W,37.794, 122.511W,37.778, 122.51W,37.771, 122.454W,37.775, 122.452W,37.766, 122.510W,37.763, 122.506W,37.735, 122.498W,37.733, 122.496W,37.729, 122.491W,37.729, 122.475W,37.73, 122.474W,37.72, 122.484W,37.72, 122.485W,37.703, 122.495W,37.702, 122.493W,37.679, 122.486W,37.667, 122.492W,37.664, 122.493W,37.629, 122.456W,37.625, 122.450W,37.617, 122.455W,37.621, 122.41W,37.586, 122.383W,37.561, 122.335W,37.509, 122.655W,37.48, 122.67W,37.9, 122.272W,37.93, 122.294W,37.801, 122.448W,37.804' + 'SAN FRANCISCO, USA: 122.446W,37.794, 122.511W,37.778, ' + \ + '122.51W,37.771, 122.454W,37.775, 122.452W,37.766, ' + \ + '122.510W,37.763, 122.506W,37.735, 122.498W,37.733, ' + \ + '122.496W,37.729, 122.491W,37.729, 122.475W,37.73, ' + \ + '122.474W,37.72, 122.484W,37.72, 122.485W,37.703, ' + \ + '122.495W,37.702, 122.493W,37.679, 122.486W,37.667, ' + \ + '122.492W,37.664, 122.493W,37.629, 122.456W,37.625, ' + \ + '122.450W,37.617, 122.455W,37.621, 122.41W,37.586, ' + \ + '122.383W,37.561, 122.335W,37.509, 122.655W,37.48, ' + \ + '122.67W,37.9, 122.272W,37.93, 122.294W,37.801, ' + \ + '122.448W,37.804' polygon2 = parseNogoString(nogoLine2) nogoList = [polygon, polygon2] for i in range(1000): @@ -3771,6 +3794,61 @@ def testSpoofGeolocation() -> None: kmlStr += ' \n' kmlStr += '\n' + nogoLine = \ + 'SEATTLE, USA: 122.247W,47.918, 122.39W,47.802, ' + \ + '122.389W,47.769, 122.377W,47.758, 122.371W,47.726, ' + \ + '122.379W,47.706, 122.4W,47.696, 122.405W,47.673, ' + \ + '122.416W,47.65, 122.414W,47.642, 122.391W,47.632, ' + \ + '122.373W,47.633, 122.336W,47.602, 122.288W,47.501, ' + \ + '122.299W,47.503, 122.386W,47.592, 122.412W,47.574, ' + \ + '122.394W,47.549, 122.388W,47.507, 122.35W,47.481, ' + \ + '122.365W,47.459, 122.33W,47.406, 122.323W,47.392, ' + \ + '122.321W,47.346, 122.441W,47.302, 122.696W,47.085, ' + \ + '122.926W,47.066, 122.929W,48.383' + polygon = parseNogoString(nogoLine) + nogoLine2 = \ + 'SEATTLE, USA: 122.267W,47.758, 122.29W,47.471, ' + \ + '122.272W,47.693, 122.256W,47.672, 122.278W,47.652, ' + \ + '122.29W,47.583, 122.262W,47.548, 122.265W,47.52, ' + \ + '122.218W,47.498, 122.194W,47.501, 122.193W,47.55, ' + \ + '122.173W,47.58, 122.22W,47.617, 122.238W,47.617, ' + \ + '122.239W,47.637, 122.2W,47.644, 122.207W,47.703, ' + \ + '122.22W,47.705, 122.231W,47.699, 122.255W,47.751' + polygon2 = parseNogoString(nogoLine2) + nogoLine3 = \ + 'SEATTLE, USA: 122.347W,47.675, 122.344W,47.681, ' + \ + '122.337W,47.685, 122.324W,47.679, 122.331W,47.677, ' + \ + '122.34W,47.669, 122.34W,47.664, 122.348W,47.665' + polygon3 = parseNogoString(nogoLine3) + nogoLine4 = \ + 'SEATTLE, USA: 122.423W,47.669, 122.345W,47.641, ' + \ + '122.34W,47.625, 122.327W,47.626, 122.274W,47.64, ' + \ + '122.268W,47.654, 122.327W,47.654, 122.336W,47.647, ' + \ + '122.429W,47.684' + polygon4 = parseNogoString(nogoLine4) + nogoList = [polygon, polygon2, polygon3, polygon4] + for i in range(1000): + dayNumber = randint(10, 30) + hour = randint(1, 23) + hourStr = str(hour) + if hour < 10: + hourStr = '0' + hourStr + currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) + + " " + hourStr + ":14", + "%Y-%m-%d %H:%M") + coords = spoofGeolocation('', 'SEATTLE, USA', currTime, + decoySeed, citiesList, nogoList) + longitude = coords[1] + if coords[3] == 'W': + longitude = -coords[1] + kmlStr += '\n' + kmlStr += ' ' + str(i) + '\n' + kmlStr += ' \n' + kmlStr += ' ' + str(longitude) + ',' + \ + str(coords[0]) + ',0\n' + kmlStr += ' \n' + kmlStr += '\n' + kmlStr += '\n' kmlStr += '' kmlFile = open('unittest_decoy.kml', 'w+') @@ -3831,8 +3909,6 @@ def testRoles() -> None: def runAllTests(): print('Running tests...') - testSpoofGeolocation() - return updateDefaultThemesList(os.getcwd()) testFunctions() testRoles()