summaryrefslogtreecommitdiffstats
path: root/config-db/t/20-client_system_ref.t
diff options
context:
space:
mode:
authorOliver Tappe2007-12-28 18:55:25 +0100
committerOliver Tappe2007-12-28 18:55:25 +0100
commitb27afb64e9d2b18e524ef3c957baa530ed5f9904 (patch)
tree2376e0a39d2cb2b714667a7943ff28ee6d09ca85 /config-db/t/20-client_system_ref.t
parent* added more tests for basic DB-features: group, global_info and (diff)
downloadcore-b27afb64e9d2b18e524ef3c957baa530ed5f9904.tar.gz
core-b27afb64e9d2b18e524ef3c957baa530ed5f9904.tar.xz
core-b27afb64e9d2b18e524ef3c957baa530ed5f9904.zip
* completed basic tests and started to work on tests for aggregated values
(attributes) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1436 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/t/20-client_system_ref.t')
-rw-r--r--config-db/t/20-client_system_ref.t69
1 files changed, 68 insertions, 1 deletions
diff --git a/config-db/t/20-client_system_ref.t b/config-db/t/20-client_system_ref.t
index ab7a3b2a..646050e3 100644
--- a/config-db/t/20-client_system_ref.t
+++ b/config-db/t/20-client_system_ref.t
@@ -111,7 +111,7 @@ is(
);
is(
@systemIDs = sort($configDB->fetchSystemIDsOfClient(1)),
- 0, "client 1 should have no more system-IDs"
+ 0, "client 1 should have no system-IDs"
);
is(
@systemIDs = sort($configDB->fetchSystemIDsOfClient(3)),
@@ -120,6 +120,15 @@ is(
is($systemIDs[0], 1, "first system of client 3 should have ID 1");
ok(
+ $configDB->addSystemIDsToClient(1, [0]),
+ 'associating the default system should have no effect'
+);
+is(
+ @systemIDs = sort($configDB->fetchSystemIDsOfClient(1)),
+ 0, "client 1 should still have no system-ID"
+);
+
+ok(
$configDB->removeClientIDsFromSystem(1, [1]),
'removing an unassociated client-ID should have no effect'
);
@@ -135,4 +144,62 @@ is(
@clientIDs = sort($configDB->fetchClientIDsOfSystem(1)),
0, "system 1 should have no more client-ID"
);
+
+$configDB->addSystem({
+ 'name' => 'sys-4',
+ 'export_id' => 1,
+ 'comment' => 'shortlived',
+});
+ok(
+ $configDB->addClientIDsToSystem(4, [0]),
+ 'default client has been associated to system 4'
+);
+is(
+ @systemIDs = sort($configDB->fetchSystemIDsOfClient(0)),
+ 1, "default client should have one system-ID"
+);
+is($systemIDs[0], 4, "first system of default client should have ID 4");
+is(
+ @systemIDs = sort($configDB->fetchSystemIDsOfClient(1)),
+ 0, "client 1 should have no system-ID"
+);
+is(
+ @systemIDs = sort($configDB->fetchSystemIDsOfClient(3)),
+ 0, "client 3 should have no system-ID"
+);
+is(
+ @clientIDs = sort($configDB->fetchClientIDsOfSystem(0)),
+ 0, "default system should have no client-IDs"
+);
+is(
+ @clientIDs = sort($configDB->fetchClientIDsOfSystem(1)),
+ 0, "system 1 should have no client-ID"
+);
+is(
+ @clientIDs = sort($configDB->fetchClientIDsOfSystem(3)),
+ 0, "system 3 should have no client-IDs"
+);
+is(
+ @clientIDs = sort($configDB->fetchClientIDsOfSystem(4)),
+ 1, "system 4 should have one client-ID"
+);
+is($clientIDs[0], 0, "first client of system 4 should have ID 0");
+
+ok(
+ $configDB->removeSystemIDsFromClient(0, [6]),
+ 'removing an unassociated system-ID should have no effect'
+);
+is(
+ @clientIDs = sort($configDB->fetchSystemIDsOfClient(0)),
+ 1, "default client should have one system-ID"
+);
+ok(
+ $configDB->removeSystem(4),
+ 'removing a system should drop client associations, too'
+);
+is(
+ @clientIDs = sort($configDB->fetchSystemIDsOfClient(0)),
+ 0, "default client should have no more system-ID"
+);
+
$configDB->disconnect();