def setUpClass(cls): super(OwnerChoiceProviderTest, cls).setUpClass() report = ReportConfiguration(domain=cls.domain) cls.group = GroupChoiceProviderTest.make_group('Group', domain=cls.domain) cls.mobile_worker = UserChoiceProviderTest.make_mobile_worker( 'mobile-worker', domain=cls.domain) cls.web_user = UserChoiceProviderTest.make_web_user( '*****@*****.**', domain=cls.domain) cls.location = cls.locations['Massachusetts'] cls.docs = [cls.group, cls.mobile_worker, cls.web_user, cls.location] cls.choices = [ SearchableChoice(cls.group.get_id, cls.group.name, [cls.group.name]), SearchableChoice(cls.mobile_worker.get_id, cls.mobile_worker.raw_username, [cls.mobile_worker.username]), SearchableChoice(cls.web_user.get_id, cls.web_user.username, [cls.web_user.username]), SearchableChoice(cls.location.location_id, cls.location.display_name, [cls.location.name, cls.location.site_code]), ] cls.choice_provider = OwnerChoiceProvider(report, None) cls.static_choice_provider = StaticChoiceProvider(cls.choices) cls.choice_query_context = partial(ChoiceQueryContext, user=cls.mobile_worker)
def setUpClass(cls): cls.domain_obj = create_domain(cls.domain) report = ReportConfiguration(domain=cls.domain) cls.group = GroupChoiceProviderTest.make_group('Group', domain=cls.domain) cls.mobile_worker = UserChoiceProviderTest.make_mobile_worker( 'mobile-worker', domain=cls.domain) cls.web_user = UserChoiceProviderTest.make_web_user( '*****@*****.**', domain=cls.domain) cls.location = LocationChoiceProviderTest.make_location( 'location', 'Location', domain=cls.domain) cls.docs = [cls.group, cls.mobile_worker, cls.web_user, cls.location] cls.choices = [ SearchableChoice(cls.group.get_id, cls.group.name, [cls.group.name]), SearchableChoice(cls.mobile_worker.get_id, cls.mobile_worker.raw_username, [cls.mobile_worker.username]), SearchableChoice(cls.web_user.get_id, cls.web_user.username, [cls.web_user.username]), SearchableChoice(cls.location.location_id, cls.location.sql_location.display_name, [cls.location.name, cls.location.site_code]), ] cls.choice_provider = OwnerChoiceProvider(report, None) cls.static_choice_provider = StaticChoiceProvider(cls.choices)