def test_redirect_shortlink_ok(self): self.setUp() import app.models.dynamo_db as dynamo_db # pylint: disable=import-outside-toplevel with patch.object(dynamo_db, 'get_dynamodb_table', return_value=self.__fake_get_dynamo_db()): for shortid, url in self.uuid_to_url_dict.items(): response = self.app.get( f"/v4/shortlink/shortlinks/{shortid}?redirect=true", content_type="text/html", headers={"Origin": "map.geo.admin.ch"}) self.assertEqual(response.status_code, 301) self.assertEqual(response.content_type, "text/html; charset=utf-8") TestCase().assertRedirects(response, url)