Beispiel #1
0
    def test_make_help_options(self, resolve_mock, walk_mock):
        base_dir = 'abc/def'
        abs_dir = '/files/' + base_dir
        walk_mock.side_effect = [
            [(abs_dir, [], ['klm.yaml']), (abs_dir, [], ['ijk.yaml'])],
        ]
        resolve_mock.side_effect = [abs_dir]

        expected = 'List: "ijk", "klm"'
        observed = utils.make_help_options('List: %s', base_dir)
        self.assertEqual(expected, observed)
Beispiel #2
0
    def test_make_help_options_with_filter(self, resolve_mock, walk_mock):
        base_dir = 'abc/def'
        abs_dir = '/files/' + base_dir
        walk_mock.side_effect = [
            [(abs_dir + '/sub', [], ['klm.yaml']),
             (abs_dir + '/sub', [], ['ijk.html']),
             (abs_dir + '/sub', [], ['mno.yaml'])],
        ]
        resolve_mock.side_effect = [abs_dir]

        expected = 'List: "sub/klm", "sub/mno"'
        observed = utils.make_help_options(
            'List: %s', base_dir, type_filter=lambda x: x.endswith('.yaml'))
        self.assertEqual(expected, observed)