'Calling :func:`update_repo` with real yum utilities creates a
repository in S3.'

@skipUnless(which('createrepo'), 'Tests    require    the    ``createrepo``    command.')
def test_real_yum_utils(self):

    source_repo = FilePath(self.mktemp())
    source_repo.createDirectory()
    FilePath(__file__).sibling('yum-repo').copyTo(source_repo)
    repo_uri = ('file://' + source_repo.path)
    aws = FakeAWS(routing_rules={}, s3_buckets={self.target_bucket: {}})
    class RealYum(object, ):
        def get_dispatcher(self):
            return yum_dispatcher
    self.update_repo(aws=aws, yum=RealYum(), package_directory=self.package_directory, target_bucket=self.target_bucket, target_key=self.target_key, source_repo=repo_uri, packages=self.packages, flocker_version='0.3.3.dev7', distribution=Distribution(name='centos', version='7'))
    expected_files = {os.path.join(self.target_key, file) for file in ['clusterhq-flocker-cli-0.3.3-0.dev.7.noarch.rpm', 'clusterhq-flocker-node-0.3.3-0.dev.7.noarch.rpm', 'clusterhq-flocker-docker-plugin-0.3.3-0.dev.7.noarch.rpm', 'repodata/repomd.xml']}
    files_on_s3 = aws.s3_buckets[self.target_bucket]
    repodata_path = os.path.join(self.target_key, 'repodata')
    for metadata_file in ['other.sqlite.bz2', 'filelists.xml.gz', 'primary.xml.gz', 'filelists.sqlite.bz2', 'primary.sqlite.bz2', 'other.xml.gz']:
        for key in files_on_s3:
            if (key.endswith(metadata_file) and key.startswith(repodata_path)):
                expected_files.add(os.path.join(repodata_path, ((sha256(files_on_s3[key]).hexdigest() + '-') + metadata_file)))
                break
        else:
            expected_files.add(os.path.join(repodata_path, ('<missing>-' + metadata_file)))
    self.assertEqual(expected_files, set(files_on_s3.keys()))
