Can't you inject these things and move the two settings up into the global function that constructs the store? Then you don't need to do this weird messing with globals in the test.