When translating if no locale is given use default locale

In get_localized_message we were only updating a Message's locale if it
was not None, but None is also a valid request, it means the default.
If a Message had been previously translated and since None was ignored,
the message was translated to the last translated locale. This patch
fixes that. It also makes sure that the given message object's locale is
not changed after translation.

Change-Id: I8e1a594d779d18c88dc42c612900442d191bfa70
Replace using tests.utils part3

It is the last step to replace using tests.utils with
stack.common.test.
In this patch database tests is changed for using
openstack.common.test and added needed fixtures in test classes.

Blueprint: common-unit-tests
Change-Id: I9b360f9a8dc72bc3fb697e571555775bde10ef61
Merge "Replace using tests.utils part3"
Don't override default value for eventlet.wsgi.server logging

We want eventlet.wsgi.server to use the same log level as everything
else (by default). For example if INFO logging is enabled eventlet.wsgi.server will
log all API requests. So if INFO logging is enabled in the API server we
want eventlet.wsgi.server to use the same log level.

This only changes a default value, and can be set by the user.

Change-Id: I42124793bbf542d69f6493bb3a9611e443775c2a
Merge "Don't override default value for eventlet.wsgi.server logging"
Merge "When translating if no locale is given use default locale"
Consolidate the use of stubs

We have two separate StubOutForTesting objects when running tests. One
that is instantiated directly in the moxstubout fixture and one that
mox has for itself.

When a method is stubbed, the overridden method is kept in a cache in
the StubOutForTesting instance. When calling UnsetAll() on this
instance, the order of the cache is reversed and the original methods
are put back in place. This means if you have SomeObject with a method
called actual_method and you stub that out with

    stubs.Set(SomeObject, "actual_method", fake_method)

you end up with a this tuple in the cache:

    (SomeObject, "actual_method", SomeObject.actual_method)

If you stub it out again

    stubs.Set(SomeObject, "actual_method", fake_method2)

this tuple is appended to the cache:

    (SomeObject, "actual_method", fake_method)

When calling UnsetAll(), the cache is reversed and becomes:

    [(SomeObject, "actual_method", fake_method),
     (SomeObject, "actual_method", SomeObject.actual_method)]

So first, SomeObject.actual_method (which currently is fake_method2) is
set to fake_method, and then set to the original
SomeObject.actual_method medthod.

If, however, you stub out the same method using both mox and our own
StubOutForTesting object, one of the caches will have

    (SomeObject, "actual_method", SomeObject.actual_method)

and the other will have:

    (SomeObject, "actual_method", fake_method)

At this point, restoring everything back to the original state depends
on these StubOutForTesting objects getting cleaned up in the correct
order. If it's done in the wrong order, SomeObject.actual_method
(currently set to fake_method2) will get reset to the original
SomeObject.actual_method and subsequently get "reset" to fake_method
which makes life miserable for subsequent tests that might rely on the
real implementation.

This change stops us from having two separate StubOutForTesting objects
by simply using mox's all the time.

Fixes bug #1239898

Change-Id: I3a768eca3432e6df09c87bd86bffa9763aabfbed