Skip to content

Commit

Permalink
#1: viewer form working with platform and instrument instead of source
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenwh committed Feb 4, 2019
1 parent d0d7eb4 commit ed2eb04
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions geospaas/viewer/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'))
Expand Down

0 comments on commit ed2eb04

Please sign in to comment.