forked from City-of-Helsinki/smbackend
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
Nimi;Osoite;N;E;Pysäköintipaikat;Invapaikat;Sähkölatauspaikat;Palvelut;Palvelut (ru);Palvelut (eng);Huom;Huom (ru);Huom (eng);Linkki sivuille | ||
Auriga;Juhana Herttuan puistokatu 21;6703305;23457449;330;2;2 x Type 2 22 kW;Apuvirta, hissi, liikkumisesteisen pysäköintipaikka, sähköauton latauspiste;Elbilsladdning, hiss, parkeringsplats för funktionshindrade, startkablar;Disabled parking, elevator, EV charging, jump leads;;;;https://www.aimopark.fi/kaupungit/turku/auriga-/ | ||
Hansakortteli;Kristiinankatu 11;6704479;23459433;162;2;2 x Type 2 11kW, 2 x CSS 90kW;Apuvirta, hissi, kameratunnistus, kengänkiillotin, liikkumisesteisen pysäköintipaikka, ostoskärryt, rengaspumppu, sateenvarjon lainaus, sähköauton latauspiste, videovalvonta, yövartiointi;Elbilsladdning, hiss, kameraparkering, kameraövervakat, kundvagnar, nattlig övervakning, paraply, parkeringsplats för funktionshindrade, skoputs, startkablar, tryckluft;Automatic number-plate recognition (ANPR), CCTV, disabled parking, elevator, EV charging, jump leads, shoe polisher, shopping trolley, surveillance at night, tyre pump, umbrella hire;Parkkihallin omalla sivulla ja aimoparkin latausverkostokartalla eriävää tietoa latauspisteistä;Information angående elbilsladdning på parkeringshusets hemsida strider mot informationen på aimoparks laddningsnätverk karta;Information regarding EV charging on the parking garage's website conflicts with the information on aimopark's charging network map;https://www.aimopark.fi/kaupungit/turku/hansakortteli/ |
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,69 @@ | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from mobility_data.importers.utils import ( | ||
get_content_type_config, | ||
get_or_create_content_type_from_config, | ||
get_root_dir, | ||
save_to_database, | ||
) | ||
from mobility_data.models import ContentType, MobileUnit | ||
|
||
|
||
@pytest.mark.django_db | ||
@patch("mobility_data.importers.parking_garages.get_full_csv_file_name") | ||
def test_import_parking_garages( | ||
get_full_csv_file_name_mock, | ||
municipalities, | ||
administrative_division_type, | ||
administrative_division, | ||
administrative_division_geometry, | ||
streets, | ||
address, | ||
): | ||
from mobility_data.importers.parking_garages import ( | ||
CONTENT_TYPE_NAME, | ||
get_parking_garage_objects, | ||
) | ||
|
||
file_name = f"{get_root_dir()}/mobility_data/tests/data/parkkihallit_fixtures.csv" | ||
get_full_csv_file_name_mock.return_value = file_name | ||
content_type = get_or_create_content_type_from_config(CONTENT_TYPE_NAME) | ||
objects = get_parking_garage_objects() | ||
num_created, num_deleted = save_to_database(objects, content_type) | ||
assert num_created == 2 | ||
assert num_deleted == 0 | ||
assert ContentType.objects.filter(type_name=CONTENT_TYPE_NAME).count() == 1 | ||
assert ( | ||
MobileUnit.objects.filter(content_types__type_name=CONTENT_TYPE_NAME).count() | ||
== 2 | ||
) | ||
config = get_content_type_config(CONTENT_TYPE_NAME) | ||
content_type = ContentType.objects.get(type_name=CONTENT_TYPE_NAME) | ||
content_type.name_fi = config["name"]["fi"] | ||
content_type.name_sv = config["name"]["sv"] | ||
content_type.name_en = config["name"]["en"] | ||
|
||
auriga = MobileUnit.objects.get(name="Auriga") | ||
assert auriga.name_sv == "Auriga" | ||
assert auriga.name_en == "Auriga" | ||
assert auriga.address_fi == "Juhana Herttuan puistokatu 21" | ||
assert auriga.address_sv == "Hertig Johans parkgata 21" | ||
assert auriga.address_en == "Juhana Herttuan puistokatu 21" | ||
assert auriga.municipality.name == "Turku" | ||
assert auriga.extra["parking_spaces"] == 330 | ||
assert auriga.extra["disabled_spaces"] == 2 | ||
assert auriga.extra["charging_stations"] == "2 x Type 2 22 kW" | ||
assert ( | ||
auriga.extra["services"]["fi"] | ||
== "Apuvirta, hissi, liikkumisesteisen pysäköintipaikka, sähköauton latauspiste" | ||
) | ||
assert ( | ||
auriga.extra["services"]["sv"] | ||
== "Elbilsladdning, hiss, parkeringsplats för funktionshindrade, startkablar" | ||
) | ||
assert ( | ||
auriga.extra["services"]["en"] | ||
== "Disabled parking, elevator, EV charging, jump leads" | ||
) |