Вопрос

I am trying to test the configuration of my app, I need to set a flag if app.config['TEST'] is True

Here's the configuration part of my app

app.config['TEST'] = False
if app.config['TEST']:
    app.config['FOO'] = 'bar'
else:
    app.config['FOO'] = 'baz'

Here's the testcase that is failing:

class TestConfigCase(TestCase):
    def setUp(self):
        app.app.config['TESTING'] = True
        self.app = app.app.test_client()

    def testConfig(self):
        assert 'bar' in self.app.config['FOO']
Это было полезно?

Решение

In the beginning you have TEST and then you are writing TESTING.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top