Beispiel #1
0
    def test_google_maps_api_failure(self):
        traffic = Traffic("blah, blah", "ha, ha")
        traffic.gmaps.distance_matrix = MagicMock(
            side_effect=Exception("stuff's broke"))
        traffic.make_google_api_call()
        self.assertEqual(traffic.duration, "Unavailable")

        actual = traffic.time_in_hours_and_minutes(seconds)
        expected = {"hours": hours, "minutes": minutes}

        self.assertEqual(actual, expected)
Beispiel #2
0
    def test_convert_seconds_to_hours_and_minutes(self):
        seconds = 55555
        hours = "15"
        minutes = "25"

        traffic = Traffic("blah", "blah")

        actual = traffic.time_in_hours_and_minutes(seconds)
        expected = {"hours": hours, "minutes": minutes}

        self.assertEqual(actual, expected)