示例#1
0
    def test_no_match(self):
        '''Tests calling StrikeConfiguration.match_file_name() without a match.'''

        config = {
            'mount': 'host:/my/path',
            'transfer_suffix': '_tmp',
            'files_to_ingest': [{
                'filename_regex': '.*MY.*PATTERN.*',
                'data_types': ['one', 'two'],
                'workspace_path': os.path.join('my', 'path'),
                'workspace_name': self.workspace.name,
            }],
        }
        strike_config = StrikeConfiguration(config)

        result = strike_config.match_file_name('ababFOOBARabab')
        self.assertIsNone(result)
示例#2
0
    def test_no_match(self):
        '''Tests calling StrikeConfiguration.match_file_name() without a match.'''

        config = {
            'mount':
            'host:/my/path',
            'transfer_suffix':
            '_tmp',
            'files_to_ingest': [{
                'filename_regex': '.*MY.*PATTERN.*',
                'data_types': ['one', 'two'],
                'workspace_path': os.path.join('my', 'path'),
                'workspace_name': self.workspace.name,
            }],
        }
        strike_config = StrikeConfiguration(config)

        result = strike_config.match_file_name('ababFOOBARabab')
        self.assertIsNone(result)
示例#3
0
    def test_match(self):
        '''Tests calling StrikeConfiguration.match_file_name() with a match.'''

        data_types_list = ['one', 'two']
        wksp_path = os.path.join('my', 'path')
        config = {
            'mount': 'host:/my/path',
            'transfer_suffix': '_tmp',
            'files_to_ingest': [{
                'filename_regex': '.*MY.*PATTERN.*',
                'data_types': data_types_list,
                'workspace_path': wksp_path,
                'workspace_name': self.workspace.name,
            }],
        }
        strike_config = StrikeConfiguration(config)

        result = strike_config.match_file_name('ababMYgggPATTERNxyz')
        self.assertTupleEqual(result, (data_types_list, wksp_path, self.workspace))
示例#4
0
    def test_match(self):
        '''Tests calling StrikeConfiguration.match_file_name() with a match.'''

        data_types_list = ['one', 'two']
        wksp_path = os.path.join('my', 'path')
        config = {
            'mount':
            'host:/my/path',
            'transfer_suffix':
            '_tmp',
            'files_to_ingest': [{
                'filename_regex': '.*MY.*PATTERN.*',
                'data_types': data_types_list,
                'workspace_path': wksp_path,
                'workspace_name': self.workspace.name,
            }],
        }
        strike_config = StrikeConfiguration(config)

        result = strike_config.match_file_name('ababMYgggPATTERNxyz')
        self.assertTupleEqual(result,
                              (data_types_list, wksp_path, self.workspace))