Ejemplo n.º 1
0
    def test_well_detail_ok(self):
        wells = Search.well_search(123, '', '', '')
        self.assertEqual(wells.count(), 1)

        url = reverse('well_detail', kwargs={'pk': 123})
        response = self.client.get(url)
        self.assertEqual(response.status_code, HTTPStatus.OK)
Ejemplo n.º 2
0
 def test_well_search_gps(self):
     """ Check that a bounding box can be specified as search criteria """
     lat_long_box = {
         'start_corner': '48.418466095707046,-123.36755990982056',
         'end_corner': '48.41493417062313,-123.36180925369264'
     }
     wells = Search.well_search('', '', '', '', lat_long_box)
     self.assertEqual(wells.count(), 2)
Ejemplo n.º 3
0
    def process(self):
        well_results = None

        well = self.cleaned_data.get('well')
        addr = self.cleaned_data.get('addr')
        legal = self.cleaned_data.get('legal')
        owner = self.cleaned_data.get('owner')
        start_lat_long = self.cleaned_data.get('start_lat_long')
        end_lat_long = self.cleaned_data.get('end_lat_long')
        lat_long_box = {'start_corner': start_lat_long, 'end_corner': end_lat_long}

        well_results = Search.well_search(well, addr, legal, owner, lat_long_box, self.WELL_RESULTS_LIMIT)

        return well_results
Ejemplo n.º 4
0
 def test_well_search_none_params(self):
     wells = Search.well_search(None, None, None, None)
     self.assertIsNone(wells)
Ejemplo n.º 5
0
 def test_well_search_empty_string_params(self):
     wells = Search.well_search('', '', '', '')
     self.assertIsNone(wells)
Ejemplo n.º 6
0
 def test_well_search_params_named_positional(self):
     named = Search.well_search(addr='gov')
     positional = Search.well_search('', 'gov', '', '')
     self.assertEqual(named.count(), positional.count())
Ejemplo n.º 7
0
 def test_well_search_well_number_owner(self):
     wells = Search.well_search('123', '', '', 'john')
     self.assertEqual(wells.count(), 1)
Ejemplo n.º 8
0
 def test_well_search_owner(self):
     wells = Search.well_search('', '', '', 'smi')
     self.assertEqual(wells.count(), 2)
Ejemplo n.º 9
0
 def test_well_search_legal(self):
     wells = Search.well_search('', '', '78', '')
     self.assertEqual(wells.count(), 2)
Ejemplo n.º 10
0
 def test_well_search_address(self):
     wells = Search.well_search('', 'gov', '', '')
     self.assertEqual(wells.count(), 1)
Ejemplo n.º 11
0
 def test_well_search_well_number(self):
     wells = Search.well_search('1', '', '', '')
     self.assertEqual(wells.count(), 2)