Esempio n. 1
0
 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()
Esempio n. 2
0
 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)])
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)])
Esempio n. 5
0
 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()
Esempio n. 6
0
 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)