def test_url_shortened(self): from max.utils.formatting import shortenURL http_mock_bitly() url = 'http://example.com' newurl = shortenURL(url) self.assertEqual(newurl, "http://shortened.url")
def test_url_shortened_parsing_failure(self): from max.utils.formatting import shortenURL http_mock_bitly(status=500, body="invalid json") url = 'http://example.com' newurl = shortenURL(url) self.assertEqual(url, newurl)
def test_url_shortened_parsing_failure(self): from max.utils.formatting import shortenURL http_mock_bitly(status=500, body="invalid json") url = 'http://example.com' bitly_username = '******' bitly_api_key = 'R_1123ce7d9aea4d699f65af02912c048e' newurl = shortenURL(url, bitly_username, bitly_api_key) self.assertEqual(url, newurl)
def test_url_secure_shortened(self): from max.utils.formatting import shortenURL http_mock_bitly() url = 'http://example.com' bitly_username = '******' bitly_api_key = 'R_1123ce7d9aea4d699f65af02912c048e' newurl = shortenURL(url, bitly_username, bitly_api_key, secure=True) self.assertEqual(newurl, "https://shortened.url")