def setUp(self):
     """Create Mirror mockup."""
     self.base_dir = mkdtemp()
     MockConfigRegistry._EXTRA = {
         'repository/mirror/basepath': self.base_dir,
     }
     self._uri({
         '': '',
         '/': '',
         'univention-repository/': '',
     })
     self.m = M.UniventionMirror()
     repos = (
         (U.UCS_Version((MAJOR, MINOR, PATCH)), False),
         (U.UCS_Version((MAJOR, MINOR, PATCH)), True),
         (U.UCS_Version((MAJOR, MINOR, PATCH + 1)), False),
         (U.UCS_Version((MAJOR, MINOR, PATCH + 1)), True),
         (U.UCS_Version((MAJOR, MINOR + 1, PATCH)), True),
         (U.UCS_Version((MAJOR, MINOR + 1, PATCH + 1)), True),
     )
     self.repos = []
     for ver, maintained in repos:
         major_minor = U.UCS_Version.FORMAT % ver
         maint_unmain = maintained and 'maintained' or 'unmaintained'
         major_minor_patch = U.UCS_Version.FULLFORMAT % ver
         dirname = os.path.join(self.base_dir, 'mirror', major_minor,
                                maint_unmain, major_minor_patch)
         M.makedirs(dirname)
         self.repos.append((dirname, ver, maintained))
Beispiel #2
0
 def test_filter_releases_json(self):
     self.maxDiff = None
     with open(
             os.path.join(os.path.dirname(__file__),
                          'mockup_upstream_releases.json'),
             'r') as upstream_releases_fp:
         upstream_releases = json.load(upstream_releases_fp)
     with open(
             os.path.join(os.path.dirname(__file__),
                          'mockup_mirror_releases.json'),
             'r') as mirror_releases_fp:
         expected_mirror_releases = json.load(mirror_releases_fp)
     mirrored_releases = deepcopy(upstream_releases)
     M.filter_releases_json(mirrored_releases,
                            start=UCS_Version((3, 1, 1)),
                            end=UCS_Version((4, 1, 0)))
     self.assertEqual(mirrored_releases, expected_mirror_releases)
 def setUp(self):
     """Create Mirror mockup."""
     self._uri({
         # 'univention-repository/': '',
         '': '',
         '/': '',
     })
     self.base_dir = mkdtemp()
     self.mock_file = MockFile(os.path.join(self.base_dir, 'mock'))
     __builtins__.open = self.mock_file
     MockConfigRegistry._EXTRA = {
         'repository/mirror/basepath': os.path.join(self.base_dir, 'repo'),
         # 'repository/mirror/version/end': '%d.%d-%d' % (MAJOR, MINOR, PATCH),
         # 'repository/mirror/version/start': '%d.%d-%d' % (MAJOR, 0, 0),
         'repository/mirror/architectures': ' '.join(ARCH),
         'repository/mirror/verify': 'no',
     }
     self.m = M.UniventionMirror()