Ejemplo n.º 1
0
 def test_import_rpm_failed_build(self, get_rpm_header, get_build):
     get_rpm_header.return_value = self.rpm_header_retval
     get_build.return_value = {
         "state": koji.BUILD_STATES["FAILED"],
         "name": "name",
         "version": "version",
         "release": "release",
     }
     with self.assertRaises(koji.GenericError):
         kojihub.import_rpm(self.filename)
Ejemplo n.º 2
0
 def test_import_rpm_failed_build(self, get_rpm_header, get_build):
     get_rpm_header.return_value = self.rpm_header_retval
     get_build.return_value = {
         'state': koji.BUILD_STATES['FAILED'],
         'name': 'name',
         'version': 'version',
         'release': 'release',
     }
     with self.assertRaises(koji.GenericError):
         kojihub.import_rpm(self.filename)
Ejemplo n.º 3
0
 def test_import_rpm_failed_build(self, get_rpm_header, get_build):
     get_rpm_header.return_value = self.rpm_header_retval
     get_build.return_value = {
         'state': koji.BUILD_STATES['FAILED'],
         'name': 'name',
         'version': 'version',
         'release': 'release',
     }
     with self.assertRaises(koji.GenericError):
         kojihub.import_rpm(self.filename)
Ejemplo n.º 4
0
 def test_import_rpm_completed_source_build(self, get_rpm_header, get_build,
                                            _singleValue, _dml,
                                            new_typed_build):
     retval = copy.copy(self.rpm_header_retval)
     retval.update({
         'filename': 'name-version-release.arch.rpm',
         1044: 'name-version-release.src',
         1022: 'src',
         1106: 1,
     })
     get_rpm_header.return_value = retval
     get_build.return_value = {
         'state': koji.BUILD_STATES['COMPLETE'],
         'name': 'name',
         'version': 'version',
         'release': 'release',
         'id': 12345,
     }
     _singleValue.return_value = 9876
     kojihub.import_rpm(self.src_filename)
     fields = [
         'arch',
         'build_id',
         'buildroot_id',
         'buildtime',
         'epoch',
         'external_repo_id',
         'id',
         'name',
         'payloadhash',
         'release',
         'size',
         'version',
     ]
     statement = 'INSERT INTO rpminfo (%s) VALUES (%s)' % (
         ", ".join(fields),
         ", ".join(['%%(%s)s' % field for field in fields])
     )
     values = {
         'build_id': 12345,
         'name': 'name',
         'arch': 'src',
         'buildtime': 'buildtime',
         'payloadhash': '7061796c6f61642068617368',
         'epoch': 'epoch',
         'version': 'version',
         'buildroot_id': None,
         'release': 'release',
         'external_repo_id': 0,
         'id': 9876,
         'size': 0,
     }
     _dml.assert_called_once_with(statement, values)
Ejemplo n.º 5
0
 def test_import_rpm_completed_source_build(self, get_rpm_header, get_build,
                                            _singleValue, _dml,
                                            new_typed_build):
     retval = copy.copy(self.rpm_header_retval)
     retval.update({
         'filename': 'name-version-release.arch.rpm',
         1044: 'name-version-release.src',
         1022: 'src',
         1106: 1,
     })
     get_rpm_header.return_value = retval
     get_build.return_value = {
         'state': koji.BUILD_STATES['COMPLETE'],
         'name': 'name',
         'version': 'version',
         'release': 'release',
         'id': 12345,
     }
     _singleValue.return_value = 9876
     kojihub.import_rpm(self.src_filename)
     fields = [
         'build_id',
         'name',
         'arch',
         'buildtime',
         'payloadhash',
         'epoch',
         'version',
         'buildroot_id',
         'release',
         'external_repo_id',
         'id',
         'size',
     ]
     statement = 'INSERT INTO rpminfo (%s) VALUES (%s)' % (", ".join(
         fields), ", ".join(['%%(%s)s' % field for field in fields]))
     values = {
         'build_id': 12345,
         'name': 'name',
         'arch': 'src',
         'buildtime': 'buildtime',
         'payloadhash': '7061796c6f61642068617368',
         'epoch': 'epoch',
         'version': 'version',
         'buildroot_id': None,
         'release': 'release',
         'external_repo_id': 0,
         'id': 9876,
         'size': 0,
     }
     _dml.assert_called_once_with(statement, values)
Ejemplo n.º 6
0
 def test_import_rpm_completed_source_build(self, get_rpm_header, get_build, _singleValue, _dml, new_typed_build):
     retval = copy.copy(self.rpm_header_retval)
     retval.update(
         {"filename": "name-version-release.arch.rpm", 1044: "name-version-release.src", 1022: "src", 1106: 1}
     )
     get_rpm_header.return_value = retval
     get_build.return_value = {
         "state": koji.BUILD_STATES["COMPLETE"],
         "name": "name",
         "version": "version",
         "release": "release",
         "id": 12345,
     }
     _singleValue.return_value = 9876
     kojihub.import_rpm(self.src_filename)
     fields = [
         "build_id",
         "name",
         "arch",
         "buildtime",
         "payloadhash",
         "epoch",
         "version",
         "buildroot_id",
         "release",
         "external_repo_id",
         "id",
         "size",
     ]
     statement = "INSERT INTO rpminfo (%s) VALUES (%s)" % (
         ", ".join(fields),
         ", ".join(["%%(%s)s" % field for field in fields]),
     )
     values = {
         "build_id": 12345,
         "name": "name",
         "arch": "src",
         "buildtime": "buildtime",
         "payloadhash": "7061796c6f61642068617368",
         "epoch": "epoch",
         "version": "version",
         "buildroot_id": None,
         "release": "release",
         "external_repo_id": 0,
         "id": 9876,
         "size": 0,
     }
     _dml.assert_called_once_with(statement, values)
Ejemplo n.º 7
0
 def test_non_exist_file(self, os_path_basename, os_path_exist,
                         get_rpm_header):
     self.cursor.fetchone.return_value = None
     self.context.cnx.cursor.return_value = self.cursor
     retval = copy.copy(self.rpm_header_retval)
     retval.update({
         'filename': 'name-version-release.arch.rpm',
         'sourcepackage': 2
     })
     get_rpm_header.return_value = retval
     os_path_exist.return_value = True
     os_path_basename.return_value = 'name-version-release.arch.rpm'
     kojihub.get_build.return_value = None
     with self.assertRaises(koji.GenericError) as cm:
         kojihub.import_rpm(self.src_filename)
     self.assertEqual("No such build", str(cm.exception))
Ejemplo n.º 8
0
 def test_nonexistant_rpm(self):
     with self.assertRaises(koji.GenericError):
         kojihub.import_rpm("this does not exist")
Ejemplo n.º 9
0
 def test_nonexistant_rpm(self):
     with self.assertRaises(koji.GenericError):
         kojihub.import_rpm("this does not exist")