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))
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()