Ejemplo n.º 1
0
    def test_get_sh_files_bug27149(self):
        """Test preup.sh / postup.sh download for non-architecture component."""
        server = MockUCSHttpServer('server')
        struct = U.UCSRepoPoolNoArch(major=MAJOR,
                                     minor=MINOR,
                                     part='%s/component' % (PART, ),
                                     patch='a')
        preup_path = struct.path('preup.sh')
        server.mock_add(preup_path, '#!preup_content')
        postup_path = struct.path('postup.sh')
        server.mock_add(postup_path, '#!postup_content')
        repo = ((server, struct), )

        gen = U.UniventionUpdater.get_sh_files(repo)

        self.assertEqual(
            (server, struct, 'preup', preup_path, '#!preup_content'),
            gen.next())
        self.assertEqual(
            (server, struct, 'postup', postup_path, '#!postup_content'),
            gen.next())
        self.assertRaises(StopIteration, gen.next)
Ejemplo n.º 2
0
    def test_get_sh_files(self):
        """Test preup.sh / postup.sh download."""
        server = MockUCSHttpServer('server')
        struct = U.UCSRepoPool5(major=MAJOR,
                                minor=MINOR,
                                part=PART,
                                patchlevel=PATCH,
                                arch=ARCH)
        preup_path = struct.path('preup.sh')
        server.mock_add(preup_path, '#!preup_content')
        postup_path = struct.path('postup.sh')
        server.mock_add(postup_path, '#!postup_content')
        repo = ((server, struct), )

        gen = U.UniventionUpdater.get_sh_files(repo)

        self.assertEqual(
            (server, struct, 'preup', preup_path, '#!preup_content'),
            gen.next())
        self.assertEqual(
            (server, struct, 'postup', postup_path, '#!postup_content'),
            gen.next())
        self.assertRaises(StopIteration, gen.next)
 def _uri(self, uris):
     """Fill URI mockup."""
     for key, value in uris.items():
         MockUCSHttpServer.mock_add(key, value)