def test_unlink_fail(self): self.mock_multi["unlink"].side_effect = [EnvironmentError, None] mkvstrip.replace_file(self.tmp_file, self.org_file) self.mock_multi["unlink"].assert_has_calls( [mock.call(self.org_file), mock.call(self.tmp_file)]) self.mock_multi["rename"].assert_not_called()
def test_rename_fail(self): self.mock_multi["rename"].side_effect = EnvironmentError mkvstrip.replace_file(self.tmp_file, self.org_file) self.mock_multi["rename"].assert_called_with(self.tmp_file, self.org_file) self.mock_multi["unlink"].assert_has_calls( [mock.call(self.org_file), mock.call(self.tmp_file)])
def test_run(self): mkvstrip.replace_file(self.tmp_file, self.org_file) self.mock_stat.assert_called_with(self.org_file) self.mock_multi["utime"].assert_called_with( self.tmp_file, (1512084181.0, 1512084181.0)) self.mock_multi["unlink"].assert_called_with(self.org_file) self.mock_multi["rename"].assert_called_with(self.tmp_file, self.org_file)
def test_rename_fail(self): self.mock_multi["rename"].side_effect = EnvironmentError mkvstrip.replace_file(self.tmp_file, self.org_file) self.mock_multi["rename"].assert_called_with(self.tmp_file, self.org_file) self.mock_multi["unlink"].assert_has_calls([mock.call(self.org_file), mock.call(self.tmp_file)])
def test_unlink_fail(self): self.mock_multi["unlink"].side_effect = [EnvironmentError, None] mkvstrip.replace_file(self.tmp_file, self.org_file) self.mock_multi["unlink"].assert_has_calls([mock.call(self.org_file), mock.call(self.tmp_file)]) self.mock_multi["rename"].assert_not_called()
def test_run(self): mkvstrip.replace_file(self.tmp_file, self.org_file) self.mock_stat.assert_called_with(self.org_file) self.mock_multi["utime"].assert_called_with(self.tmp_file, (1512084181.0, 1512084181.0)) self.mock_multi["unlink"].assert_called_with(self.org_file) self.mock_multi["rename"].assert_called_with(self.tmp_file, self.org_file)