Commit f61c90c5 authored by Niklas Selke's avatar Niklas Selke
Browse files

modified the NOx emissions service

parent 1d0187f8
Pipeline #97123 passed with stages
in 49 seconds
from django.apps import AppConfig
class NoxEmissionsConfig(AppConfig): # pragma: no cover
class NOxEmissionsConfig(AppConfig): # pragma: no cover
name = 'services.nox_emissions'
"""serializer for nox emissions data
"""serializer for NOx emissions data
"""
from utils.agg_serializer import GeneralAggSerializer
......
from django.test import TestCase
from services.nox_emissions.serializers import AggSerializer
from services.nox_emissions.views import NoxEmissionsView
from services.nox_emissions.views import NOxEmissionsView
import geo_location_services.settings as settings
from collections import OrderedDict
......@@ -24,9 +24,9 @@ class TestSerializers(TestCase):
class TestViews(TestCase):
def test_NoxEmissionsView(self):
view = NoxEmissionsView()
self.assertEqual(view.min_valid, 0)
def test_NOxEmissionsView(self):
view = NOxEmissionsView()
self.assertEqual(view.min_valid, 0.)
self.assertEqual(view.max_valid, 2.e6)
self.assertTrue(view.AggSerializer is AggSerializer)
self.assertListEqual(view.AGG_ALLOWED, ['mean', 'min', 'max', 'median', 'percentile', 'sum', 'stddev'])
from django.urls import re_path
from .views import NoxEmissionsView
from .views import NOxEmissionsView
urlpatterns = [
re_path(r'^$', NoxEmissionsView.as_view()),
re_path(r'^$', NOxEmissionsView.as_view()),
]
......@@ -3,7 +3,7 @@ from rest_framework.views import APIView
# from services.file_extractions.nox_emissions_file_extraction import read_proxydata
from .serializers import AggSerializer
from utils.views_commons import CommonViewsWithYear
from .apps import NoxEmissionsConfig as Config
from .apps import NOxEmissionsConfig as Config
# if USE_LOCAL_DATA: # pragma: no cover
......@@ -16,11 +16,13 @@ from .apps import NoxEmissionsConfig as Config
# print("File %s successfully loaded" % FILENAME, datainfo)
class NoxEmissionsView(APIView, CommonViewsWithYear):
class NOxEmissionsView(APIView, CommonViewsWithYear):
def __init__(self):
opts = dict(min_valid=0.,
opts = dict(default_value=0.,
out_of_bounds_value=0.,
min_valid=0.,
max_valid=2.e6,
serializer=AggSerializer,
service_type=Config.name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment