diff options
-rw-r--r-- | src/account/test/common.py | 38 |
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) |