saltstack/salt — pull request #10031 by kaithar (2014-01-29 19:22:09+00:00)
Title: Feature/test fixes

a5fee18ac8676d4e9dd469118f8f35466c8ce325 and 4b6694bf0ed39ed94b999a18b126d41fc7929c2a are aimed at running tests as a non-root user. The code that makes a temp copy of the test with the correct user wasn't playing with the new salt.cloud code. These two commits get a lot of tests that were broken for me to play ball.
See #10022 for more details.

In 0a7546b1b1159f370f9c731f0615028401e0606e I have adjusted the import to pull saltesting.mock rather than mock directly, in the hopes that slightly more tests will pass if the real mock lib isn't installed. I don't see harm in this since there doesn't seem to be any instances where the tests results will have more failures than they would have without this change.
If mock is missing, only tests that can't use the fake mock will fail rather than the entire file failing on an import error.
If mock is available, the result is the same as if mock was included directly.
We may need to wrap some tests in `NO_MOCK` tests if they can't cope with the fake MagicMock class.
It might be worth expanding the fake class a little, to handle more of the simpler tests, but it's good enough for now.