summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlois Mahdal <amahdal@redhat.com>2014-05-19 18:45:25 +0200
committerAlois Mahdal <amahdal@redhat.com>2014-05-22 15:35:16 +0200
commit515793fc109f37d3c8beb4f0bfa4d0b94a5ec78c (patch)
treec1268412cd8d9b275aec21fea55e073853ce10e9
parentc3464de9d2347005e7a3817def390c8108cc97ac (diff)
downloadopenlmi-providers-515793fc109f37d3c8beb4f0bfa4d0b94a5ec78c.tar.gz
openlmi-providers-515793fc109f37d3c8beb4f0bfa4d0b94a5ec78c.tar.xz
openlmi-providers-515793fc109f37d3c8beb4f0bfa4d0b94a5ec78c.zip
Add AccountIndicationTestDriver, application of indication testing framework.
-rw-r--r--src/account/test/common.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/account/test/common.py b/src/account/test/common.py
index 28060ab..b3debc9 100644
--- a/src/account/test/common.py
+++ b/src/account/test/common.py
@@ -26,6 +26,7 @@ import subprocess
from collections import defaultdict
from methods import field_is_unique
+from lmi.test.ind import IndicationTestDriver
from lmi.test import lmibase
from lmi.test.util import random_string
@@ -254,3 +255,40 @@ class TestUserSet(object):
"""
while self._our_users:
UserOps.clean_account(self._our_users.pop())
+
+
+class AccountIndicationTestDriver(IndicationTestDriver):
+ """
+ Test driver for account indications.
+
+ Adds necessary values to properties of IndicationTestDriver
+ to constitute a functional test driver for Account Provider
+ indications.
+ """
+
+ def __init__(self, *args, **kwargs):
+ super(AccountIndicationTestDriver, self).__init__(*args, **kwargs)
+
+ self.probe.classname_aliases = {
+ 'LMI_AccountInstanceCreationIndication': 'ac',
+ 'LMI_AccountInstanceDeletionIndication': 'ad',
+ }
+
+ self.tus = TestUserSet(
+ prefix=self.options['gen_prefix'] + '_user_',
+ strength=self.options['gen_strength']
+ )
+
+ self.known_actions['ac'] = self.tus.add
+ self.known_actions['ad'] = self.tus.remove
+
+ self.known_queries['ac'] = (
+ 'select * from LMI_AccountInstanceCreationIndication'
+ ' where SourceInstance isa LMI_Account'
+ )
+ self.known_queries['ad'] = (
+ 'select * from LMI_AccountInstanceDeletionIndication'
+ ' where SourceInstance isa LMI_Account'
+ )
+
+ self.cleanup_handlers.append(self.tus.remove_all)