def test_minify_and_expand(self): test_url = 'https://micropyramid.com/' minified_url = google_mini(test_url, GOOGLE_API_KEY) self.assertTrue(minified_url) expanded_url = google_expand(minified_url, GOOGLE_API_KEY) self.assertEqual(test_url, expanded_url)
def test_wrong_google_key(self): with self.assertRaises(KeyError): google_mini('https://micropyramid.com/', WRONG_GOOGLE_API_KEY)
def test_wrong_url(self): with self.assertRaises(KeyError): google_mini('wrong urlpattern', GOOGLE_API_KEY)
def test_correct_google_key(self): result = google_mini('https://micropyramid.com/', GOOGLE_API_KEY) self.assertTrue(result)