def test_remove(self): system_commands = [] def fake_system(cmd): system_commands.append(cmd) original_system = os.system os.system = fake_system bfc = BaseFileCollection(self.default_name, '/path') bfc.filenames = ['toto.ext', 'titi.ext'] bfc.remove() self.assertEquals(system_commands, ['rm -f /path/toto.ext /path/titi.ext']) os.system = original_system
def test_files(self): bfc = BaseFileCollection(self.default_name) self.assertEquals(len(bfc.files), 0) bfc.filenames = ['toto', 'titi'] self.assertEquals(len(bfc.files), 2)