Esempio n. 1
0
class GetQueryParametersTestCase(EngineerTestCase):
    """
    Tests methods for retrieving query parameters.
    """
    def setUp(self):
        super(GetQueryParametersTestCase, self).setUp()
        self.engineer = Engineer(query=self.query, specs=PipeSpecSheet())

    def test_get_accounts(self):
        """
        Tests the get_accounts method.
        """
        accounts = self.engineer.get_accounts()
        self.assertEqual(len(accounts), 2)

    def test_get_locations(self):
        """
        Tests the get_locations method.
        """
        locations = self.engineer.get_locations()
        self.assertEqual(len(locations), 4)

    def test_get_searchterms(self):
        """
        Tests the get_searchterms method.
        """
        searchterms = self.engineer.get_searchterms()
        self.assertEqual(len(searchterms), 3)
Esempio n. 2
0
    def test_format_for_box(self):
        """
        Tests the format_locations method for a 'box' location_format.
        """
        query = ReservoirQuery(locations=self.locations)
        specs = PipeSpecSheet(location_format='box')
        engineer = Engineer(query=query, specs=specs)
        engineer._format_locations()

        all_boxes = False
        for new_location in engineer.get_locations():
            if new_location.shape == 'Rectangle':
                all_boxes = True
            else:
                all_boxes = False
                break

        self.assertTrue(all_boxes)
Esempio n. 3
0
    def test_format_for_radius(self):
        """
        Tests the format_locations method for a 'radius' location_format.
        """
        query = ReservoirQuery(locations=self.locations)
        specs = PipeSpecSheet(location_format='radius', radius_limit_km=100)
        engineer = Engineer(query=query, specs=specs)
        engineer._format_locations()

        all_circles = False
        for new_location in engineer.get_locations():
            if new_location.shape == 'Circle':
                all_circles = True
            else:
                all_circles = False
                break

        self.assertTrue(all_circles)