class MyViewTestCase(TestCase):

    def create_app(self):
        return create_app()

def test_get_success(self):
    response = self.client.get('/pgt/myview')
self.assertEqual(self.get_context_variable('var1'), 'value 1')
How to test template context variables with Flask