Use mock if unittest.mock is not available
Use assertItemsEqual on python 2