Fix bakery build for minidebconfs
During the bakery build, request is not an instance of the Django
Request class, but an instance of the base WSGIRequest class which
doesn't have an user attribute.
There are also now some simple automated tests to prevent similar regressions in the future.