summaryrefslogtreecommitdiffstats
path: root/testsuite/TestFrame.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/TestFrame.py')
-rw-r--r--testsuite/TestFrame.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/TestFrame.py b/testsuite/TestFrame.py
new file mode 100644
index 000000000..933298f06
--- /dev/null
+++ b/testsuite/TestFrame.py
@@ -0,0 +1,25 @@
+import lxml.etree
+
+import Bcfg2.Client.Frame, Bcfg2.Client.Tools
+
+c1 = lxml.etree.XML("<Configuration><Bundle name='foo'><Configfile name='/tmp/test12' owner='root' group='root' empty='true' perms='644'/></Bundle></Configuration>")
+
+c2 = lxml.etree.XML("<Configuration><Bundle name='foo'><Configfile name='/tmp/test12' owner='root' group='root' empty='true' perms='644'/><Configfile name='/tmp/test12' owner='root' group='root' empty='true' perms='644'/></Bundle></Configuration>")
+
+class DriverInitFail(object):
+ def __init__(self, *args):
+ raise Bcfg2.Client.Tools.toolInstantiationError
+
+class TestFrame(object):
+ def test__init(self):
+ config = lxml.etree.Element('Configuration')
+ setup = {}
+ times = {}
+ drivers = []
+ frame = Bcfg2.Client.Frame.Frame(config, setup, times, drivers, False)
+ assert frame.tools == []
+ frame2 = Bcfg2.Client.Frame.Frame(c1, setup, times, ['POSIX'], False)
+ assert len(frame2.tools) == 1
+ frame3 = Bcfg2.Client.Frame.Frame(c2, setup, times, ['foo'], False)
+ assert len(frame3.tools) == 0
+ frame4 = Bcfg2.Client.Frame.Frame(c2, setup, times, [DriverInitFail], False)