RuntimeError('working outside of application context') on testing