def get_all_rules_by_name( self, rule_name, sort_key=_CREATED_AT, sort_direction=u"DESC" ): return get_all_pages( self.get_rules_page, self._RULE_METADATA, groups=[json.loads(str(create_eq_filter_group(u"Name", rule_name)))], sort_key=sort_key, sort_direction=sort_direction, )
def get_rule_by_observer_id( self, observer_id, sort_key=_CREATED_AT, sort_direction=u"DESC" ): results = get_all_pages( self.get_rules_page, self._RULE_METADATA, groups=[ json.loads(str(create_eq_filter_group(u"ObserverRuleId", observer_id))) ], sort_key=sort_key, sort_direction=sort_direction, ) return next(results)
def test_compare_filter_group_with_equivalent_single_args_return_true(): group1 = create_eq_filter_group("eqterm", "eqvalue") group2 = create_eq_filter_group("eqterm", "eqvalue") assert group1 == group2
def test_create_eq_filter_group_returns_obj_with_correct_json_representation(): filter_group = create_eq_filter_group("eqterm", "eqvalue") assert ( str(filter_group) == '{"filterClause":"AND",' ' "filters":[{"operator":"IS", "term":"eqterm", "value":"eqvalue"}]}' )