Ejemplo n.º 1
0
    def test_unlink_ENOENT(self):
        self.mox.StubOutWithMock(os, "unlink")
        os.unlink("/fake/path").AndRaise(OSError(errno.ENOENT))

        self.mox.ReplayAll()
        utils.unlink_without_raise("/fake/path")
        self.mox.UnsetStubs()
        self.mox.VerifyAll()
Ejemplo n.º 2
0
    def test_unlink(self):
        self.mox.StubOutWithMock(os, "unlink")
        os.unlink("/fake/path")

        self.mox.ReplayAll()
        utils.unlink_without_raise("/fake/path")
        self.mox.UnsetStubs()
        self.mox.VerifyAll()
Ejemplo n.º 3
0
 def test_unlink_ENOENT(self):
     with mock.patch.object(os, "unlink") as unlink_mock:
         unlink_mock.side_effect = OSError(errno.ENOENT)
         utils.unlink_without_raise("/fake/path")
         unlink_mock.assert_called_once_with("/fake/path")
Ejemplo n.º 4
0
 def test_unlink(self):
     with mock.patch.object(os, "unlink") as unlink_mock:
         unlink_mock.return_value = None
         utils.unlink_without_raise("/fake/path")
         unlink_mock.assert_called_once_with("/fake/path")