Add no locals() for string formatting test

Using locals() for formatting strings is not as clear as explicit
dictionaries and can produce hidden errors during refactoring. locals() are
already being partially removed in nova and cinder. Related to
bug 1171936

Change-Id: I6ef790ebf50d640af62c535952c7a98053869e43