Пример #1
0
 def test_write_to_file_success(self):
     filehandle = FakeFile(file_contents)
     self.mox.StubOutWithMock(openvz_conn, 'open')
     openvz_conn.open('/tmp/foo', 'w').AndReturn(filehandle)
     self.mox.ReplayAll()
     conn = openvz_conn.OpenVzConnection(False)
     conn._write_to_file('/tmp/foo', file_contents)
Пример #2
0
 def test_write_to_file_failure(self):
     self.mox.StubOutWithMock(openvz_conn, 'open')
     openvz_conn.open('/tmp/foo', 'w').AndRaise(Exception)
     self.mox.ReplayAll()
     conn = openvz_conn.OpenVzConnection(False)
     self.assertRaises(exception.Error, conn._write_to_file,
                       '/tmp/foo', file_contents)
Пример #3
0
 def test_write_to_file_success(self):
     filehandle = FakeFile(file_contents)
     self.mox.StubOutWithMock(openvz_conn, 'open')
     openvz_conn.open('/tmp/foo', 'w').AndReturn(filehandle)
     self.mox.ReplayAll()
     fh = openvz_conn.OVZFile('/tmp/foo')
     fh.write()
Пример #4
0
 def test_read_file_success(self):
     file_contents = FakeFile(file_contents)
     self.mox.StubOutWithMock(openvz_conn, 'open')
     openvz_conn.open('/tmp/foo', 'r').AndReturn(file_contents)
     self.mox.ReplayAll()
     fh = openvz_conn.OVZFile('/tmp/foo')
     fh.read()
Пример #5
0
 def test_write_to_file_success(self):
     filehandle = FakeFile(file_contents)
     self.mox.StubOutWithMock(openvz_conn, "open")
     openvz_conn.open("/tmp/foo", "w").AndReturn(filehandle)
     self.mox.ReplayAll()
     fh = openvz_conn.OVZFile("/tmp/foo")
     fh.write()
Пример #6
0
 def test_read_file_success(self):
     file_contents = FakeFile(file_contents)
     self.mox.StubOutWithMock(openvz_conn, "open")
     openvz_conn.open("/tmp/foo", "r").AndReturn(file_contents)
     self.mox.ReplayAll()
     fh = openvz_conn.OVZFile("/tmp/foo")
     fh.read()
Пример #7
0
 def test_read_file_success(self):
     file_contents = FakeFile(file_contents)
     self.mox.StubOutWithMock(openvz_conn, 'open')
     openvz_conn.open('/tmp/foo', 'r').AndReturn(file_contents)
     self.mox.ReplayAll()
     conn = openvz_conn.OpenVzConnection(False)
     resp = conn._read_file('/tmp/foo')
     self.assertTrue(isinstance(resp, list))
Пример #8
0
 def test_write_to_file_failure(self):
     self.mox.StubOutWithMock(openvz_conn, 'open')
     openvz_conn.open('/tmp/foo', 'w').AndRaise(Exception)
     self.mox.ReplayAll()
     fh = openvz_conn.OVZFile('/tmp/foo')
     self.assertRaises(exception.Error, fh.write)
Пример #9
0
 def test_write_to_file_failure(self):
     self.mox.StubOutWithMock(openvz_conn, "open")
     openvz_conn.open("/tmp/foo", "w").AndRaise(Exception)
     self.mox.ReplayAll()
     fh = openvz_conn.OVZFile("/tmp/foo")
     self.assertRaises(exception.Error, fh.write)