Commit 17ca4823 authored by Niklas Selke's avatar Niklas Selke
Browse files

fixed the tests

parent 65f0b672
Pipeline #96770 passed with stages
in 54 seconds
from django.test import TestCase
from services.htap_regions_tier1.serializers import get_provenance, AggSerializer
from services.htap_regions_tier1.views import HTAPView
from services.htap_region_tier1.serializers import AggSerializer
from services.htap_region_tier1.views import HTAPRegionTier1View
import geo_location_services.settings as settings
from collections import OrderedDict
class TestSerializers(TestCase):
def test_get_provenance(self):
required_elements = ['dataset_name', 'dataset_description', 'data_source', 'datacenter_url', 'download_date',
'timestamp', 'Terms of use']
self.assertListEqual(required_elements, list(get_provenance(None).keys()))
def test_AggSerializer(self):
rawdata = OrderedDict([
("lat", settings.DEFAULT_LAT),
......@@ -25,16 +20,9 @@ class TestSerializers(TestCase):
serializer = AggSerializer(rawdata)
self.assertEqual(serializer.instance["unit"], "")
self.assertEqual(serializer.instance["radius"], 5000)
self.assertTrue(serializer.instance["get_provenance"] is get_provenance)
class TestViews(TestCase):
def test_HTAPView(self):
view = HTAPView()
self.assertEqual(view.min_valid, 2)
self.assertEqual(view.max_valid, 17)
self.assertTrue(view.AggSerializer is AggSerializer)
self.assertListEqual(view.AGG_ALLOWED, ['maxclass', 'frequency'])
self.assertEqual(view.STATS["frequency"].keywords["bins"], 16)
self.assertEqual(view.STATS["frequency"].keywords["start_bin"], 2)
def test_HTAPRegionTier1View(self):
view = HTAPRegionTier1View()
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