Check REQUEST_CONTEXT.context exists before accessing it.

LMS-11226
Tests shouldn't be relying on `edxmako.middleware.REQUEST_CONTEXT` being initialized. If they are, that's introducing an ordering dependency on our tests.