@@ -358,6 +358,29 @@ def test_compound_query_key():
358
358
assert test_rule_copy ['compound_query_key' ] == ['field1' , 'field2' ]
359
359
360
360
361
+ def test_query_key_with_single_value ():
362
+ test_config_copy = copy .deepcopy (test_config )
363
+ rules_loader = FileRulesLoader (test_config_copy )
364
+ test_rule_copy = copy .deepcopy (test_rule )
365
+ test_rule_copy .pop ('use_count_query' )
366
+ test_rule_copy ['query_key' ] = ['field1' ]
367
+ rules_loader .load_options (test_rule_copy , test_config , 'filename.yaml' )
368
+ assert 'field1' in test_rule_copy ['include' ]
369
+ assert test_rule_copy ['query_key' ] == 'field1'
370
+ assert 'compound_query_key' not in test_rule_copy
371
+
372
+
373
+ def test_query_key_with_no_values ():
374
+ test_config_copy = copy .deepcopy (test_config )
375
+ rules_loader = FileRulesLoader (test_config_copy )
376
+ test_rule_copy = copy .deepcopy (test_rule )
377
+ test_rule_copy .pop ('use_count_query' )
378
+ test_rule_copy ['query_key' ] = []
379
+ rules_loader .load_options (test_rule_copy , test_config , 'filename.yaml' )
380
+ assert 'query_key' not in test_rule_copy
381
+ assert 'compound_query_key' not in test_rule_copy
382
+
383
+
361
384
def test_name_inference ():
362
385
test_config_copy = copy .deepcopy (test_config )
363
386
rules_loader = FileRulesLoader (test_config_copy )
0 commit comments