-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mock HTTP-Requests and django file storage in tests
Additional changes: * Use requests in `for_runners/weather.py` * Cache OSM reverse requests
- Loading branch information
Showing
23 changed files
with
454 additions
and
199 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Hardcore Monkey patch to find not mocked requests ;) | ||
# But this will also break selenium tests, too. | ||
# | ||
# import socket | ||
# | ||
# class SocketMock: | ||
# def __call__(self, *args, **kwargs): | ||
# raise NotImplementedError( | ||
# 'Socket is monkeypatched in Tests!' | ||
# ) | ||
# | ||
# socket.socket = SocketMock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from pathlib import Path | ||
|
||
from django_tools.unittest_utils.assertments import assert_is_file | ||
|
||
|
||
FIXTURES_PATH = Path(__file__).parent | ||
|
||
|
||
def fixture_content(file_name, mode='rb'): | ||
file_path = FIXTURES_PATH / file_name | ||
assert_is_file(file_path) | ||
with file_path.open(mode) as f: | ||
return f.read() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"distance":95674,"title":"Zurich","location_type":"City","woeid":784794,"latt_long":"47.377060,8.539550"},{"distance":128881,"title":"Geneva","location_type":"City","woeid":782538,"latt_long":"46.208351,6.142700"},{"distance":209620,"title":"Torino","location_type":"City","woeid":725003,"latt_long":"45.070290,7.667680"},{"distance":212151,"title":"Milan","location_type":"City","woeid":718345,"latt_long":"45.468941,9.181030"},{"distance":239723,"title":"Stuttgart","location_type":"City","woeid":698064,"latt_long":"48.767670,9.171920"},{"distance":239997,"title":"Lyon","location_type":"City","woeid":609125,"latt_long":"45.759392,4.828980"},{"distance":337153,"title":"Munich","location_type":"City","woeid":676757,"latt_long":"48.136410,11.577530"},{"distance":361207,"title":"Nice","location_type":"City","woeid":614274,"latt_long":"43.701530,7.278240"},{"distance":363090,"title":"Frankfurt","location_type":"City","woeid":650272,"latt_long":"50.112080,8.683410"},{"distance":387044,"title":"Nuremberg","location_type":"City","woeid":680564,"latt_long":"49.454342,11.07349"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"distance":16638,"title":"Essen","location_type":"City","woeid":648820,"latt_long":"51.451809,7.0106"},{"distance":21601,"title":"Düsseldorf","location_type":"City","woeid":646099,"latt_long":"51.215630,6.776040"},{"distance":48430,"title":"Dortmund","location_type":"City","woeid":645458,"latt_long":"51.516609,7.458290"},{"distance":53455,"title":"Cologne","location_type":"City","woeid":667931,"latt_long":"50.941662,6.955180"},{"distance":167915,"title":"Amsterdam","location_type":"City","woeid":727232,"latt_long":"52.373119,4.893190"},{"distance":180601,"title":"Brussels","location_type":"City","woeid":968019,"latt_long":"50.848381,4.349680"},{"distance":185233,"title":"The Hague","location_type":"City","woeid":726874,"latt_long":"52.083988,4.31741"},{"distance":196720,"title":"Frankfurt","location_type":"City","woeid":650272,"latt_long":"50.112080,8.683410"},{"distance":229306,"title":"Hanover","location_type":"City","woeid":657169,"latt_long":"52.372269,9.73815"},{"distance":230669,"title":"Bremen","location_type":"City","woeid":641142,"latt_long":"53.075089,8.8047"}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"distance":27084,"title":"Essen","location_type":"City","woeid":648820,"latt_long":"51.451809,7.0106"},{"distance":27185,"title":"Düsseldorf","location_type":"City","woeid":646099,"latt_long":"51.215630,6.776040"},{"distance":58638,"title":"Dortmund","location_type":"City","woeid":645458,"latt_long":"51.516609,7.458290"},{"distance":60096,"title":"Cologne","location_type":"City","woeid":667931,"latt_long":"50.941662,6.955180"},{"distance":157369,"title":"Amsterdam","location_type":"City","woeid":727232,"latt_long":"52.373119,4.893190"},{"distance":171378,"title":"Brussels","location_type":"City","woeid":968019,"latt_long":"50.848381,4.349680"},{"distance":173776,"title":"The Hague","location_type":"City","woeid":726874,"latt_long":"52.083988,4.31741"},{"distance":206864,"title":"Frankfurt","location_type":"City","woeid":650272,"latt_long":"50.112080,8.683410"},{"distance":234707,"title":"Bremen","location_type":"City","woeid":641142,"latt_long":"53.075089,8.8047"},{"distance":237529,"title":"Hanover","location_type":"City","woeid":657169,"latt_long":"52.372269,9.73815"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"distance":482,"title":"Berlin","location_type":"City","woeid":638242,"latt_long":"52.516071,13.376980"},{"distance":147245,"title":"Leipzig","location_type":"City","woeid":671072,"latt_long":"51.3452,12.38594"},{"distance":164826,"title":"Dresden","location_type":"City","woeid":645686,"latt_long":"51.053631,13.74081"},{"distance":247187,"title":"Hanover","location_type":"City","woeid":657169,"latt_long":"52.372269,9.73815"},{"distance":253780,"title":"Hamburg","location_type":"City","woeid":656958,"latt_long":"53.553341,9.992450"},{"distance":280937,"title":"Prague","location_type":"City","woeid":796597,"latt_long":"50.079079,14.433220"},{"distance":313483,"title":"Bremen","location_type":"City","woeid":641142,"latt_long":"53.075089,8.8047"},{"distance":354694,"title":"Copenhagen","location_type":"City","woeid":554890,"latt_long":"55.676311,12.569350"},{"distance":376899,"title":"Nuremberg","location_type":"City","woeid":680564,"latt_long":"49.454342,11.07349"},{"distance":419902,"title":"Dortmund","location_type":"City","woeid":645458,"latt_long":"51.516609,7.458290"}] |
1 change: 1 addition & 0 deletions
1
src/for_runners/tests/fixture_files/metaweather_location_648820_2018_2_21.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/for_runners/tests/fixture_files/metaweather_location_648820_2018_6_20.json
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/for_runners/tests/fixture_files/nominatim_osm_reverse_0_0.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"place_id":283373754,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","osm_type":"node","osm_id":3815077900,"lat":"0","lon":"0","display_name":"Soul Buoy","address":{"man_made":"Soul Buoy"},"boundingbox":["-5.0E-5","5.0E-5","-5.0E-5","5.0E-5"]} |
Oops, something went wrong.