Esempio n. 1
0
    def test_create_link(self):
        self.mox.StubOutWithMock(os, "symlink")
        os.symlink("/fake/source", "/fake/link")

        self.mox.ReplayAll()
        utils.create_link_without_raise("/fake/source", "/fake/link")
        self.mox.VerifyAll()
Esempio n. 2
0
    def test_create_link_EEXIST(self):
        self.mox.StubOutWithMock(os, "symlink")
        os.symlink("/fake/source", "/fake/link").AndRaise(
                OSError(errno.EEXIST))

        self.mox.ReplayAll()
        utils.create_link_without_raise("/fake/source", "/fake/link")
        self.mox.VerifyAll()
Esempio n. 3
0
 def test_create_link_EEXIST(self):
     with mock.patch.object(os, "symlink") as symlink_mock:
         symlink_mock.side_effect = OSError(errno.EEXIST)
         utils.create_link_without_raise("/fake/source", "/fake/link")
         symlink_mock.assert_called_once_with("/fake/source", "/fake/link")
Esempio n. 4
0
 def test_create_link(self):
     with mock.patch.object(os, "symlink") as symlink_mock:
         symlink_mock.return_value = None
         utils.create_link_without_raise("/fake/source", "/fake/link")
         symlink_mock.assert_called_once_with("/fake/source", "/fake/link")