Exemplo n.º 1
0
 def setUp(self):
     self.config = Config(['/repo'])
     self.repo = RepositoryMock()
     self.writer = DumpWriterMock(self)
     self.interesting_paths = InterestingPaths()
     self.builder = LumpBuilder(self.config, self.repo,
                                self.interesting_paths, self.writer)
    def test_simple_include(self):
        interesting_path = InterestingPaths()
        interesting_path.mark_path_as_interesting('a/b/c')

        self.assertTrue(interesting_path.is_interesting('a/b/c'))
        self.assertTrue(interesting_path.is_interesting('a/b/c/d'))
        self.assertFalse(interesting_path.is_interesting('a/b'))
        self.assertFalse(interesting_path.is_interesting('x/y'))
    def test_get_interesting_sub_directories(self):
        interesting_path = InterestingPaths()
        interesting_path.mark_path_as_interesting('a/b/ca')
        interesting_path.mark_path_as_interesting('a/b/cb')
        interesting_path.mark_path_as_boring('a/b/ca/x')
        interesting_path.mark_path_as_boring('a/y')
        
        dirs = sorted(interesting_path.get_interesting_sub_directories('a/b'))
        self.assertEqual(dirs, [ 'a/b/ca', 'a/b/cb' ])

        self.assertEqual([], interesting_path.get_interesting_sub_directories("a/b/c/x"))
    def test_include_with_exclude(self):
        interesting_path = InterestingPaths()
        interesting_path.mark_path_as_interesting('a/b/c')
        interesting_path.mark_path_as_boring('a/b/c/x')

        self.assertTrue(interesting_path.is_interesting('a/b/c'))
        self.assertTrue(interesting_path.is_interesting('a/b/c/d'))
        self.assertFalse(interesting_path.is_interesting('a/b'))
        self.assertFalse(interesting_path.is_interesting('x/y'))
        self.assertFalse(interesting_path.is_interesting('a/b/c/x'))
        self.assertFalse(interesting_path.is_interesting('a/b/c/x/y'))
Exemplo n.º 5
0
 def setUp(self):
     self.config = Config([ '/dummy' ])
     self.interesting_paths = InterestingPaths()
     self.repo = RepositoryMock()
     self.builder = LumpBuilderMock()
     self.dump_filter = DumpFilter(
         config = self.config,
         source_repository = self.repo,
         interesting_paths = self.interesting_paths,
         lump_builder = self.builder
     )
    def test_empty_string(self):
        interesting_path = InterestingPaths()
        interesting_path.mark_path_as_interesting('')

        self.assertTrue(interesting_path.is_interesting('a'))
        self.assertTrue(interesting_path.is_interesting('b'))

        dirs = sorted(interesting_path.get_interesting_sub_directories('a'))
        self.assertEqual(dirs, [ 'a' ])

        dirs = sorted(interesting_path.get_interesting_sub_directories(''))
        self.assertEqual(dirs, [ '' ])
Exemplo n.º 7
0
 def setUp(self):
     self.config = Config(['/dummy'])
     self.interesting_paths = InterestingPaths()
     self.repo = RepositoryMock()
     self.repo.revision_properties_by_revision[3] = [
         'some author', 'some date', 'same log message'
     ]
     self.builder = LumpBuilderMock()
     self.boots_trapper = BootsTrapper(
         config=self.config,
         source_repository=self.repo,
         interesting_paths=self.interesting_paths,
         lump_builder=self.builder)
Exemplo n.º 8
0
 def setUp(self):
     self.interesting_paths = InterestingPaths()
     self.builder = LumpBuilderMock()
     self.generator = ParentDirectoryLumpGenerator(self.interesting_paths,
                                                   self.builder)
    def test_paths_with_trailing_slashes(self):
        interesting_path = InterestingPaths()
        interesting_path.mark_path_as_interesting('a/b/')

        self.assertTrue(interesting_path.is_interesting('a/b'))
        self.assertTrue(interesting_path.is_interesting('a/b/'))