summaryrefslogtreecommitdiffstats
path: root/config-db/t
diff options
context:
space:
mode:
authorOliver Tappe2008-01-08 11:28:49 +0100
committerOliver Tappe2008-01-08 11:28:49 +0100
commita608f561c48bf247e313f383e6f806f10d70f253 (patch)
tree13e2a35b0b448d1063e56e14aea864cbe2a6ca31 /config-db/t
parent* fixed several smaller bugs found when testing slxexport (diff)
downloadcore-a608f561c48bf247e313f383e6f806f10d70f253.tar.gz
core-a608f561c48bf247e313f383e6f806f10d70f253.tar.xz
core-a608f561c48bf247e313f383e6f806f10d70f253.zip
* added new DB-table 'installed_plugin', moving schema version to 0.21
* added functionality to DB-layer for adding, removing and fetching plugins that have been installed into a vendor-OS. * added a set of tests related to installed plugins. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1447 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/t')
-rw-r--r--config-db/t/10-vendor-os.t58
1 files changed, 58 insertions, 0 deletions
diff --git a/config-db/t/10-vendor-os.t b/config-db/t/10-vendor-os.t
index 04aa4f2e..f2d11302 100644
--- a/config-db/t/10-vendor-os.t
+++ b/config-db/t/10-vendor-os.t
@@ -190,6 +190,64 @@ ok(
ok(! $configDB->changeVendorOS(1, { id => 23 }), 'changing id should fail');
+# test adding & removing of installed plugins
+is(
+ $configDB->fetchInstalledPlugins(3),
+ 0, 'there should be no installed plugins'
+);
+ok($configDB->addInstalledPlugin(3, 'Example'), 'adding installed plugin');
+is(
+ my @plugins = $configDB->fetchInstalledPlugins(3),
+ 1,
+ 'should have 1 installed plugin'
+);
+ok(
+ !$configDB->addInstalledPlugin(3, 'Example'),
+ 'adding plugin again should fail (but do not harm)'
+);
+is(
+ @plugins = $configDB->fetchInstalledPlugins(3),
+ 1,
+ 'should have 1 installed plugin'
+);
+is($plugins[0], 'Example', 'should have got plugin "Example"');
+ok($configDB->addInstalledPlugin(3, 'Test'), 'adding a second plugin');
+is(
+ @plugins = $configDB->fetchInstalledPlugins(3),
+ 2,
+ 'should have 2 installed plugin'
+);
+ok(
+ !$configDB->removeInstalledPlugin(3, 'xxx'),
+ 'removing unknown plugin should fail'
+);
+ok(
+ @plugins = $configDB->fetchInstalledPlugins(3, 'Example'),
+ 'fetching specific plugin'
+);
+is($plugins[0], 'Example', 'should have got plugin "Example"');
+ok(
+ @plugins = $configDB->fetchInstalledPlugins(3, 'Test'),
+ 'fetching another specific plugin'
+);
+is($plugins[0], 'Test', 'should have got plugin "Test"');
+is(
+ @plugins = $configDB->fetchInstalledPlugins(3, 'xxx'), 0,
+ 'fetching unknown specific plugin'
+);
+ok($configDB->removeInstalledPlugin(3, 'Example'), 'removing installed plugin');
+is(
+ @plugins = $configDB->fetchInstalledPlugins(3),
+ 1,
+ 'should have 1 installed plugin'
+);
+ok($configDB->removeInstalledPlugin(3, 'Test'), 'removing second plugin');
+is(
+ @plugins = $configDB->fetchInstalledPlugins(3),
+ 0,
+ 'should have no installed plugins'
+);
+
# now remove a vendor-OS and check if that worked
ok($configDB->removeVendorOS(3), 'removing vendor-OS 3 should be ok');
is($configDB->fetchVendorOSByID(3, 'id'), undef, 'vendor-OS 3 should be gone');