From ed2eb045c05a761d6da3ed81ad6052c61cefad4c Mon Sep 17 00:00:00 2001 From: "Morten W. Hansen" Date: Mon, 4 Feb 2019 18:26:35 +0100 Subject: [PATCH] #1: viewer form working with platform and instrument instead of source --- geospaas/viewer/tests.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/geospaas/viewer/tests.py b/geospaas/viewer/tests.py index b8010a06..66b6d7ae 100644 --- a/geospaas/viewer/tests.py +++ b/geospaas/viewer/tests.py @@ -38,7 +38,7 @@ def test_search_model(self): search = Search(sdate=sdate, date0=date0, date1=date1, polygon=polygon) search.save() - search.source.add(source) + search.platform.add(source.platform) search.save() self.assertEqual(search.date0, date0) self.assertIsInstance(search.__str__(), str) @@ -104,30 +104,29 @@ def setUp(self): date0 = timezone.datetime(2010,1,1, tzinfo=timezone.utc).date() date1 = timezone.datetime(2011,1,1, tzinfo=timezone.utc).date() source = Source.objects.get(pk=1) - import ipdb - ipdb.set_trace() self.valid_form = { 'polygon': str(Polygon(((0, 0), (0, 10), (10, 10), (10, 0), (0, 0)))), #loc.geometry, 'date0': date0, 'date1': date1, - 'platform': source.platform, - 'instrument': source.instrument + 'platform': [source.platform.id], + 'instrument': [source.instrument.id] } self.invalid_form = { 'polygon': 1, 'date0': date0, 'date1': date1, - 'platform': source.platform, - 'instrument': source.instrument + 'platform': source.platform.id, + 'instrument': source.instrument.id } def test_search_form(self): form = forms.SearchForm(data=self.valid_form) - import ipdb - ipdb.set_trace() self.failUnless(form.is_valid()) + def test_search_by_parameter(self): + pass + def test_search_loads(self): # this also tests urls.py... response = self.client.get(reverse('geospaas:viewer:index'))