ERP5Type/tests: review requests in test

The general idea of this patch is that now that we are using
zope.globalrequest, we no longer need to patch get_request, we can
simply call zope.globalrequest.setRequest with the request from the
test and restore the "real" request afterwards.

To achieve this, we reuse Testing.ZopeTestCase.connections.registry,
which already has the logic of cleaning up resources in the right place
and use a "Request" resource that calls setRequest(test_request) and
setRequest(real_request) when closed, so that:
 - test runs with an independant request
 - this test request is closed at the end
 - the real request is restored at the end

This also fixes a bug with self.publish when runnning
ERP5TypeLiveTestCase from portal_components of a running instance,
after a call to self.publish the current request was lost.

The testing for this revealed that ERP5TypeLiveTestCase.publish way
of dealing with zope.security interaction was not always correct: when
running a live test inside runUnitTest (like we do here in
testDynamicClassGeneration), there is no security interaction. This
was reviewed to use the high level API instead of changing directly the
internal storage.
12 jobs for fix/test-request in 0 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  External
passed ERP5.CodingStyleTest-TestRunner2

00:51:22

failed ERP5.UnitTest-TestRunner2

01:57:02

failed ERP5.UnitTest-Zope2-ForTestRunner2

02:05:05

passed ERP5.CodingStyleTest-TestRunner2

00:57:54

passed ERP5.CodingStyleTest-TestRunner2

00:37:33

passed ERP5.CodingStyleTest-TestRunner2

01:40:28

failed ERP5.UnitTest-TestRunner2

03:37:34

passed ERP5.UnitTest-TestRunner2

02:34:46

failed ERP5.UnitTest-TestRunner2

03:13:23

passed ERP5.UnitTest-Zope2-ForTestRunner2

01:33:37

failed ERP5.UnitTest-Zope2-ForTestRunner2

02:19:00

failed ERP5.UnitTest-Zope2-ForTestRunner2

03:51:02