def test_accesses_directories_through_keyval_file(self):
     os.path.isdir.expect_call("dir").and_return(True)
     self._create_test_file("dir/keyval", "")
     base_utils.read_keyval("dir")
     self.god.check_playback()
 def test_returns_empty_when_file_doesnt_exist(self):
     os.path.isdir.expect_call("file").and_return(False)
     os.path.exists.expect_call("file").and_return(False)
     self.assertEqual({}, base_utils.read_keyval("file"))
     self.god.check_playback()
 def test_accesses_files_directly(self):
     os.path.isdir.expect_call("file").and_return(False)
     self._create_test_file("file", "")
     base_utils.read_keyval("file")
     self.god.check_playback()
 def read_keyval(self, contents):
     os.path.isdir.expect_call("file").and_return(False)
     self._create_test_file("file", contents)
     keyval = base_utils.read_keyval("file")
     self.god.check_playback()
     return keyval