summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-01-18 22:17:40 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-01-18 22:17:40 +0000
commit06c9e437e756fcf3461eaa27e0d42d8913656fae (patch)
tree0f66b0a2f1e06e6c228999a6a7c28de0a7ddc387 /testsuite
parent6ec2e7a30c30d6a8cd96c9ffa4fc4d1f484596a5 (diff)
downloadbcfg2-06c9e437e756fcf3461eaa27e0d42d8913656fae.tar.gz
bcfg2-06c9e437e756fcf3461eaa27e0d42d8913656fae.tar.bz2
bcfg2-06c9e437e756fcf3461eaa27e0d42d8913656fae.zip
Frame updates (and start of unit-testing)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4266 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'testsuite')
-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)