I have a Flask app where some page content comes from a global variable. I'm trying to set up some unit testing to assert the data, but I can't seem to get even a local variable to work:
TEST_STRING = foo
self.assertIn(b['TEST_STRING'], response.data)
fails with:
NameError: name 'b' is not defined
If I reference the plain variable:
self.assertIn(TEST_STRING, response.data)
I get the expected failure:
TypeError: a bytes-like object is required, not 'str'
The test succeeds if I hard-code the variable data into the test, but I'd rather not have to update the test if the variable changes. What am I missing here?