def test_actual_rule_config():
    """verifies the actual exclusion rule config can be parsed with no exceptions and has only expected values"""
    with open(dqc_us_0015._DEFAULT_EXCLUSIONS_FILE, 'rt') as f:
        rule_line_count = len(f.readlines()) - 1  # remember the header
    blacklist_exclusion_rules = dqc_us_0015.get_rules_from_csv()
    # if any values are not BLE , they will not get returned and this count will be less than # of lines.
    total_rule_count = len(blacklist_exclusion_rules)
    assert_equal(rule_line_count, total_rule_count, msg="{} lines resulted in {} rules".format(rule_line_count, total_rule_count))
def test_actual_rule_config():
    """verifies the actual exclusion rule config can be parsed with no exceptions and has only expected values"""
    with open(dqc_us_0015._DEFAULT_EXCLUSIONS_FILE, 'rt') as f:
        rule_line_count = len(f.readlines()) - 1  # remember the header
    blacklist_exclusion_rules = dqc_us_0015.get_rules_from_csv()
    # if any values are not BLE , they will not get returned and this count will be less than # of lines.
    total_rule_count = len(blacklist_exclusion_rules)
    assert_equal(rule_line_count, total_rule_count, msg="{} lines resulted in {} rules".format(rule_line_count, total_rule_count))
 def setUpClass(cls):
     cls.csv_lines = [
         'LIST,ARTIFACT,NEGATION,RELATION,ITEM',
         'BLE,Member,,Contains,Something',
         'BLE,Member,,Contains,PartA,Member,Not,Contains,PartB'
     ]
     cls.csv_str = '\n'.join(cls.csv_lines)
     # Mock the context managed open statement to return the test CSV
     # mock open specifically in the target module
     open_name = '{0}.open'.format(dqc_us_0015.__name__)
     with mock.patch(open_name, create=True) as m:
         m.return_value = io.StringIO(cls.csv_str)
         cls.blacklist_exclusion_rules = dqc_us_0015.get_rules_from_csv()
     cls.rule_one = dqc_us_0015._parse_row(cls.csv_lines[0].split(',')[1:])
     cls.rule_two = dqc_us_0015._parse_row(cls.csv_lines[1].split(',')[1:])
     cls.rule_three = dqc_us_0015._parse_row(cls.csv_lines[2].split(',')[1:])
 def setUpClass(cls):
     cls.csv_lines = [
         'LIST,ARTIFACT,NEGATION,RELATION,ITEM',
         'BLE,Member,,Contains,Something',
         'BLE,Member,,Contains,PartA,Member,Not,Contains,PartB'
     ]
     cls.csv_str = '\n'.join(cls.csv_lines)
     # Mock the context managed open statement to return the test CSV
     # mock open specifically in the target module
     open_name = '{0}.open'.format(dqc_us_0015.__name__)
     with mock.patch(open_name, create=True) as m:
         m.return_value = io.StringIO(cls.csv_str)
         cls.blacklist_exclusion_rules = dqc_us_0015.get_rules_from_csv()
     cls.rule_one = dqc_us_0015._parse_row(cls.csv_lines[0].split(',')[1:])
     cls.rule_two = dqc_us_0015._parse_row(cls.csv_lines[1].split(',')[1:])
     cls.rule_three = dqc_us_0015._parse_row(cls.csv_lines[2].split(',')[1:])