mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Add boilerplates for module unittests
This commit is contained in:
parent
628af2f973
commit
e10545506d
21
systemvm/test/python/TestCsApp.py
Normal file
21
systemvm/test/python/TestCsApp.py
Normal file
@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
from cs.CsApp import CsApp
|
||||
from cs.CsAddress import CsIP
|
||||
from cs.CsConfig import CsConfig
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsApp(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csconfig = CsConfig()
|
||||
csconfig.set_cl()
|
||||
csip = CsIP("eth0", csconfig);
|
||||
csapp = CsApp(csip)
|
||||
self.assertTrue(csapp is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsConfig.py
Normal file
16
systemvm/test/python/TestCsConfig.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsConfig import CsConfig
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsConfig(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_ini(self):
|
||||
csconfig = CsConfig(False)
|
||||
self.assertTrue(csconfig is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsDatabag.py
Normal file
16
systemvm/test/python/TestCsDatabag.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsDatabag import CsDataBag
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsDatabag(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csdatabag = CsDataBag("koffie")
|
||||
self.assertTrue(csdatabag is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
20
systemvm/test/python/TestCsDhcp.py
Normal file
20
systemvm/test/python/TestCsDhcp.py
Normal file
@ -0,0 +1,20 @@
|
||||
import unittest
|
||||
import mock
|
||||
from cs.CsDhcp import CsDhcp
|
||||
from cs import CsHelper
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsDhcp(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
@mock.patch('cs.CsDhcp.CsHelper')
|
||||
@mock.patch('cs.CsDhcp.CsDnsMasq')
|
||||
def test_init(self, mock_cshelper, mock_dnsmasq):
|
||||
csdhcp = CsDhcp({}, None)
|
||||
self.assertTrue(csdhcp is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsFile.py
Normal file
16
systemvm/test/python/TestCsFile.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsFile import CsFile
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsFile(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csfile = CsFile("testfile")
|
||||
self.assertTrue(csfile is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsGuestNetwork.py
Normal file
16
systemvm/test/python/TestCsGuestNetwork.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsGuestNetwork import CsGuestNetwork
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsGuestNetwork(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csguestnetwork = CsGuestNetwork({})
|
||||
self.assertTrue(csguestnetwork is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
18
systemvm/test/python/TestCsHelper.py
Normal file
18
systemvm/test/python/TestCsHelper.py
Normal file
@ -0,0 +1,18 @@
|
||||
import unittest
|
||||
import mock
|
||||
from cs import CsHelper
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsHelper(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
@mock.patch('cs.CsHelper.subprocess')
|
||||
def test_execute(self, mock_subprocess):
|
||||
result = CsHelper.execute("/bin/false")
|
||||
self.assertTrue(result is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsNetfilter.py
Normal file
16
systemvm/test/python/TestCsNetfilter.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsNetfilter import CsNetfilter
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsNetfilter(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csnetfilter = CsNetfilter()
|
||||
self.assertTrue(csnetfilter is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsProcess.py
Normal file
16
systemvm/test/python/TestCsProcess.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsProcess import CsProcess
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsProcess(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csprocess = CsProcess({})
|
||||
self.assertTrue(csprocess is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
20
systemvm/test/python/TestCsRedundant.py
Normal file
20
systemvm/test/python/TestCsRedundant.py
Normal file
@ -0,0 +1,20 @@
|
||||
import unittest
|
||||
from cs.CsRedundant import CsRedundant
|
||||
from cs.CsConfig import CsConfig
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsRedundant(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csconfig = CsConfig()
|
||||
csconfig.set_cl()
|
||||
|
||||
csredundant = CsRedundant(csconfig, "address")
|
||||
self.assertTrue(csredundant is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsRoute.py
Normal file
16
systemvm/test/python/TestCsRoute.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsRoute import CsRoute
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsRoute(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csroute = CsRoute(["one","two","three","four"])
|
||||
self.assertTrue(csroute is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
16
systemvm/test/python/TestCsRule.py
Normal file
16
systemvm/test/python/TestCsRule.py
Normal file
@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from cs.CsRule import CsRule
|
||||
import merge
|
||||
|
||||
|
||||
class TestCsRule(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
merge.dataBag.DPATH = "."
|
||||
|
||||
def test_init(self):
|
||||
csrule = CsRule(["one", "two", "three", "four"])
|
||||
self.assertTrue(csrule is not None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
x
Reference in New Issue
Block a user