title: Flask app.config during unit testing
body: <p>What is the best way handle unit tests that rely on calling code that in turn relies on the current app's configuration?</p>
  
  <p>eg</p>
  
  <p>code.py</p>
  
  <pre><code>from flask import current_app
  
  def some_method():
      app = current_app._get_current_object()
      value = (app.config['APP_STATIC_VAR'])*10
      return value
  </code></pre>
  
  <p>test_code.py</p>
  
  <pre><code>class TestCode(unittest.TestCase):
      def test_some_method(self):
          app = create_app('app.settings.TestConfig')
          value = some_method()
          self.assertEqual(10, value)
  </code></pre>
  
  <p>Running the test above I get an 'RuntimeError: working outside of application context' error when the app = create_app('app.settings.TestConfig') line is executed. </p>
  
  <p>Calling app = create_app during the test doesn't do the trick. What is the best way to unit test in this case where I am needing the config to be read in the the application?</p>