def test_iframe_cache(self): route = self.make_route() request = self.make_request( 'GET', '/sm/', headers=CIMultiDict({'IF-NONE-MATCH': 'test'})) response = route.iframe(request) self.assertEqual(response.status, 304)
def test_iframe(self): route = self.make_route() request = self.make_request('GET', '/sm/') response = route.iframe(request) text = """<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script> document.domain = document.domain; _sockjs_onload = function(){SockJS.bootstrap_iframe();}; </script> <script src="http:sockjs-cdn"></script> </head> <body> <h2>Don't panic!</h2> <p>This is a SockJS hidden iframe. It's used for cross domain magic.</p> </body> </html>""" self.assertEqual(response.body.decode('utf-8'), text) self.assertIn('ETag', response.headers)