From a608f561c48bf247e313f383e6f806f10d70f253 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 8 Jan 2008 10:28:49 +0000 Subject: * 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 --- config-db/t/10-vendor-os.t | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'config-db/t') 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'); -- cgit v1.2.3-55-g7522