예제 #1
0
파일: test_ipmi.py 프로젝트: schatt/ironic
    def test_console_pid_file_not_found(self):
        pid_path = ipmi._get_console_pid_path(self.ipmi.node_id)

        self.mox.StubOutWithMock(os.path, 'exists')
        os.path.exists(pid_path).AndReturn(False)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        self.mox.VerifyAll()
        self.assertTrue(pid is None)
예제 #2
0
파일: test_ipmi.py 프로젝트: anbangr/ironic
    def test_console_pid_file_not_found(self):
        pid_path = ipmi._get_console_pid_path(self.ipmi.node_id)

        self.mox.StubOutWithMock(os.path, 'exists')
        os.path.exists(pid_path).AndReturn(False)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        self.mox.VerifyAll()
        self.assertTrue(pid is None)
예제 #3
0
파일: test_ipmi.py 프로젝트: schatt/ironic
    def test_console_pid_nan(self):
        fd, path = tempfile.mkstemp()
        with os.fdopen(fd, 'w') as f:
            f.write("hello world\n")

        self.mox.StubOutWithMock(ipmi, '_get_console_pid_path')
        ipmi._get_console_pid_path(self.ipmi.node_id).AndReturn(path)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        utils.delete_if_exists(path)
        self.mox.VerifyAll()
        self.assertTrue(pid is None)
예제 #4
0
파일: test_ipmi.py 프로젝트: anbangr/ironic
    def test_console_pid_nan(self):
        fd, path = tempfile.mkstemp()
        with os.fdopen(fd, 'w') as f:
            f.write("hello world\n")

        self.mox.StubOutWithMock(ipmi, '_get_console_pid_path')
        ipmi._get_console_pid_path(self.ipmi.node_id).AndReturn(path)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        utils.delete_if_exists(path)
        self.mox.VerifyAll()
        self.assertTrue(pid is None)
예제 #5
0
파일: test_ipmi.py 프로젝트: epim/ironic
    def test_console_pid(self):
        fd, path = tempfile.mkstemp()
        with os.fdopen(fd, "w") as f:
            f.write("12345\n")

        self.mox.StubOutWithMock(ipmi, "_get_console_pid_path")
        ipmi._get_console_pid_path(self.ipmi.node_id).AndReturn(path)
        self.mox.ReplayAll()

        pid = ipmi._get_console_pid(self.ipmi.node_id)
        utils.delete_if_exists(path)
        self.mox.VerifyAll()
        self.assertEqual(pid, 12345)