from marvin import create_app

import unittest

class AppCreationTest(unittest.TestCase):

    def test_create_app(self):
        app = create_app(MY_CONFIG_VALUE='foo')
        self.assertEqual(app.config['MY_CONFIG_VALUE'], 'foo')

from marvin import create_app

import os
import tempfile
import unittest

class AppCreationTest(unittest.TestCase):

    def setUp(self):
        self.config_file = tempfile.NamedTemporaryFile(delete=False)
        self.config_file.write('OTHER_CONFIG = "bar"'.encode('utf-8'))
        self.config_file.close()


    def tearDown(self):
        os.remove(self.config_file.name)


    def test_create_app(self):
        app = create_app(MY_CONFIG_VALUE='foo')
        self.assertEqual(app.config['MY_CONFIG_VALUE'], 'foo')


    def test_create_app_with_config_file(self):
        app = create_app(self.config_file.name)
        self.assertEqual(app.config['OTHER_CONFIG'], 'bar')


    def test_create_app_both(self):
        app = create_app(self.config_file.name, EXTRA_PARAM='baz')
        self.assertEqual(app.config['OTHER_CONFIG'], 'bar')
        self.assertEqual(app.config['EXTRA_PARAM'], 'baz')

Add test for app creation with config file.
Add test for app creation with config file.

Also be explicit about encoding when writing to file.

  from marvin import create_app
  
+ import os
+ import tempfile
  import unittest
  
  class AppCreationTest(unittest.TestCase):
+ 
+     def setUp(self):
+         self.config_file = tempfile.NamedTemporaryFile(delete=False)
+         self.config_file.write('OTHER_CONFIG = "bar"'.encode('utf-8'))
+         self.config_file.close()
+ 
+ 
+     def tearDown(self):
+         os.remove(self.config_file.name)
+ 
  
      def test_create_app(self):
          app = create_app(MY_CONFIG_VALUE='foo')
          self.assertEqual(app.config['MY_CONFIG_VALUE'], 'foo')
  
+ 
+     def test_create_app_with_config_file(self):
+         app = create_app(self.config_file.name)
+         self.assertEqual(app.config['OTHER_CONFIG'], 'bar')
+ 
+ 
+     def test_create_app_both(self):
+         app = create_app(self.config_file.name, EXTRA_PARAM='baz')
+         self.assertEqual(app.config['OTHER_CONFIG'], 'bar')
+         self.assertEqual(app.config['EXTRA_PARAM'], 'baz')
+ 
Add test for app creation with config file.
## Code Before:
from marvin import create_app

import unittest

class AppCreationTest(unittest.TestCase):

    def test_create_app(self):
        app = create_app(MY_CONFIG_VALUE='foo')
        self.assertEqual(app.config['MY_CONFIG_VALUE'], 'foo')

## Instruction:
Add test for app creation with config file.
## Code After:
from marvin import create_app

import os
import tempfile
import unittest

class AppCreationTest(unittest.TestCase):

    def setUp(self):
        self.config_file = tempfile.NamedTemporaryFile(delete=False)
        self.config_file.write('OTHER_CONFIG = "bar"'.encode('utf-8'))
        self.config_file.close()


    def tearDown(self):
        os.remove(self.config_file.name)


    def test_create_app(self):
        app = create_app(MY_CONFIG_VALUE='foo')
        self.assertEqual(app.config['MY_CONFIG_VALUE'], 'foo')


    def test_create_app_with_config_file(self):
        app = create_app(self.config_file.name)
        self.assertEqual(app.config['OTHER_CONFIG'], 'bar')


    def test_create_app_both(self):
        app = create_app(self.config_file.name, EXTRA_PARAM='baz')
        self.assertEqual(app.config['OTHER_CONFIG'], 'bar')
        self.assertEqual(app.config['EXTRA_PARAM'], 'baz')
