def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     arguments = {'src': '.',
                  'filterby': 'NE',
                  'rule': 'NE 500', # the content must end on two as'.
                  'target': '.'}
     self.processing = processing_filter(**arguments)
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     arguments = {'src': '.',
                  'filterby': 'w',
                  'rule': 'GE 500',
                  'target': '.'}
     self.processing = processing_filter(**arguments)
    def test_run(self):
        """
        Test if the cleaners run method runs correct
        """

        # Test to filter lines with an EQ
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.number',
            'rule': 'EQ 111',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf1 = processing_filter(**arguments)
        #pf1.target = os.path.join(TESTDATA_GEN_OUTPUT_FOLDER)
        pf1.run()

        with open(TESTDATA_FOLDER + '/processingFilterRunTest.cctf-pf1',
                  'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)

        # Test to filter lines with an GT
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.number',
            'rule': 'GT 111',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf2 = processing_filter(**arguments)
        pf2.run()

        with open(TESTDATA_FOLDER + '/processingFilterRunTest.cctf-pf2',
                  'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)

        # Test to filter lines with an GE
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.number',
            'rule': 'GE 111',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf3 = processing_filter(**arguments)
        pf3.run()

        with open(TESTDATA_FOLDER + '/processingFilterRunTest.cctf-pf3',
                  'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)

        # Test to filter lines with an RE
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.software',
            'rule': 'RE OpenSSH_([7-9])',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf4 = processing_filter(**arguments)
        pf4.run()

        with open(TESTDATA_FOLDER + '/processingFilterRunTest.cctf-pf4',
                  'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)

        # Test to filter lines with an LT
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.number',
            'rule': 'LT 111',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf5 = processing_filter(**arguments)
        pf5.run()

        with open(TESTDATA_FOLDER + '/processingFilterRunTest.cctf-pf5',
                  'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)

        # Test to filter lines with an LE
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.number',
            'rule': 'LE 111',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf6 = processing_filter(**arguments)
        pf6.run()

        with open(
                os.path.join(TESTDATA_FOLDER,
                             'processingFilterRunTest.cctf-pf6'), 'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)

        # Test to filter lines with an LE
        arguments = append_needed_args({
            'src': TESTDATA_SRC_FILENAME,
            'filterby': 'data.xssh.server_id.number',
            'rule': 'NE 111',
            'target': TESTDATA_TARGET_FILENAME
        })
        pf7 = processing_filter(**arguments)
        pf7.run()

        with open(
                os.path.join(TESTDATA_FOLDER,
                             'processingFilterRunTest.cctf-pf7'), 'r') as f:
            expected_output = f.read()

        with open(TESTDATA_TARGET_FILENAME, 'r') as f2:
            output = f2.read()

        self.assertMultiLineEqual(expected_output, output)