#3588 Move hub code to site-packages
Merged a year ago by tkopecek. Opened a year ago by tkopecek.
tkopecek/koji issue3587  into  master

file modified
+8 -1
@@ -1,11 +1,18 @@ 

  NAME=koji

  SPECFILE = $(firstword $(wildcard *.spec))

- SUBDIRS = hub builder koji cli util www plugins vm

  

  ifndef PYTHON

  export PYTHON=python2

  endif

  

+ PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.split(".")[:1]))')

+ ifeq ($(PYVER_MAJOR),2)

+ 	SUBDIRS = builder koji cli plugins vm

+ else

+ 	SUBDIRS = kojihub builder koji cli util www plugins vm

+ endif

+ 

+ 

  ifdef DIST

  DIST_DEFINES := --define "dist $(DIST)"

  endif

file modified
+1 -1
@@ -12,7 +12,7 @@ 

  from urllib.parse import quote

  

  sys.path.insert(0, os.getcwd())

- sys.path.insert(1, os.path.join(os.getcwd(), 'hub'))

+ sys.path.insert(1, os.path.join(os.getcwd(), 'kojihub'))

  import koji

  import kojixmlrpc

  import koji.xmlrpcplus

file removed

file modified
+3 -4
@@ -335,9 +335,7 @@ 

  

  %description utils

  Utilities for the Koji system

- %endif

  

- %if 0%{py3_support} > 1

  %package web

  Summary: Koji Web UI

  Group: Applications/Internet
@@ -405,7 +403,7 @@ 

  popd

  %endif

  %if 0%{py2_support} > 1

- for D in hub builder plugins util www vm ; do

+ for D in builder plugins vm ; do

      pushd $D

      make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install

      popd
@@ -430,7 +428,7 @@ 

  popd

  %endif

  %if 0%{py3_support} > 1

- for D in hub builder plugins util www vm ; do

+ for D in kojihub builder plugins util www vm ; do

      pushd $D

      make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install

      popd
@@ -549,6 +547,7 @@ 

  %files -n python%{python3_pkgversion}-%{name}-hub

  %{_datadir}/koji-hub/*.py

  %{_datadir}/koji-hub/__pycache__

+ %{python3_sitelib}/kojihub

  

  %files hub-plugins

  %dir /etc/koji-hub/plugins

kojihub/Makefile hub/Makefile
file renamed
+15 -11
@@ -1,10 +1,9 @@ 

  PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.split(".")[:1]))')

- PACKAGE = $(shell basename `pwd`)

+ PACKAGE = kojihub

  PYFILES = $(wildcard *.py)

  PKGDIR = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/$(PACKAGE)

  

  SERVERDIR = /usr/share/koji-hub

- PYFILES = $(wildcard *.py)

  

  _default:

  	@echo "nothing to make.  try make install"
@@ -20,18 +19,23 @@ 

  		exit 1; \

  	fi

  

+         # python module

+ 	mkdir -p $(DESTDIR)/$(PKGDIR)

+ 	for p in $(PYFILES) ; do \

+ 		install -p -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \

+ 	done

+ 

+ 	$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"

+ 

+         # application files

  	mkdir -p $(DESTDIR)/etc/httpd/conf.d

- 	install -p -m 644 httpd.conf $(DESTDIR)/etc/httpd/conf.d/kojihub.conf

+ 	install -p -m 644 app/httpd.conf $(DESTDIR)/etc/httpd/conf.d/kojihub.conf

  

  	mkdir -p $(DESTDIR)/etc/koji-hub

- 	install -p -m 644 hub.conf $(DESTDIR)/etc/koji-hub/hub.conf

+ 	install -p -m 644 app/hub.conf $(DESTDIR)/etc/koji-hub/hub.conf

  	mkdir -p $(DESTDIR)/etc/koji-hub/hub.conf.d

  

- 	mkdir -p $(DESTDIR)/$(SERVERDIR)

- 	for p in $(PYFILES) ; do \

- 		install -p -m 644 $$p $(DESTDIR)/$(SERVERDIR)/$$p; \

- 	done

- 	@if [ "$(PYVER_MAJOR)" == "3" ] ; then \

- 		$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(SERVERDIR)', 1, '$(PYDIR)', 1)" ; \

- 	fi

  

+ 	mkdir -p $(DESTDIR)/$(SERVERDIR)

+ 	install -p -m 644 app/kojiapp.py $(DESTDIR)/$(SERVERDIR)/kojiapp.py

+ 	$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(SERVERDIR)', 1, '$(PYDIR)', 1)"

file added
+48
@@ -0,0 +1,48 @@ 

+ from .kojihub import *  # noqa: F401 F403

+ # import also all private functions for backward compatibility

+ # new private methods should be imported via kojihub.kojihub

+ from .kojihub import (  # noqa: F401

+     _create_build_target,

+     _create_tag,

+     _delete_build,

+     _delete_build_target,

+     _delete_event_id,

+     _delete_tag,

+     _direct_pkglist_add,

+     _direct_pkglist_remove,

+     _direct_tag_build,

+     _direct_untag_build,

+     _edit_build_target,

+     _edit_tag,

+     _edit_user,

+     _fix_archive_row,

+     _fix_extra_field,

+     _fix_rpm_row,

+     _generate_maven_metadata,

+     _get_archive_type_by_id,

+     _get_archive_type_by_name,

+     _get_build_target,

+     _get_tarball_list,

+     _get_zipfile_list,

+     _grp_pkg_add,

+     _grp_pkg_remove,

+     _grp_pkg_unblock,

+     _grp_req_add,

+     _grp_req_remove,

+     _grp_req_unblock,

+     _grplist_add,

+     _grplist_remove,

+     _grplist_unblock,

+     _import_archive_file,

+     _import_wrapper,

+     _pkglist_add,

+     _pkglist_owner_add,

+     _pkglist_owner_remove,

+     _pkglist_remove,

+     _scan_sighdr,

+     _set_build_volume,

+     _tag_build,

+     _untag_build,

+     _writeInheritanceData,

+     _write_maven_repo_metadata,

+ )

kojihub/app/httpd.conf hub/httpd.conf
file renamed
+1 -1
@@ -2,7 +2,7 @@ 

  # koji-hub is an xmlrpc interface to the Koji database

  #

  

- Alias /kojihub /usr/share/koji-hub/kojixmlrpc.py

+ Alias /kojihub /usr/share/koji-hub/kojiapp.py

  

  <Directory "/usr/share/koji-hub">

      Options ExecCGI

kojihub/app/hub.conf hub/hub.conf
file renamed
file was moved with no change to the file
@@ -0,0 +1,1 @@ 

+ from kojihub.kojixmlrpc import application  # noqa: F401

kojihub/kojihub.py hub/kojihub.py
file renamed
+1
@@ -7405,6 +7405,7 @@ 

      :param str description: eg. "YAML Ain't Markup Language"

      :param str extensions: space-separated list of descriptions, eg. "yaml yml"

      """

+     print(context)

      context.session.assertPerm('admin')

      verify_name_internal(name)

      convert_value(description, cast=str, check_only=True)

kojihub/kojixmlrpc.py hub/kojixmlrpc.py
file renamed
+1 -9
@@ -36,6 +36,7 @@ 

  import koji.plugin

  import koji.policy

  import koji.util

+ import kojihub

  from koji.context import context

  # import xmlrpclib functions from koji to use tweaked Marshaller

  from koji.server import ServerError, BadRequest, RequestTimeout
@@ -709,14 +710,6 @@ 

      log_handler.setFormatter(HubFormatter(opts['LogFormat']))

  

  

- def load_scripts(environ):

-     """Update path and import our scripts files"""

-     global kojihub

-     scriptsdir = os.path.dirname(environ['SCRIPT_FILENAME'])

-     sys.path.insert(0, scriptsdir)

-     import kojihub

- 

- 

  def get_memory_usage():

      pagesize = resource.getpagesize()

      statm = [pagesize * int(y) // 1024
@@ -736,7 +729,6 @@ 

                  'Hub option DisableGSSAPIProxyDNFallback is deprecated and '

                  'will be removed in 1.29')

          setup_logging2(opts)

-         load_scripts(environ)

          koji.util.setup_rlimits(opts)

          plugins = load_plugins(opts)

          registry = get_registry(opts, plugins)

file modified
+1 -4
@@ -4,14 +4,11 @@ 

  

  

  import random

- import sys

  

  import koji

  from koji.context import context

  from koji.plugin import export

- # XXX - have to import kojihub for make_task

- sys.path.insert(0, '/usr/share/koji-hub/')

- import kojihub  # noqa: E402

+ import kojihub

  

  __all__ = ('runroot',)

  

@@ -1,10 +1,7 @@ 

- import sys

- 

  import koji

  from koji.context import context

  from koji.plugin import export

- sys.path.insert(0, '/usr/share/koji-hub/')

- import kojihub  # noqa: E402

+ import kojihub

  

  __all__ = ('saveFailedTree',)

  

file modified
+1 -3
@@ -1,15 +1,13 @@ 

  # Copyright © 2019 Red Hat, Inc.

  #

  # SPDX-License-Identifier: GPL-2.0-or-later

- import sys

  

  import koji

  from koji.db import QueryProcessor, nextval

  from koji.context import context

  from koji.plugin import callback, export

  import koji.policy

- sys.path.insert(0, "/usr/share/koji-hub/")

- from kojihub import (  # noqa: E402

+ from kojihub import (

      _create_build_target,

      _create_tag,

      _delete_build_target,

@@ -3,7 +3,9 @@ 

  import mock

  

  import koji

+ import koji.db

  import kojihub

+ import kojihub.kojihub

  

  IP = kojihub.InsertProcessor

  QP = kojihub.QueryProcessor
@@ -11,19 +13,18 @@ 

  

  class TestAddArchiveType(unittest.TestCase):

      def setUp(self):

- 

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.exports = kojihub.RootExports()

          self.channel_name = 'test-channel'

          self.description = 'test-description'

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.get_archive_type = mock.patch('kojihub.get_archive_type').start()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_execute = mock.MagicMock()
@@ -63,7 +64,7 @@ 

          self.query_execute.side_effect = [[]]

          self.verify_name_internal.return_value = None

          self.get_archive_type.return_value = None

-         kojihub.add_archive_type('jar', 'Jar package', 'jar', 'zip')

+         kojihub.add_archive_type('jar', 'Jar package', 'jar', compression_type='zip')

  

          self.assertEqual(len(self.inserts), 1)

          insert = self.inserts[0]

@@ -10,12 +10,12 @@ 

  

  class TestAddBType(unittest.TestCase):

  

-     @mock.patch('kojihub.verify_name_internal')

-     @mock.patch('kojihub.list_btypes')

-     @mock.patch('kojihub.InsertProcessor')

+     @mock.patch('kojihub.kojihub.verify_name_internal')

+     @mock.patch('kojihub.kojihub.list_btypes')

+     @mock.patch('kojihub.kojihub.InsertProcessor')

      def test_add_btype(self, InsertProcessor, list_btypes, verify_name_internal):

          # Not sure why mock can't patch kojihub.context, so we do this

-         session = kojihub.context.session = mock.MagicMock()

+         session = kojihub.kojihub.context.session = mock.MagicMock()

          mocks = [InsertProcessor, list_btypes, session]

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

@@ -13,18 +13,18 @@ 

  

      def setUp(self):

  

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.exports = kojihub.RootExports()

          self.channel_name = 'test-channel'

          self.description = 'test-description'

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -9,9 +9,9 @@ 

  

      def setUp(self):

          self.tag_name = 'test-tag'

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_external_repo = mock.patch('kojihub.get_external_repo').start()

-         self.get_tag_external_repos = mock.patch('kojihub.get_tag_external_repos').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()

+         self.get_tag_external_repos = mock.patch('kojihub.kojihub.get_tag_external_repos').start()

          self.parse_arches = mock.patch('koji.parse_arches').start()

          self.tag_info = {'id': 1, 'name': self.tag_name}

          self.external_repo_info = {'id': 123, 'name': 'test-repo'}

@@ -15,11 +15,11 @@ 

  class TestAddExternalRPM(unittest.TestCase):

  

      def setUp(self):

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

-         self.get_external_repo_id = mock.patch('kojihub.get_external_repo_id').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

-         self.Savepoint = mock.patch('kojihub.Savepoint').start()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

+         self.get_external_repo_id = mock.patch('kojihub.kojihub.get_external_repo_id').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

+         self.Savepoint = mock.patch('kojihub.kojihub.Savepoint').start()

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

@@ -10,7 +10,7 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

      def test_non_exist_user(self):

          data = [{'id': 3,

file modified
+11 -11
@@ -32,16 +32,16 @@ 

          return query

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"
@@ -49,11 +49,11 @@ 

          self.context.session.assertPerm = mock.MagicMock()

          self.context.opts = {'HostPrincipalFormat': '-%s-'}

          self.exports = kojihub.RootExports()

-         self.verify_host_name = mock.patch('kojihub.verify_host_name').start()

-         self.verify_name_user = mock.patch('kojihub.verify_name_user').start()

-         self.get_host = mock.patch('kojihub.get_host').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.verify_host_name = mock.patch('kojihub.kojihub.verify_host_name').start()

+         self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.query_singleValue = mock.MagicMock()

  

      def tearDown(self):
@@ -80,7 +80,7 @@ 

          self.assertEqual(r, 12)

  

          self.context.session.assertPerm.assert_called_once_with('host')

-         kojihub.get_host.assert_called_once_with('hostname')

+         self.get_host.assert_called_once_with('hostname')

          self.context.session.createUser.assert_called_once_with(

              'hostname', usertype=koji.USERTYPES['HOST'], krb_principal='-hostname-')

          self.nextval.assert_called_once_with('host_id_seq')
@@ -191,7 +191,7 @@ 

              self.exports.addHost('hostname', ['i386', 'x86_64'], krb_principal=krb_principal)

  

          self.context.session.assertPerm.assert_called_once_with('host')

-         kojihub.get_host.assert_called_once_with('hostname')

+         self.get_host.assert_called_once_with('hostname')

          self.context.session.createUser.assert_not_called()

          self.verify_host_name.assert_called_once_with('hostname')

          self.nextval.assert_not_called()

@@ -16,10 +16,10 @@ 

          return insert

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"
@@ -29,11 +29,11 @@ 

          self.context_db.session.user_id = 23

          self.context.opts = {'HostPrincipalFormat': '-%s-'}

          self.exports = kojihub.RootExports()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.list_channels = mock.patch('kojihub.list_channels').start()

-         self.get_channel_id = mock.patch('kojihub.get_channel_id').start()

-         self.get_host = mock.patch('kojihub.get_host').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.list_channels = mock.patch('kojihub.kojihub.list_channels').start()

+         self.get_channel_id = mock.patch('kojihub.kojihub.get_channel_id').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

          self.cname = 'channel_name'

          self.name = 'hostname'

          self.host_info = {'id': 123, 'name': self.name}

@@ -24,14 +24,14 @@ 

          return query

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_execute = mock.MagicMock()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertLogin = mock.MagicMock()
@@ -44,11 +44,11 @@ 

          mock.patch.stopall()

  

      @mock.patch('koji.plugin.run_callbacks')

-     @mock.patch('kojihub.get_rpm')

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.get_rpm')

+     @mock.patch('kojihub.kojihub.get_build')

      @mock.patch('os.path.isdir')

      @mock.patch('koji.ensuredir')

-     @mock.patch('kojihub.open')

+     @mock.patch('kojihub.kojihub.open')

      def test_add_rpm_sig_header_signed(

              self,

              open,

@@ -8,9 +8,9 @@ 

  class TestAddUserKrbPrincipal(unittest.TestCase):

  

      def setUp(self):

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.verify_name_user = mock.patch('kojihub.verify_name_user').start()

-         self.get_user_by_krb_principal = mock.patch('kojihub.get_user_by_krb_principal').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()

+         self.get_user_by_krb_principal = mock.patch('kojihub.kojihub.get_user_by_krb_principal').start()

          self.username = 'testuser'

          self.krbprincipal = '%s@TEST.COM' % self.username

          self.userinfo = {'id': 1, 'name': self.username}

@@ -9,8 +9,8 @@ 

  class TestAddVolume(unittest.TestCase):

  

      def setUp(self):

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -1,7 +1,7 @@ 

  import copy

  import unittest

  

- import kojihub

+ from kojihub.kojihub import _applyQueryOpts

  

  

  class TestApplyQueryOpts(unittest.TestCase):
@@ -15,7 +15,7 @@ 

      def test_basic(self):

          opts = None

          expected = copy.copy(self.original)

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_order_by_foo(self):
@@ -25,7 +25,7 @@ 

              {'foo': 1, 'bar': 1},

              {'foo': 2, 'bar': -1},

          ]

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_order_by_bar(self):
@@ -35,7 +35,7 @@ 

              {'foo': 0, 'bar': 0},

              {'foo': 1, 'bar': 1},

          ]

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_order_in_reverse(self):
@@ -45,7 +45,7 @@ 

              {'foo': 1, 'bar': 1},

              {'foo': 0, 'bar': 0},

          ]

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_offset(self):
@@ -54,7 +54,7 @@ 

              {'foo': 2, 'bar': -1},

              {'foo': 0, 'bar': 0},

          ]

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_limit(self):
@@ -63,7 +63,7 @@ 

              {'foo': 1, 'bar': 1},

              {'foo': 2, 'bar': -1},

          ]

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_limit_and_offset(self):
@@ -71,16 +71,16 @@ 

          expected = [

              {'foo': 2, 'bar': -1},

          ]

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

      def test_count_only(self):

          opts = {'countOnly': True}

          expected = 3

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

  

          opts = {'countOnly': True, 'offset': 2}

          expected = 1

-         actual = kojihub._applyQueryOpts(self.original, opts)

+         actual = _applyQueryOpts(self.original, opts)

          self.assertEqual(expected, actual)

file modified
+3 -3
@@ -7,12 +7,12 @@ 

  class TestBuild(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

          self.src = 'test-src'

          self.target = 'test-target'

  

@@ -7,11 +7,11 @@ 

  class TestBuildImage(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertPerm = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

          self.mock_parse_arches = mock.patch('koji.parse_arches').start()

          self.name = 'image-name'

          self.version = 'test-version'

@@ -7,7 +7,7 @@ 

  class TestBuildImageIndirection(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertPerm = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

@@ -7,7 +7,7 @@ 

  class TestBuildImageOz(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertPerm = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

@@ -19,14 +19,14 @@ 

              os.mkdir(self.TMP_PATH)

          self.path_work = mock.patch('koji.pathinfo.work').start()

          self.context_db = mock.patch('koji.db.context').start()

-         self.context = mock.patch('kojihub.context').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.userinfo = {'id': 123}

          self.rmtree = mock.patch('koji.util.rmtree').start()

          self.lexists = mock.patch('os.path.lexists').start()

          self.path_build = mock.patch('koji.pathinfo.build').start()

-         self.new_build = mock.patch('kojihub.new_build').start()

+         self.new_build = mock.patch('kojihub.kojihub.new_build').start()

  

      def tearDown(self):

          if os.path.exists(self.TMP_PATH):
@@ -166,7 +166,7 @@ 

          x.get_metadata('default.json', 'cg_importer_json')

          x.import_metadata()

  

-     @mock.patch("kojihub.CG_Importer.get_metadata")

+     @mock.patch("kojihub.kojihub.CG_Importer.get_metadata")

      def test_do_import_no_such_metadata(self, get_metadata):

          x = kojihub.CG_Importer()

          metadata = {'metadata_version': 99,
@@ -213,8 +213,8 @@ 

              'nvr': self.build1['nvr'],

              'filename': self.archive1['filename'],

          }

-         self.get_archive = mock.patch('kojihub.get_archive').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_archive = mock.patch('kojihub.kojihub.get_archive').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -264,9 +264,9 @@ 

          return update

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.inserts = []

          self.updates = []
@@ -275,13 +275,14 @@ 

          self.context_db.session.user_id = 123456

          self.mock_cursor = mock.MagicMock()

          self.context_db.cnx.cursor.return_value = self.mock_cursor

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.userinfo = {'id': 123456, 'name': 'username'}

-         self.new_build = mock.patch('kojihub.new_build').start()

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

-         self.assert_cg = mock.patch('kojihub.assert_cg').start()

-         self.get_reservation_token = mock.patch('kojihub.get_reservation_token').start()

+         self.new_build = mock.patch('kojihub.kojihub.new_build').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

+         self.assert_cg = mock.patch('kojihub.kojihub.assert_cg').start()

+         self.get_reservation_token = mock.patch('kojihub.kojihub.get_reservation_token').start()

          self.run_callbacks = mock.patch('koji.plugin.run_callbacks').start()

  

      def tearDown(self):

@@ -7,12 +7,12 @@ 

  class TestChainBuild(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

          self.srcs = ['pkg1']

          self.target = 'test-target'

  

@@ -7,12 +7,12 @@ 

  class TestChainMaven(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

          self.builds = {'build1': {}, 'build2': {}, 'build3': {}}

          self.target = 'test-target'

  

@@ -3,7 +3,7 @@ 

  import koji

  import koji.policy

  import kojihub

- import kojixmlrpc

+ from kojihub import kojixmlrpc

  

  

  class OurException(Exception):
@@ -23,8 +23,8 @@ 

  class TestCheckVolumePolicy(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -53,21 +53,21 @@ 

          mock.patch('koji.pathinfo', new=self.pathinfo).start()

          self.hostcalls = kojihub.HostExports()

          self.context_db = mock.patch('koji.db.context').start()

-         mock.patch('kojihub.Host').start()

-         self.Task = mock.patch('kojihub.Task').start()

+         mock.patch('kojihub.kojihub.Host').start()

+         self.Task = mock.patch('kojihub.kojihub.Task').start()

          self.Task.return_value.assertHost = mock.MagicMock()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         mock.patch('kojihub.get_rpm', new=self.my_get_rpm).start()

-         self.get_image_build = mock.patch('kojihub.get_image_build').start()

-         mock.patch('kojihub.get_archive_type', new=self.my_get_archive_type).start()

-         mock.patch('kojihub.lookup_name', new=self.my_lookup_name).start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         mock.patch('kojihub.kojihub.get_rpm', new=self.my_get_rpm).start()

+         self.get_image_build = mock.patch('kojihub.kojihub.get_image_build').start()

+         mock.patch('kojihub.kojihub.get_archive_type', new=self.my_get_archive_type).start()

+         mock.patch('kojihub.kojihub.lookup_name', new=self.my_lookup_name).start()

          mock.patch.object(kojihub.BuildRoot, 'load', new=self.my_buildroot_load).start()

-         mock.patch('kojihub.import_archive_internal',

+         mock.patch('kojihub.kojihub.import_archive_internal',

                     new=self.my_import_archive_internal).start()

-         self._dml = mock.patch('kojihub._dml').start()

-         mock.patch('kojihub.build_notification').start()

-         mock.patch('kojihub.assert_policy').start()

-         mock.patch('kojihub.check_volume_policy',

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

+         mock.patch('kojihub.kojihub.build_notification').start()

+         mock.patch('kojihub.kojihub.assert_policy').start()

+         mock.patch('kojihub.kojihub.check_volume_policy',

                     return_value={'id': 0, 'name': 'DEFAULT'}).start()

          self.set_up_callbacks()

          self.rpms = {}
@@ -79,7 +79,7 @@ 

                            new=make_bulk_insert_grabber(self)).start()

          mock.patch.object(kojihub.UpdateProcessor, 'execute',

                            new=make_update_grabber(self)).start()

-         mock.patch('kojihub.nextval', new=self.my_nextval).start()

+         mock.patch('kojihub.kojihub.nextval', new=self.my_nextval).start()

          self.sequences = {}

  

      def tearDown(self):
@@ -173,8 +173,8 @@ 

  

          def my_ga(archive_id, **kw):

              return share['archiveinfo']

-         with mock.patch('kojihub.InsertProcessor', new=my_ip):

-             with mock.patch('kojihub.get_archive', new=my_ga):

+         with mock.patch('kojihub.kojihub.InsertProcessor', new=my_ip):

+             with mock.patch('kojihub.kojihub.get_archive', new=my_ga):

                  return orig_import_archive_internal(*a, **kw)

  

      def set_up_callbacks(self):

@@ -21,24 +21,24 @@ 

          self.pathinfo = koji.PathInfo(self.tempdir)

          mock.patch('koji.pathinfo', new=self.pathinfo).start()

          self.hostcalls = kojihub.HostExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          self.context.opts = {'EnableMaven': True}

-         mock.patch('kojihub.Host').start()

-         self.Task = mock.patch('kojihub.Task').start()

+         mock.patch('kojihub.kojihub.Host').start()

+         self.Task = mock.patch('kojihub.kojihub.Task').start()

          self.Task.return_value.assertHost = mock.MagicMock()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_maven_build = mock.patch('kojihub.get_maven_build').start()

-         self.get_archive_type = mock.patch('kojihub.get_archive_type').start()

-         mock.patch('kojihub.lookup_name', new=self.my_lookup_name).start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_maven_build = mock.patch('kojihub.kojihub.get_maven_build').start()

+         self.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type').start()

+         mock.patch('kojihub.kojihub.lookup_name', new=self.my_lookup_name).start()

          mock.patch.object(kojihub.BuildRoot, 'load', new=self.my_buildroot_load).start()

-         mock.patch('kojihub.import_archive_internal',

+         mock.patch('kojihub.kojihub.import_archive_internal',

                     new=self.my_import_archive_internal).start()

          mock.patch('koji.db._dml').start()

          mock.patch('koji.db._fetchSingle').start()

-         mock.patch('kojihub.build_notification').start()

-         mock.patch('kojihub.assert_policy').start()

-         mock.patch('kojihub.check_volume_policy',

+         mock.patch('kojihub.kojihub.build_notification').start()

+         mock.patch('kojihub.kojihub.assert_policy').start()

+         mock.patch('kojihub.kojihub.check_volume_policy',

                     return_value={'id': 0, 'name': 'DEFAULT'}).start()

          self.set_up_callbacks()

  
@@ -96,8 +96,8 @@ 

  

          def my_ga(archive_id, **kw):

              return share['archiveinfo']

-         with mock.patch('kojihub.InsertProcessor', new=my_ip):

-             with mock.patch('kojihub.get_archive', new=my_ga):

+         with mock.patch('kojihub.kojihub.InsertProcessor', new=my_ip):

+             with mock.patch('kojihub.kojihub.get_archive', new=my_ga):

                  orig_import_archive_internal(*a, **kw)

  

      def set_up_callbacks(self):

@@ -10,10 +10,10 @@ 

  class TestCreateBuildTarget(unittest.TestCase):

  

      def setUp(self):

-         self.get_build_targets = mock.patch('kojihub.get_build_targets').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_build_targets = mock.patch('kojihub.kojihub.get_build_targets').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -10,9 +10,9 @@ 

  class TestCreateExternalRepo(unittest.TestCase):

  

      def setUp(self):

-         self.get_external_repos = mock.patch('kojihub.get_external_repos').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_external_repos = mock.patch('kojihub.kojihub.get_external_repos').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -11,9 +11,9 @@ 

  class TestCreateImageBuild(unittest.TestCase):

  

      def setUp(self):

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.exports = kojihub.RootExports()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

@@ -11,13 +11,13 @@ 

  class TestCreateMavenBuild(unittest.TestCase):

  

      def setUp(self):

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.exports = kojihub.RootExports()

          self.session = mock.MagicMock()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          self.context.session.assertPerm = mock.MagicMock()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

@@ -29,23 +29,23 @@ 

          return update

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.opts = {

              'EmailDomain': 'test.domain.com',

              'NotifyOnSuccess': True,

          }

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.get_build_notifications = mock.patch('kojihub.get_build_notifications').start()

-         self.get_tag_id = mock.patch('kojihub.get_tag_id').start()

-         self.get_package_id = mock.patch('kojihub.get_package_id').start()

+         self.get_build_notifications = mock.patch('kojihub.kojihub.get_build_notifications').start()

+         self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()

+         self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()

  

          self.exports = kojihub.RootExports()

          self.exports.getLoggedInUser = mock.MagicMock()

@@ -29,25 +29,25 @@ 

          return update

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.opts = {

              'EmailDomain': 'test.domain.com',

              'NotifyOnSuccess': True,

          }

  

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.get_tag_id = mock.patch('kojihub.get_tag_id').start()

-         self.get_package_id = mock.patch('kojihub.get_package_id').start()

+         self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()

+         self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()

          self.get_build_notification_blocks = mock.patch(

-             'kojihub.get_build_notification_blocks').start()

+             'kojihub.kojihub.get_build_notification_blocks').start()

  

          self.exports = kojihub.RootExports()

          self.exports.getLoggedInUser = mock.MagicMock()

@@ -18,16 +18,16 @@ 

          return insert

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self._dml = mock.patch('kojihub._dml').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_tag_id = mock.patch('kojihub.get_tag_id').start()

-         self.get_perm_id = mock.patch('kojihub.get_perm_id').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.writeInheritanceData = mock.patch('kojihub._writeInheritanceData').start()

-         self.context = mock.patch('kojihub.context').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()

+         self.get_perm_id = mock.patch('kojihub.kojihub.get_perm_id').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.writeInheritanceData = mock.patch('kojihub.kojihub._writeInheritanceData').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

@@ -9,11 +9,11 @@ 

  class TestCreateUser(unittest.TestCase):

  

      def setUp(self):

-         self.verify_name_user = mock.patch('kojihub.verify_name_user').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.get_user_by_krb_principal = mock.patch('kojihub.get_user_by_krb_principal').start()

+         self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.get_user_by_krb_principal = mock.patch('kojihub.kojihub.get_user_by_krb_principal').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -11,12 +11,12 @@ 

  class TestCreateWinBuild(unittest.TestCase):

  

      def setUp(self):

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.exports = kojihub.RootExports()

          self.session = mock.MagicMock()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

@@ -9,8 +9,8 @@ 

  

  class TestDeleteBuild(unittest.TestCase):

  

-     @mock.patch('kojihub.context')

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.context')

+     @mock.patch('kojihub.kojihub.get_build')

      def test_delete_build_raise_error(self, build, context):

          context.session.assertPerm = mock.MagicMock()

          references = ['tags', 'rpms', 'archives', 'component_of']
@@ -18,15 +18,15 @@ 

              context = mock.MagicMock()

              context.session.return_value = context

  

-             with mock.patch('kojihub.build_references') as refs:

+             with mock.patch('kojihub.kojihub.build_references') as refs:

                  retval = defaultdict(dict)

                  retval[ref] = True

                  refs.return_value = retval

                  with self.assertRaises(koji.GenericError):

                      kojihub.delete_build(build='', strict=True)

  

-     @mock.patch('kojihub.context')

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.context')

+     @mock.patch('kojihub.kojihub.get_build')

      def test_delete_build_return_false(self, build, context):

          context.session.assertPerm = mock.MagicMock()

          references = ['tags', 'rpms', 'archives', 'component_of']
@@ -34,14 +34,14 @@ 

              context = mock.MagicMock()

              context.session.return_value = context

  

-             with mock.patch('kojihub.build_references') as refs:

+             with mock.patch('kojihub.kojihub.build_references') as refs:

                  retval = defaultdict(dict)

                  retval[ref] = True

                  refs.return_value = retval

                  assert kojihub.delete_build(build='', strict=False) is False

  

-     @mock.patch('kojihub.context')

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.context')

+     @mock.patch('kojihub.kojihub.get_build')

      def test_delete_build_check_last_used_raise_error(self, build, context):

          context.session.assertPerm = mock.MagicMock()

          references = ['tags', 'rpms', 'archives', 'component_of', 'last_used']
@@ -49,18 +49,18 @@ 

              context = mock.MagicMock()

              context.session.return_value = context

  

-             with mock.patch('kojihub.build_references') as refs:

+             with mock.patch('kojihub.kojihub.build_references') as refs:

                  retval = defaultdict(dict)

                  if ref == 'last_used':

                      retval[ref] = time.time() + 100

                      refs.return_value = retval

                      self.assertFalse(kojihub.delete_build(build='', strict=False))

  

-     @mock.patch('kojihub.get_user')

-     @mock.patch('kojihub._delete_build')

-     @mock.patch('kojihub.build_references')

-     @mock.patch('kojihub.context')

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.get_user')

+     @mock.patch('kojihub.kojihub._delete_build')

+     @mock.patch('kojihub.kojihub.build_references')

+     @mock.patch('kojihub.kojihub.context')

+     @mock.patch('kojihub.kojihub.get_build')

      def test_delete_build_lazy_refs(self, build, context, buildrefs, _delete, get_user):

          '''Test that we can handle lazy return from build_references'''

          get_user.return_value = {'authtype': 2, 'id': 1, 'krb_principal': None,

@@ -9,7 +9,7 @@ 

  class TestDeleteBuildTarget(unittest.TestCase):

  

      def setUp(self):

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

          self.exports = kojihub.RootExports()

  

      def test_non_exist_target(self):

@@ -15,12 +15,12 @@ 

          return delete

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.opts = {

              'EmailDomain': 'test.domain.com',

              'NotifyOnSuccess': True,

          }

-         self.DeleteProcessor = mock.patch('kojihub.DeleteProcessor',

+         self.DeleteProcessor = mock.patch('kojihub.kojihub.DeleteProcessor',

                                            side_effect=self.getDelete).start()

          self.deletes = []

  

@@ -15,16 +15,16 @@ 

          return delete

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.opts = {

              'EmailDomain': 'test.domain.com',

              'NotifyOnSuccess': True,

          }

  

-         self.DeleteProcessor = mock.patch('kojihub.DeleteProcessor',

+         self.DeleteProcessor = mock.patch('kojihub.kojihub.DeleteProcessor',

                                            side_effect=self.getDelete).start()

          self.deletes = []

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

          self.exports = kojihub.RootExports()

          self.exports.getLoggedInUser = mock.MagicMock()

@@ -17,13 +17,13 @@ 

          return delete

  

      def setUp(self):

-         self.DeleteProcessor = mock.patch('kojihub.DeleteProcessor',

+         self.DeleteProcessor = mock.patch('kojihub.kojihub.DeleteProcessor',

                                            side_effect=self.getDelete).start()

          self.deletes = []

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

-         self.query_rpm_sigs = mock.patch('kojihub.query_rpm_sigs').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

+         self.query_rpm_sigs = mock.patch('kojihub.kojihub.query_rpm_sigs').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.buildinfo = {'build_id': 1,

                            'epoch': None,

                            'extra': None,

@@ -15,11 +15,11 @@ 

          return update

  

      def setUp(self):

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

@@ -18,8 +18,8 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

          self.channelname = 'test-channel'

@@ -10,7 +10,7 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

      def test_non_exist_user(self):

          username = 'test-user'

@@ -23,15 +23,15 @@ 

          self.pathinfo = koji.PathInfo(self.tempdir)

          mock.patch('koji.pathinfo', new=self.pathinfo).start()

  

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

  

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_event = mock.patch('kojihub.get_event').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_event = mock.patch('kojihub.kojihub.get_event').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

          self.copyfile = mock.patch('shutil.copyfile').start()

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

  

          self.get_tag.return_value = {'id': 42, 'name': 'tag'}

          self.get_event.return_value = 12345
@@ -105,9 +105,9 @@ 

  

  class TestDistRepo(unittest.TestCase):

  

-     @mock.patch('kojihub.assert_policy')

-     @mock.patch('kojihub.dist_repo_init')

-     @mock.patch('kojihub.make_task')

+     @mock.patch('kojihub.kojihub.assert_policy')

+     @mock.patch('kojihub.kojihub.dist_repo_init')

+     @mock.patch('kojihub.kojihub.make_task')

      def test_DistRepo(self, make_task, dist_repo_init, assert_policy):

          session = kojihub.context.session = mock.MagicMock()

          session.user_id = 123
@@ -210,10 +210,10 @@ 

          koji.dump_json("%s/repo_manifest" % uploaddir, self.files)

  

          # mocks

-         self.repo_info = mock.patch('kojihub.repo_info').start()

+         self.repo_info = mock.patch('kojihub.kojihub.repo_info').start()

          self.repo_info.return_value = self.rinfo.copy()

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.get_rpm.side_effect = self.our_get_rpm

          self.get_build.side_effect = self.our_get_build

  

@@ -19,9 +19,9 @@ 

          return query

  

      def setUp(self):

-         self.lookup_build_target = mock.patch('kojihub.lookup_build_target').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

+         self.lookup_build_target = mock.patch('kojihub.kojihub.lookup_build_target').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

          self.exports = kojihub.RootExports()

          self.target_name = 'build-target'

          self.name = 'build-target-rename'
@@ -32,7 +32,7 @@ 

          self.dest_tag_info = {'id': 112, 'name': self.dest_tag}

          self.session = kojihub.context.session = mock.MagicMock()

          self.session.assertPerm = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_singleValue = mock.MagicMock()

@@ -23,21 +23,21 @@ 

          return update

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.exports = kojihub.RootExports()

          self.channel_name = 'test-channel'

          self.channel_name_new = 'test-channel-2'

          self.channel_info = {'id': 123, 'name': self.channel_name, 'description': 'description',

                               'comment': 'comment'}

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -74,7 +74,7 @@ 

  

      def test_edit_channel_valid(self):

          self.verify_name_internal.return_value = None

-         kojihub.get_channel.side_effect = [self.channel_info, {}]

+         self.get_channel.side_effect = [self.channel_info, {}]

  

          r = self.exports.editChannel(self.channel_name, name=self.channel_name_new,

                                       description='description_new')
@@ -108,7 +108,7 @@ 

  

      def test_edit_channel_no_change(self):

          self.verify_name_internal.return_value = None

-         kojihub.get_channel.return_value = self.channel_info

+         self.get_channel.return_value = self.channel_info

  

          r = self.exports.editChannel(self.channel_name, description='description')

          self.assertFalse(r)

@@ -10,9 +10,9 @@ 

  class TestEditExternalRepo(unittest.TestCase):

  

      def setUp(self):

-         self.get_external_repo = mock.patch('kojihub.get_external_repo').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -23,20 +23,20 @@ 

  

      def setUp(self):

          self.diff = None

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context_db.session.assertLogin = mock.MagicMock()

          self.context.session.assertPerm = mock.MagicMock()

          self.exports = kojihub.RootExports()

-         self.get_host = mock.patch('kojihub.get_host').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

          self.hostinfo = {

              'id': 123,

              'user_id': 234,
@@ -52,49 +52,48 @@ 

          mock.patch.stopall()

  

      def test_edit_host_missing(self):

-         kojihub.get_host.side_effect = koji.GenericError

+         self.get_host.side_effect = koji.GenericError

          with self.assertRaises(koji.GenericError):

              self.exports.editHost('hostname')

-         kojihub.get_host.assert_called_once_with('hostname', strict=True)

+         self.get_host.assert_called_once_with('hostname', strict=True)

          self.assertEqual(self.inserts, [])

          self.assertEqual(self.updates, [])

  

      def test_edit_host_invalid_description(self):

          description = ['description']

-         kojihub.get_host.return_value = self.hostinfo

+         self.get_host.return_value = self.hostinfo

          with self.assertRaises(koji.ParameterError) as ex:

              self.exports.editHost('hostname', description=description)

              self.assertEqual('Invalid type for description parameter: %s' % type(description),

                               str(ex.exception))

-         kojihub.get_host.assert_called_once_with('hostname', strict=True)

+         self.get_host.assert_called_once_with('hostname', strict=True)

          self.assertEqual(self.inserts, [])

          self.assertEqual(self.updates, [])

  

      def test_edit_host_invalid_comment_parameter(self):

          comment = ['comment']

-         kojihub.get_host.return_value = self.hostinfo

+         self.get_host.return_value = self.hostinfo

          with self.assertRaises(koji.ParameterError) as ex:

              self.exports.editHost('hostname', comment=comment)

              self.assertEqual('Invalid type for comment parameter: %s' % type(comment),

                               str(ex.exception))

-         kojihub.get_host.assert_called_once_with('hostname', strict=True)

+         self.get_host.assert_called_once_with('hostname', strict=True)

          self.assertEqual(self.inserts, [])

          self.assertEqual(self.updates, [])

  

      def test_edit_host_invalid_arches_parameter(self):

          arches = ['arches arches']

-         kojihub.get_host.return_value = self.hostinfo

+         self.get_host.return_value = self.hostinfo

          with self.assertRaises(koji.ParameterError) as ex:

              self.exports.editHost('hostname', arches=arches)

              self.assertEqual('Invalid type for arches parameter: %s' % type(arches),

                               str(ex.exception))

-         kojihub.get_host.assert_called_once_with('hostname', strict=True)

+         self.get_host.assert_called_once_with('hostname', strict=True)

          self.assertEqual(self.inserts, [])

          self.assertEqual(self.updates, [])

  

      def test_edit_host_valid(self):

-         kojihub.get_host = mock.MagicMock()

-         kojihub.get_host.return_value = self.hostinfo

+         self.get_host.return_value = self.hostinfo

          self.context_db.event_id = 42

          self.context_db.session.user_id = 23

  
@@ -102,11 +101,11 @@ 

                                    comment='comment_new', non_existing_kw='bogus')

  

          self.assertTrue(r)

-         kojihub.get_host.assert_called_once_with('hostname', strict=True)

+         self.get_host.assert_called_once_with('hostname', strict=True)

  

          # revoke

          self.assertEqual(len(self.updates), 1)

-         values = kojihub.get_host.return_value

+         values = self.get_host.return_value

          clauses = ['host_id = %(id)i', 'active = TRUE']

          revoke_data = {

              'revoke_event': 42,
@@ -139,15 +138,14 @@ 

          self.assertEqual(insert.rawdata, rawdata)

  

      def test_edit_host_no_change(self):

-         kojihub.get_host = mock.MagicMock()

-         kojihub.get_host.return_value = self.hostinfo

+         self.get_host.return_value = self.hostinfo

          self.context_db.event_id = 42

          self.context_db.session.user_id = 23

  

          r = self.exports.editHost('hostname')

  

          self.assertFalse(r)

-         kojihub.get_host.assert_called_once_with('hostname', strict=True)

+         self.get_host.assert_called_once_with('hostname', strict=True)

  

          self.assertEqual(len(self.updates), 0)

          self.assertEqual(len(self.inserts), 0)

@@ -12,10 +12,10 @@ 

  class TestEditPermission(unittest.TestCase):

  

      def setUp(self):

-         self.lookup_perm = mock.patch('kojihub.lookup_perm').start()

-         self.update_processor = mock.patch('kojihub.UpdateProcessor').start()

+         self.lookup_perm = mock.patch('kojihub.kojihub.lookup_perm').start()

+         self.update_processor = mock.patch('kojihub.kojihub.UpdateProcessor').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -33,21 +33,21 @@ 

          return query

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_perm_id = mock.patch('kojihub.get_perm_id').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_perm_id = mock.patch('kojihub.kojihub.get_perm_id').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context_db.session.assertLogin = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_singleValue = mock.MagicMock()

@@ -8,11 +8,11 @@ 

  class TestEditTagExternalRepo(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_external_repo = mock.patch('kojihub.get_external_repo').start()

-         self.get_tag_external_repos = mock.patch('kojihub.get_tag_external_repos').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()

+         self.get_tag_external_repos = mock.patch('kojihub.kojihub.get_tag_external_repos').start()

          self.get_tag.return_value = {'id': 1, 'name': 'tag'}

          self.get_external_repo.return_value = {'id': 11, 'name': 'ext_repo'}

          self.get_tag_external_repos.return_value = [{'external_repo_id': 11,
@@ -22,8 +22,8 @@ 

                                                       'arches': 'x86_64 i686'}]

  

          self.remove_external_repo_from_tag = mock.patch(

-             'kojihub.remove_external_repo_from_tag').start()

-         self.add_external_repo_to_tag = mock.patch('kojihub.add_external_repo_to_tag').start()

+             'kojihub.kojihub.remove_external_repo_from_tag').start()

+         self.add_external_repo_to_tag = mock.patch('kojihub.kojihub.add_external_repo_to_tag').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -27,15 +27,15 @@ 

  

      def setUp(self):

          self.updates = []

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.verify_name_user = mock.patch('kojihub.verify_name_user').start()

-         self.context = mock.patch('kojihub.context').start()

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.verify_name_user = mock.patch('kojihub.kojihub.verify_name_user').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertLogin = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_singleValue = mock.MagicMock()

@@ -18,8 +18,8 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

          self.channelname = 'test-channel'

@@ -10,7 +10,7 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

      def test_non_exist_user(self):

          username = 'test-user'

@@ -14,8 +14,8 @@ 

          self.tempdir = tempfile.mkdtemp()

          self.pathinfo = koji.PathInfo(self.tempdir)

          mock.patch('koji.pathinfo', new=self.pathinfo).start()

-         mock.patch('kojihub.lookup_name', new=self.my_lookup_name).start()

-         self.check_volume_policy = mock.patch('kojihub.check_volume_policy',

+         mock.patch('kojihub.kojihub.lookup_name', new=self.my_lookup_name).start()

+         self.check_volume_policy = mock.patch('kojihub.kojihub.check_volume_policy',

                  return_value={'id':0, 'name': 'DEFAULT'}).start()

          self.buildinfo = {

                  'id': 137,
@@ -48,7 +48,7 @@ 

              raise Exception('call created unexpected files')

  

          del self.buildinfo['volume_name']

-         with mock.patch('kojihub.logger') as logger:

+         with mock.patch('kojihub.kojihub.logger') as logger:

              kojihub.ensure_volume_symlink(self.buildinfo)

              logger.warning.assert_called_once()

  

@@ -19,7 +19,7 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_singleValue = mock.MagicMock()

@@ -14,9 +14,9 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

-         self.get_external_repo_id = mock.patch('kojihub.get_external_repo_id').start()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.get_external_repo_id = mock.patch('kojihub.kojihub.get_external_repo_id').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

  
@@ -99,10 +99,10 @@ 

      def setUp(self):

          self.exports = kojihub.RootExports()

          self.exports.getLoggedInUser = mock.MagicMock()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.get_header_fields = mock.patch('koji.get_header_fields').start()

          self.tempdir = tempfile.mkdtemp()

          self.pathinfo = koji.PathInfo(self.tempdir)

@@ -7,7 +7,7 @@ 

  

  class TestGetRPMDeps(unittest.TestCase):

  

-     @mock.patch('kojihub.get_rpm')

+     @mock.patch('kojihub.kojihub.get_rpm')

      def test_getRPMDeps_no_rpminfo(self, get_rpm):

          def mock_get_rpm(rpmID, strict=False):

              if strict:
@@ -21,7 +21,7 @@ 

              kojihub.RootExports().getRPMDeps(1, strict=True)

          self.assertEqual(cm.exception.args[0], 'msg')

  

-     @mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': None})

+     @mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': None})

      def test_getRPMDeps_external_rpm(self, get_rpm):

          re = kojihub.RootExports().getRPMDeps(1)

          self.assertEqual(re, [])
@@ -30,8 +30,8 @@ 

          self.assertEqual(cm.exception.args[0],

                           'Can not get dependencies, because RPM: 1 is not internal')

  

-     @mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})

-     @mock.patch('kojihub.get_build', return_value={'id': 1})

+     @mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})

+     @mock.patch('kojihub.kojihub.get_build', return_value={'id': 1})

      @mock.patch('koji.pathinfo.build', return_value='fakebuildpath')

      @mock.patch('koji.pathinfo.rpm', return_value='fakerpmrelpath')

      @mock.patch('os.path.exists', return_value=False)
@@ -42,8 +42,8 @@ 

              kojihub.RootExports().getRPMDeps(1, strict=True)

          self.assertEqual(cm.exception.args[0], "RPM file of 1 doesn't exist")

  

-     @mock.patch('kojihub.get_rpm')

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.get_rpm')

+     @mock.patch('kojihub.kojihub.get_build')

      @mock.patch('koji.pathinfo')

      def test_getRPMDeps(self, pi, build, rpm):

          pi.build.return_value = os.path.join(os.path.dirname(__file__), '../test_lib/data/rpms')

@@ -10,7 +10,7 @@ 

  

  class TestGetRPMFile(unittest.TestCase):

  

-     @mock.patch('kojihub.get_rpm')

+     @mock.patch('kojihub.kojihub.get_rpm')

      def test_getRPMFile_no_rpminfo(self, get_rpm):

          def mock_get_rpm(rpmID, strict=False):

              if strict:
@@ -25,7 +25,7 @@ 

              kojihub.RootExports().getRPMFile(1, 'filename', strict=True)

          self.assertEqual(cm.exception.args[0], 'msg')

  

-     @mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': None})

+     @mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': None})

      def test_getRPMFile_external_rpm(self, get_rpm):

          re = kojihub.RootExports().getRPMFile(1, 'filename')

          self.assertEqual(re, {})
@@ -34,8 +34,8 @@ 

          self.assertEqual(cm.exception.args[0],

                           'Can not get RPM file, because RPM: 1 is not internal')

  

-     @mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})

-     @mock.patch('kojihub.get_build', return_value={'id': 1})

+     @mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})

+     @mock.patch('kojihub.kojihub.get_build', return_value={'id': 1})

      @mock.patch('koji.pathinfo.build', return_value='fakebuildpath')

      @mock.patch('koji.pathinfo.rpm', return_value='fakerpmrelpath')

      @mock.patch('os.path.exists', return_value=False)
@@ -46,8 +46,8 @@ 

              kojihub.RootExports().getRPMFile(1, 'filename', strict=True)

          self.assertEqual(cm.exception.args[0], "RPM package file of 1 doesn't exist")

  

-     @mock.patch('kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})

-     @mock.patch('kojihub.get_build')

+     @mock.patch('kojihub.kojihub.get_rpm', return_value={'id': 1, 'build_id': 1})

+     @mock.patch('kojihub.kojihub.get_build')

      @mock.patch('koji.pathinfo')

      def test_getRPMFile(self, pi, build, rpm):

          pi.build.return_value = os.path.join(os.path.dirname(__file__),

@@ -11,7 +11,7 @@ 

  class TestGetActiveRepos(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

  

@@ -9,10 +9,10 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.list_archives = mock.patch('kojihub.list_archives').start()

-         self.get_maven_archive = mock.patch('kojihub.get_maven_archive').start()

-         self.get_win_archive = mock.patch('kojihub.get_win_archive').start()

-         self.get_image_archive = mock.patch('kojihub.get_image_archive').start()

+         self.list_archives = mock.patch('kojihub.kojihub.list_archives').start()

+         self.get_maven_archive = mock.patch('kojihub.kojihub.get_maven_archive').start()

+         self.get_win_archive = mock.patch('kojihub.kojihub.get_win_archive').start()

+         self.get_image_archive = mock.patch('kojihub.kojihub.get_image_archive').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -16,7 +16,7 @@ 

  

  class TestGetArchiveFile(unittest.TestCase):

  

-     @mock.patch('kojihub.list_archive_files')

+     @mock.patch('kojihub.kojihub.list_archive_files')

      def test_simple(self, list_archive_files):

          list_archive_files.return_value = FILES

  
@@ -29,7 +29,7 @@ 

          list_archive_files.assert_called_with(1, strict=True)

          self.assertEqual(rv, FILES[0])

  

-     @mock.patch('kojihub.list_archive_files')

+     @mock.patch('kojihub.kojihub.list_archive_files')

      def test_empty_files(self, list_archive_files):

          list_archive_files.return_value = EMPTY_FILES

  
@@ -45,7 +45,7 @@ 

          list_archive_files.assert_called_with(1, strict=True)

          self.assertEqual(cm.exception.args[0], 'error message')

  

-     @mock.patch('kojihub.list_archive_files')

+     @mock.patch('kojihub.kojihub.list_archive_files')

      def test_non_existing_file(self, list_archive_files):

          list_archive_files.return_value = FILES

  

@@ -9,7 +9,7 @@ 

  

      def setUp(self):

          super(TestGetBuild, self).setUp()

-         self.find_build_id = mock.patch('kojihub.find_build_id').start()

+         self.find_build_id = mock.patch('kojihub.kojihub.find_build_id').start()

  

      def test_non_exist_build_string(self):

          build = 'build-1-23'

@@ -6,8 +6,8 @@ 

  

  class TestGetBuildConfig(unittest.TestCase):

  

-     @mock.patch('kojihub.readFullInheritance')

-     @mock.patch('kojihub.get_tag')

+     @mock.patch('kojihub.kojihub.readFullInheritance')

+     @mock.patch('kojihub.kojihub.get_tag')

      def test_simple_tag(self, get_tag, readFullInheritance):

          tag = 'tag_name'

          get_tag.return_value = {'id': 123, 'name': tag, 'extra': {}}
@@ -25,8 +25,8 @@ 

              'config_inheritance': {'extra': {}, 'arches': None},

          })

  

-     @mock.patch('kojihub.readFullInheritance')

-     @mock.patch('kojihub.get_tag')

+     @mock.patch('kojihub.kojihub.readFullInheritance')

+     @mock.patch('kojihub.kojihub.get_tag')

      def test_basic_inherited(self, get_tag, readFullInheritance):

          tag = 'tag_name'

          get_tag.side_effect = [
@@ -80,8 +80,8 @@ 

              'name': 'tag_name'

          })

  

-     @mock.patch('kojihub.readFullInheritance')

-     @mock.patch('kojihub.get_tag')

+     @mock.patch('kojihub.kojihub.readFullInheritance')

+     @mock.patch('kojihub.kojihub.get_tag')

      def test_inherited_noconfig(self, get_tag, readFullInheritance):

          tag = 'tag_name'

          get_tag.side_effect = [

@@ -10,7 +10,7 @@ 

  class TestGetBuildLogs(unittest.TestCase):

  

      def setUp(self):

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.pathinfo = mock.patch('koji.pathinfo').start()

          self.tempdir = tempfile.mkdtemp()

          koji.pathinfo.build_logs.return_value = self.tempdir
@@ -36,10 +36,10 @@ 

  

      def test_get_build_logs_basic(self):

          files = [

-                 'noarch/build.log',

-                 'x86_64/build.log',

-                 's390x/build.log',

-                 ]

+             'noarch/build.log',

+             'x86_64/build.log',

+             's390x/build.log',

+         ]

          files.sort()

          self.make_tree(files)

          data = kojihub.get_build_logs('fakebuild')
@@ -58,25 +58,25 @@ 

              fo.write('NOT A DIRECTORY\n')

          koji.pathinfo.build_logs.return_value = fn

          try:

-             data = kojihub.get_build_logs('fakebuild')

+             kojihub.get_build_logs('fakebuild')

              raise Exception('Expected exception not raised')

          except koji.GenericError as e:

              self.assertEqual(e.args[0][:15], 'Not a directory')

  

      def test_get_build_logs_emptydirs(self):

          files = [

-                 './build.log',

-                 'noarch/build.log',

-                 'noarch/root.log',

-                 'x86_64/build.log',

-                 's390x/build.log',

-                 'oddball/log/dir/fake.log',

-                 ]

+             './build.log',

+             'noarch/build.log',

+             'noarch/root.log',

+             'x86_64/build.log',

+             's390x/build.log',

+             'oddball/log/dir/fake.log',

+         ]

          empty_dirs = [

-                 'foo/bar/baz/',

-                 'a/b/c/',

-                 'empty/',

-                 ]

+             'foo/bar/baz/',

+             'a/b/c/',

+             'empty/',

+         ]

          files.sort()

          self.make_tree(files + empty_dirs)

          data = kojihub.get_build_logs('fakebuild')
@@ -84,20 +84,20 @@ 

          files2.sort()

          self.assertEqual(files, files2)

  

-     @mock.patch('kojihub.logger')

+     @mock.patch('kojihub.kojihub.logger')

      def test_get_build_logs_symlinks(self, logger):

          # symlinks should be ignored with a warning

          files = [

-                 'noarch/build.log',

-                 'noarch/root.log',

-                 'noarch/mock.log',

-                 'noarch/checkout.log',

-                 'noarch/readme.txt',

-                 'oddball/log/dir/fake.log',

-                 ]

+             'noarch/build.log',

+             'noarch/root.log',

+             'noarch/mock.log',

+             'noarch/checkout.log',

+             'noarch/readme.txt',

+             'oddball/log/dir/fake.log',

+         ]

          empty_dirs = [

-                 'just_links/',

-                 ]

+             'just_links/',

+         ]

          files.sort()

          self.make_tree(files + empty_dirs)

          os.symlink('SOME/PATH', '%s/%s' % (self.tempdir, 'symlink.log'))
@@ -109,18 +109,18 @@ 

          self.assertEqual(files, files2)

          self.assertEqual(logger.warning.call_count, 3)

  

-     @mock.patch('kojihub.logger')

+     @mock.patch('kojihub.kojihub.logger')

      def test_get_build_logs_nonfile(self, logger):

          # symlinks should be ignored

          files = [

-                 'noarch/build.log',

-                 'noarch/root.log',

-                 'noarch/mock.log',

-                 'noarch/checkout.log',

-                 'noarch/readme.txt',

-                 'noarch/hello',

-                 'oddball/log/dir/fake.log',

-                 ]

+             'noarch/build.log',

+             'noarch/root.log',

+             'noarch/mock.log',

+             'noarch/checkout.log',

+             'noarch/readme.txt',

+             'noarch/hello',

+             'oddball/log/dir/fake.log',

+         ]

          files.sort()

          self.make_tree(files)

          os.mkfifo('%s/%s' % (self.tempdir, 'this_is_a_named_pipe'))

@@ -7,7 +7,7 @@ 

  class TestGetBuildNotification(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()

          self.query = self.QueryProcessor.return_value

          self.exports = kojihub.RootExports()

  

@@ -7,7 +7,7 @@ 

  class TestGetBuildNotificationBlock(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()

          self.query = self.QueryProcessor.return_value

          self.exports = kojihub.RootExports()

  

@@ -7,9 +7,9 @@ 

  class TestGetBuildNotificationBlocks(unittest.TestCase):

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.get_build_notification_blocks = mock.patch(

-             'kojihub.get_build_notification_blocks').start()

+             'kojihub.kojihub.get_build_notification_blocks').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -7,8 +7,8 @@ 

  class TestGetBuildNotifications(unittest.TestCase):

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.get_build_notifications = mock.patch('kojihub.get_build_notifications').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.get_build_notifications = mock.patch('kojihub.kojihub.get_build_notifications').start()

  

      def test_loggedin_user(self):

          self.get_user.return_value = {'id': 1}

@@ -9,7 +9,7 @@ 

  class TestGetBuildTarget(unittest.TestCase):

  

      def setUp(self):

-         self.get_build_targets = mock.patch('kojihub.get_build_targets').start()

+         self.get_build_targets = mock.patch('kojihub.kojihub.get_build_targets').start()

          self.exports = kojihub.RootExports()

          self.build_target = 'build-target'

  

@@ -11,12 +11,12 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.name_or_id_clause = mock.patch('kojihub.name_or_id_clause').start()

-         self.get_tag_id = mock.patch('kojihub.get_tag_id').start()

+         self.name_or_id_clause = mock.patch('kojihub.kojihub.name_or_id_clause').start()

+         self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.build_target = 'build-target'

@@ -10,14 +10,14 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_execute = mock.MagicMock()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_maven_build = mock.patch('kojihub.get_maven_build').start()

-         self.get_win_build = mock.patch('kojihub.get_win_build').start()

-         self.get_image_build = mock.patch('kojihub.get_image_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_maven_build = mock.patch('kojihub.kojihub.get_maven_build').start()

+         self.get_win_build = mock.patch('kojihub.kojihub.get_win_build').start()

+         self.get_image_build = mock.patch('kojihub.kojihub.get_image_build').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -7,7 +7,7 @@ 

  

  class TestGetBuildroot(unittest.TestCase):

      def setUp(self):

-         self.query_buildroots = mock.patch('kojihub.query_buildroots').start()

+         self.query_buildroots = mock.patch('kojihub.kojihub.query_buildroots').start()

          self.buildroot_id = 1

  

      def test_empty_buildroots_without_strict(self):

@@ -12,8 +12,8 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

          self.os_path_exists = mock.patch('os.path.exists').start()

  

@@ -19,10 +19,10 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

  

      def tearDown(self):

@@ -9,7 +9,7 @@ 

  class TestGetExternalRepo(unittest.TestCase):

  

      def setUp(self):

-         self.get_external_repos = mock.patch('kojihub.get_external_repos').start()

+         self.get_external_repos = mock.patch('kojihub.kojihub.get_external_repos').start()

          self.exports = kojihub.RootExports()

  

      def test_non_exist_repo_with_strict(self):

@@ -9,7 +9,9 @@ 

  class TestGetGroupMembers(unittest.TestCase):

  

      def setUp(self):

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.context.session.assertPerm = mock.MagicMock()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.exports = kojihub.RootExports()

  

      def test_non_exist_group(self):

@@ -17,10 +17,10 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.exports = kojihub.RootExports()

@@ -17,7 +17,7 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_singleValue = mock.MagicMock()

@@ -9,9 +9,9 @@ 

  class TestGetNextBuild(unittest.TestCase):

  

      def setUp(self):

-         self.get_next_release = mock.patch('kojihub.get_next_release').start()

-         self.new_build = mock.patch('kojihub.new_build').start()

-         self._dml = mock.patch('kojihub._dml').start()

+         self.get_next_release = mock.patch('kojihub.kojihub.get_next_release').start()

+         self.new_build = mock.patch('kojihub.kojihub.new_build').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

          self.binfo = {'name': 'name', 'version': 'version'}

  

      def tearDown(self):

@@ -8,9 +8,9 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self._dml = mock.patch('kojihub._dml').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

          self.query = self.QueryProcessor.return_value

          self.binfo = {'name': 'name', 'version': 'version'}

  

@@ -29,23 +29,23 @@ 

          return update

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.opts = {

              'EmailDomain': 'test.domain.com',

              'NotifyOnSuccess': True,

          }

  

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.readPackageList = mock.patch('kojihub.readPackageList').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.readPackageList = mock.patch('kojihub.kojihub.readPackageList').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

          self.exports = kojihub.RootExports()

  

@@ -15,14 +15,14 @@ 

          return query

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

  

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.userinfo = {'id': 123, 'name': 'testuser'}

          self.exports.getLoggedInUser = mock.MagicMock()

  

@@ -11,12 +11,12 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_external_repo = mock.patch('kojihub.get_external_repo').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_external_repo = mock.patch('kojihub.kojihub.get_external_repo').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.build_tag = 'tag'

@@ -6,11 +6,12 @@ 

  

  QP = kojihub.QueryProcessor

  

+ 

  class TestGetTaskChildren(unittest.TestCase):

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

-                 side_effect=self.getQuery).start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

+                                          side_effect=self.getQuery).start()

          self.queries = []

  

      def getQuery(self, *args, **kwargs):

@@ -34,8 +34,8 @@ 

          with self.assertRaises(GenericError):

              kojihub.get_upload_path(reldir='tasks/1/should_be_number', name='error', create=True)

  

-     @mock.patch('kojihub.context')

-     @mock.patch('kojihub.Host')

+     @mock.patch('kojihub.kojihub.context')

+     @mock.patch('kojihub.kojihub.Host')

      def test_get_upload_path_invalid_upload_dir_owner(self, host, context):

          cursor = mock.MagicMock()

          context.cnx.cursor.return_value = cursor
@@ -49,7 +49,7 @@ 

          with self.assertRaises(GenericError):

              kojihub.get_upload_path(reldir=reldir, name='error', create=True)

  

-     @mock.patch('kojihub.Host')

+     @mock.patch('kojihub.kojihub.Host')

      def test_get_upload_path_invalid_upload_no_dir_owner(self, host):

          dir = kojihub.get_upload_path(reldir='tasks/1/1', name='error', create=False)

          assert dir == '%s/work/tasks/1/1/error' % self.topdir

@@ -12,8 +12,8 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

  
@@ -89,7 +89,7 @@ 

  

  class TestGetUserByKrbPrincipal(unittest.TestCase):

      def setUp(self):

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

      def test_wrong_type_krb_principal(self):

          krb_principal = ['test-user']

@@ -6,7 +6,7 @@ 

  

  class TestGetUserPerms(unittest.TestCase):

      def setUp(self):

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.get_user_perms = mock.patch('koji.auth.get_user_perms').start()

  

      def tearDown(self):

@@ -9,7 +9,7 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

  

      def test_non_exist_volume_with_strict(self):

          volume = ['test-volume']

@@ -13,14 +13,14 @@ 

  class TestGrantPermission(unittest.TestCase):

  

      def setUp(self):

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.lookup_perm = mock.patch('kojihub.lookup_perm').start()

-         self.insert_processor = mock.patch('kojihub.InsertProcessor').start()

-         self.update_processor = mock.patch('kojihub.UpdateProcessor').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.lookup_perm = mock.patch('kojihub.kojihub.lookup_perm').start()

+         self.insert_processor = mock.patch('kojihub.kojihub.InsertProcessor').start()

+         self.update_processor = mock.patch('kojihub.kojihub.UpdateProcessor').start()

          self.get_user_perms = mock.patch('koji.auth.get_user_perms').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

@@ -40,24 +40,24 @@ 

          self.inserts = []

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.lookup_tag = mock.patch('kojihub.lookup_tag').start()

-         self.lookup_group = mock.patch('kojihub.lookup_group').start()

-         self.get_tag_groups = mock.patch('kojihub.get_tag_groups').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.lookup_tag = mock.patch('kojihub.kojihub.lookup_tag').start()

+         self.lookup_group = mock.patch('kojihub.kojihub.lookup_group').start()

+         self.get_tag_groups = mock.patch('kojihub.kojihub.get_tag_groups').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

          self.context_db.session.assertLogin = mock.MagicMock()

  

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

          self.tag = 'tag'
@@ -195,7 +195,7 @@ 

  

          # no group for tag found

          self.reset_db_processors()

-         with mock.patch('kojihub.QueryProcessor', side_effect=self.getEmptyQuery):

+         with mock.patch('kojihub.kojihub.QueryProcessor', side_effect=self.getEmptyQuery):

              with self.assertRaises(koji.GenericError) as cm:

                  kojihub.grplist_remove(self.tag, self.group)

  
@@ -207,7 +207,7 @@ 

  

          # force = True

          self.reset_db_processors()

-         with mock.patch('kojihub.QueryProcessor',

+         with mock.patch('kojihub.kojihub.QueryProcessor',

                          side_effect=self.getEmptyQuery):

              kojihub.grplist_remove(self.tag, self.group, force=True)

  

@@ -7,7 +7,7 @@ 

  class TestImportArchive(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertPerm = mock.MagicMock()

          self.filepath = 'path/to/file'

@@ -20,19 +20,19 @@ 

          with open(self.src_filename, 'w'):

              pass

  

-         self.check_volume_policy = mock.patch('kojihub.check_volume_policy').start()

-         self.new_typed_build = mock.patch('kojihub.new_typed_build').start()

+         self.check_volume_policy = mock.patch('kojihub.kojihub.check_volume_policy').start()

+         self.new_typed_build = mock.patch('kojihub.kojihub.new_typed_build').start()

          self._dml = mock.patch('koji.db._dml').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.add_rpm_sig = mock.patch('kojihub.add_rpm_sig').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.add_rpm_sig = mock.patch('kojihub.kojihub.add_rpm_sig').start()

          self.rip_rpm_sighdr = mock.patch('koji.rip_rpm_sighdr').start()

-         self.import_rpm_file = mock.patch('kojihub.import_rpm_file').start()

-         self.import_rpm = mock.patch('kojihub.import_rpm').start()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.import_rpm_file = mock.patch('kojihub.kojihub.import_rpm_file').start()

+         self.import_rpm = mock.patch('kojihub.kojihub.import_rpm').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

-         self.new_package = mock.patch('kojihub.new_package').start()

+         self.new_package = mock.patch('kojihub.kojihub.new_package').start()

          self.get_rpm_header = mock.patch('koji.get_rpm_header').start()

          self.pathinfo_work = mock.patch('koji.pathinfo.work').start()

          self.os_path_exists = mock.patch('os.path.exists').start()

@@ -10,14 +10,15 @@ 

  class TestImportImageInternal(unittest.TestCase):

      def setUp(self):

          self.tempdir = tempfile.mkdtemp()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

-         self.Task = mock.patch('kojihub.Task').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_archive_type = mock.patch('kojihub.get_archive_type').start()

+         self.Task = mock.patch('kojihub.kojihub.Task').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type').start()

          self.path_work = mock.patch('koji.pathinfo.work').start()

-         self.import_archive = mock.patch('kojihub.import_archive').start()

+         self.import_archive = mock.patch('kojihub.kojihub.import_archive').start()

          self.build = mock.patch('koji.pathinfo.build').start()

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

  

      def tearDown(self):

          shutil.rmtree(self.tempdir)

@@ -28,7 +28,7 @@ 

          # Touch a file

          with open(self.src_filename, 'w'):

              pass

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.context_db = mock.patch('koji.db.context').start()

          self.cursor = mock.MagicMock()
@@ -46,13 +46,13 @@ 

              1106: 'sourcepackage',

              261: 'payload hash',

          }

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.get_rpm_header = mock.patch('koji.get_rpm_header').start()

-         self.new_typed_build = mock.patch('kojihub.new_typed_build').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

+         self.new_typed_build = mock.patch('kojihub.kojihub.new_typed_build').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

          self.os_path_exists = mock.patch('os.path.exists').start()

          self.os_path_basename = mock.patch('os.path.basename').start()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

  
@@ -167,7 +167,7 @@ 

          self.get_rpm_header.return_value = retval

          self.os_path_exists.return_value = True

          self.os_path_basename.return_value = 'name-version-release.arch.rpm'

-         kojihub.get_build.return_value = None

+         self.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))

@@ -16,17 +16,17 @@ 

          self.mm = mock.MagicMock()

          # Note: the following mocks copy() the return value dict because some

          # of the tests modify it

-         self.mm.get_build = mock.patch('kojihub.get_build',

+         self.mm.get_build = mock.patch('kojihub.kojihub.get_build',

                                         return_value=GET_BUILD_RV.copy()).start()

-         self.mm.get_archive_type = mock.patch('kojihub.get_archive_type',

+         self.mm.get_archive_type = mock.patch('kojihub.kojihub.get_archive_type',

                                                return_value=GET_ARCHIVE_TYPE_RV.copy()).start()

-         self.mm.get_archive = mock.patch('kojihub.get_archive',

+         self.mm.get_archive = mock.patch('kojihub.kojihub.get_archive',

                                           return_value=GET_ARCHIVE_RV.copy()).start()

-         self.mm.get_maven_archive = mock.patch('kojihub.get_maven_archive').start()

-         self.mm.get_win_archive = mock.patch('kojihub.get_win_archive').start()

-         self.mm.get_image_archive = mock.patch('kojihub.get_image_archive').start()

-         self.mm.get_zipfile_list = mock.patch('kojihub._get_zipfile_list').start()

-         self.mm.get_tarball_list = mock.patch('kojihub._get_tarball_list').start()

+         self.mm.get_maven_archive = mock.patch('kojihub.kojihub.get_maven_archive').start()

+         self.mm.get_win_archive = mock.patch('kojihub.kojihub.get_win_archive').start()

+         self.mm.get_image_archive = mock.patch('kojihub.kojihub.get_image_archive').start()

+         self.mm.get_zipfile_list = mock.patch('kojihub.kojihub._get_zipfile_list').start()

+         self.mm.get_tarball_list = mock.patch('kojihub.kojihub._get_tarball_list').start()

          self.maven_archive = {'archive_id': 1, 'group_id': 'gid', 'artifact_id': 'aid',

                                'version': '1.0.0'}

          self.win_archive = {'archive_id': 1, 'relpath': 'rpath', 'platform': 'all',

@@ -10,9 +10,9 @@ 

  class TestListArchives(unittest.TestCase):

      def setUp(self):

          self.maxDiff = None

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_host = mock.patch('kojihub.get_host').start()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.get_query).start()

          self.queries = []

          self.exports = kojihub.RootExports()
@@ -36,7 +36,7 @@ 

          self.assertEqual(query.joins, ['archivetypes on archiveinfo.type_id = archivetypes.id',

                                         'btype ON archiveinfo.btype_id = btype.id'])

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_archives_strict(self, QueryProcessor):

          query = QueryProcessor.return_value

          query.execute.return_value = None
@@ -208,7 +208,7 @@ 

                            'image_archives ON archiveinfo.id = image_archives.archive_id'])

          self.assertEqual(query.values, {'arch': 'i386'})

  

-     @mock.patch('kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})

+     @mock.patch('kojihub.kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})

      def test_list_archives_type_others(self, lookup_name):

          kojihub.list_archives(type='other')

          self.assertEqual(len(self.queries), 1)
@@ -220,13 +220,13 @@ 

                            'btype ON archiveinfo.btype_id = btype.id'])

          self.assertEqual(query.values, {'btype_id': 111})

  

-     @mock.patch('kojihub.lookup_name', return_value=None)

+     @mock.patch('kojihub.kojihub.lookup_name', return_value=None)

      def test_list_archives_type_not_found(self, lookup_name):

          with self.assertRaises(koji.GenericError) as cm:

              kojihub.list_archives(type='other')

          self.assertEqual(cm.exception.args[0], 'unsupported archive type: other')

  

-     @mock.patch('kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})

+     @mock.patch('kojihub.kojihub.lookup_name', return_value={'id': 111, 'name': 'other'})

      def test_list_archives_type_other_with_typeinfo(self, lookup_name):

          with self.assertRaises(koji.GenericError) as cm:

              kojihub.list_archives(type='other', typeInfo={'somekey': 'somevalue'})

@@ -9,7 +9,7 @@ 

  class TestListBTypes(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.get_query).start()

          self.queries = []

          self.exports = kojihub.RootExports()

@@ -20,13 +20,13 @@ 

          self.maxDiff = None

          self.exports = kojihub.RootExports()

          self.query_executeOne = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

  

-         self.context = mock.patch('kojihub.context').start()

-         self.get_package_id = mock.patch('kojihub.get_package_id').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.cursor = mock.MagicMock()

          self.build_list = [{'build_id': 9,

                              'epoch': 0,

@@ -17,14 +17,14 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.exports = kojihub.RootExports()

-         self.get_host = mock.patch('kojihub.get_host').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -10,8 +10,8 @@ 

  class TestListHosts(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

-                 side_effect=self.get_query).start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

+                                          side_effect=self.get_query).start()

          self.queries = []

          self.exports = kojihub.RootExports()

  
@@ -31,9 +31,9 @@ 

          query = self.queries[0]

          self.assertEqual(query.tables, ['host_config'])

          self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])

-         self.assertEqual(query.clauses, ['host_config.active IS TRUE',])

+         self.assertEqual(query.clauses, ['host_config.active IS TRUE'])

  

-     @mock.patch('kojihub.get_user')

+     @mock.patch('kojihub.kojihub.get_user')

      def test_list_hosts_user_id(self, get_user):

          get_user.return_value = {'id': 99}

          self.exports.listHosts(userID=99)
@@ -44,7 +44,7 @@ 

          self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])

          self.assertEqual(query.clauses, ['host_config.active IS TRUE', 'user_id = %(userID)i'])

  

-     @mock.patch('kojihub.get_channel_id')

+     @mock.patch('kojihub.kojihub.get_channel_id')

      def test_list_hosts_channel_id(self, get_channel_id):

          get_channel_id.return_value = 2

          self.exports.listHosts(channelID=2)
@@ -58,7 +58,7 @@ 

              'host_channels.active IS TRUE',

              'host_channels.channel_id = %(channelID)i',

              'host_config.active IS TRUE',

-             ])

+         ])

  

      def test_list_hosts_single_arch(self):

          self.exports.listHosts(arches='x86_64')
@@ -68,7 +68,7 @@ 

          self.assertEqual(query.tables, ['host_config'])

          self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])

          self.assertEqual(query.clauses, ['arches ~ %(archPattern)s',

-                                         'host_config.active IS TRUE'])

+                                          'host_config.active IS TRUE'])

  

      def test_list_hosts_multi_arch(self):

          self.exports.listHosts(arches=['x86_64', 's390'])
@@ -92,7 +92,7 @@ 

          query = self.queries[0]

          self.assertEqual(query.tables, ['host_config'])

          self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])

-         self.assertEqual(query.clauses, ['host_config.active IS TRUE','ready IS TRUE'])

+         self.assertEqual(query.clauses, ['host_config.active IS TRUE', 'ready IS TRUE'])

  

      def test_list_hosts_nonready(self):

          self.exports.listHosts(ready=0)
@@ -101,7 +101,7 @@ 

          query = self.queries[0]

          self.assertEqual(query.tables, ['host_config'])

          self.assertEqual(query.joins, ['host ON host.id = host_config.host_id'])

-         self.assertEqual(query.clauses, ['host_config.active IS TRUE','ready IS FALSE'])

+         self.assertEqual(query.clauses, ['host_config.active IS TRUE', 'ready IS FALSE'])

  

      def test_list_hosts_enabled(self):

          self.exports.listHosts(enabled=1)

@@ -9,7 +9,7 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.get_query).start()

          self.queries = []

          self.exports = kojihub.RootExports()

@@ -9,12 +9,12 @@ 

  

  class TestListRpms(unittest.TestCase):

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.get_query).start()

          self.queries = []

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_host = mock.patch('kojihub.get_host').start()

-         self._dml = mock.patch('kojihub._dml').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

          self.list_rpms = {'arch': 'x86_64',

                            'build_id': 1,

                            'buildroot_id': 2,

@@ -10,14 +10,14 @@ 

  

  class TestListTagged(unittest.TestCase):

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.get_tag = mock.patch('kojihub.get_tag').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.readTaggedBuilds = mock.patch('kojihub.readTaggedBuilds').start()

+         self.readTaggedBuilds = mock.patch('kojihub.kojihub.readTaggedBuilds').start()

          self.tag_name = 'test-tag'

          self.taginfo = {'id': 1, 'name': 'tag'}

          self.tagged_build = [

@@ -10,14 +10,14 @@ 

  

  class TestListTaggedArchives(unittest.TestCase):

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.get_tag = mock.patch('kojihub.get_tag').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.readTaggedArchives = mock.patch('kojihub.readTaggedArchives').start()

+         self.readTaggedArchives = mock.patch('kojihub.kojihub.readTaggedArchives').start()

          self.tag_name = 'test-tag'

          self.taginfo = {'id': 1, 'name': 'tag'}

          self.tagged_archives = [

@@ -10,14 +10,14 @@ 

  

  class TestListTaggedRPMS(unittest.TestCase):

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.get_tag = mock.patch('kojihub.get_tag').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.readTaggedRPMS = mock.patch('kojihub.readTaggedRPMS').start()

+         self.readTaggedRPMS = mock.patch('kojihub.kojihub.readTaggedRPMS').start()

          self.tag_name = 'test-tag'

          self.taginfo = {'id': 1, 'name': 'tag'}

          self.tagged_rpms = [

@@ -12,11 +12,11 @@ 

  

      def setUp(self):

          self.maxDiff = None

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.cursor = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

  
@@ -43,7 +43,7 @@ 

              self.exports.listTags(build=build_name)

          self.assertEqual(f"No such build: {build_name}", str(cm.exception))

  

-     @mock.patch('kojihub.lookup_package')

+     @mock.patch('kojihub.kojihub.lookup_package')

      def test_non_exist_package(self, lookup_package):

          self.cursor.fetchone.return_value = None

          self.context.cnx.cursor.return_value = self.cursor
@@ -68,7 +68,7 @@ 

          self.assertEqual("only one of build and package may be specified", str(cm.exception))

          self.get_build.assert_not_called()

  

-     @mock.patch('kojihub.lookup_package')

+     @mock.patch('kojihub.kojihub.lookup_package')

      def test_exist_package_and_perms(self, lookup_package):

          package_info = {'id': 123, 'name': 'package-name'}

          self.cursor.fetchone.return_value = None

@@ -43,7 +43,7 @@ 

              }

          })

  

-     @mock.patch('kojihub.list_volumes')

+     @mock.patch('kojihub.kojihub.list_volumes')

      @mock.patch('os.stat')

      @mock.patch('os.path.isdir')

      @mock.patch('os.walk')
@@ -60,7 +60,7 @@ 

          result = kojihub.list_task_output(1, all_volumes=True)

          self.assertEqual(result, {'file': ['DEFAULT']})

  

-     @mock.patch('kojihub.list_volumes')

+     @mock.patch('kojihub.kojihub.list_volumes')

      @mock.patch('os.stat')

      @mock.patch('os.path.isdir')

      @mock.patch('os.walk')

@@ -17,13 +17,13 @@ 

              aliases=mock.ANY,

          )

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_basic_invocation(self, processor):

          generator = self.hub.listTasks()

          list(generator)  # Exhaust the generator

          processor.assert_called_once_with(**self.standard_processor_kwargs)

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_by_owner_as_int(self, processor):

          generator = self.hub.listTasks(opts={'owner': 1})

          results = list(generator)  # Exhaust the generator
@@ -32,7 +32,7 @@ 

          processor.assert_called_once_with(**arguments)

          self.assertEqual(results, [])

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_by_not_owner_as_int(self, processor):

          generator = self.hub.listTasks(opts={'not_owner': 1})

          results = list(generator)  # Exhaust the generator
@@ -41,7 +41,7 @@ 

          processor.assert_called_once_with(**arguments)

          self.assertEqual(results, [])

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_by_arch(self, processor):

          generator = self.hub.listTasks(opts={'arch': ['x86_64']})

          results = list(generator)  # Exhaust the generator
@@ -50,7 +50,7 @@ 

          processor.assert_called_once_with(**arguments)

          self.assertEqual(results, [])

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_by_not_arch(self, processor):

          generator = self.hub.listTasks(opts={'not_arch': ['x86_64']})

          results = list(generator)  # Exhaust the generator
@@ -59,7 +59,7 @@ 

          processor.assert_called_once_with(**arguments)

          self.assertEqual(results, [])

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_by_owner_as_list(self, processor):

          generator = self.hub.listTasks(opts={'owner': [1, 2]})

          results = list(generator)  # Exhaust the generator
@@ -68,7 +68,7 @@ 

          processor.assert_called_once_with(**arguments)

          self.assertEqual(results, [])

  

-     @mock.patch('kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

      def test_list_tasks_by_not_owner_as_list(self, processor):

          generator = self.hub.listTasks(opts={'not_owner': [1, 2]})

          results = list(generator)  # Exhaust the generator

@@ -12,8 +12,8 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.context = mock.patch('kojihub.kojihub.context').start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

  

@@ -13,15 +13,15 @@ 

  class TestLookupName(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_executeOne = mock.MagicMock()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.nextval = mock.patch('kojihub.nextval').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

  

      def getQuery(self, *args, **kwargs):

          query = QP(*args, **kwargs)

@@ -5,13 +5,13 @@ 

  

  

  class TestDeleteEventId(unittest.TestCase):

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_delete_event_id(self, context):

          kojihub.context.event_id = 123

          kojihub._delete_event_id()

          self.assertFalse(hasattr(context, 'event_id'))

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_delete_event_id_none(self, context):

          kojihub._delete_event_id()

          self.assertFalse(hasattr(context, 'event_id'))
@@ -19,12 +19,12 @@ 

  

  class TestMassTag(unittest.TestCase):

      def setUp(self):

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self._direct_tag_build = mock.patch('kojihub._direct_tag_build').start()

-         self._delete_event_id = mock.patch('kojihub._delete_event_id').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self._direct_tag_build = mock.patch('kojihub.kojihub._direct_tag_build').start()

+         self._delete_event_id = mock.patch('kojihub.kojihub._delete_event_id').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.hub = kojihub.RootExports()

  

@@ -7,12 +7,12 @@ 

  class TestMaven(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

          self.url = 'https://test-url.com'

          self.target = 'test-target'

  

@@ -24,35 +24,35 @@ 

          return query

  

      def setUp(self):

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.query_execute = mock.MagicMock()

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_instantiation_not_a_host(self, context):

          context.session.getHostId.return_value = None

          context.session.logged_in = True

          with self.assertRaises(koji.AuthError):

              kojihub.Host(id=None)

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_instantiation_not_logged_in(self, context):

          context.session.getHostId.return_value = None

          context.session.logged_in = False

          with self.assertRaises(koji.AuthError):

              kojihub.Host()

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_instantiation_logged_in_as_host(self, context):

          context.session.getHostId.return_value = 1234

          context.session.logged_in = True

          kojihub.Host(id=None)  # No exception

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_verify_not_samehost(self, context):

          context.session.getHostId.return_value = 1234

          context.session.logged_in = True
@@ -60,14 +60,14 @@ 

          with self.assertRaises(koji.AuthError):

              host.verify()

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_verify_not_exclusive(self, context):

          host = kojihub.Host(id=1234)

          with self.assertRaises(koji.AuthError):

              host.verify()

  

-     @mock.patch('kojihub.UpdateProcessor')

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.UpdateProcessor')

+     @mock.patch('kojihub.kojihub.context')

      def test_task_unwait(self, context, processor):

          host = kojihub.Host(id=1234)

          host.taskUnwait(parent=123)
@@ -85,8 +85,8 @@ 

          )

          self.assertEqual(processor.call_args_list[1], update2)

  

-     @mock.patch('kojihub.UpdateProcessor')

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.UpdateProcessor')

+     @mock.patch('kojihub.kojihub.context')

      def test_task_set_wait_all_tasks(self, context, processor):

          host = kojihub.Host(id=1234)

          host.taskSetWait(parent=123, tasks=None)
@@ -104,8 +104,8 @@ 

          )

          self.assertEqual(processor.call_args_list[1], update2)

  

-     @mock.patch('kojihub.UpdateProcessor')

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.UpdateProcessor')

+     @mock.patch('kojihub.kojihub.context')

      def test_task_set_wait_some_tasks(self, context, processor):

          host = kojihub.Host(id=1234)

          host.taskSetWait(parent=123, tasks=[234, 345])
@@ -139,7 +139,7 @@ 

          self.assertEqual(finished, [2, 3])

          self.assertEqual(unfinished, [1, 4])

  

-     @mock.patch('kojihub.context')

+     @mock.patch('kojihub.kojihub.context')

      def test_task_wait(self, context):

          self.query_execute.return_value = [{'id': 1, 'state': 1},

                                             {'id': 2, 'state': 2},

@@ -1,8 +1,8 @@ 

  import mock

  import unittest

  

- import kojixmlrpc

- from kojixmlrpc import Fault, HandlerRegistry, ModXMLRPCRequestHandler

+ from kojihub import kojixmlrpc

+ from kojihub.kojixmlrpc import Fault, HandlerRegistry, ModXMLRPCRequestHandler

  

  

  class DummyExports(object):

@@ -9,20 +9,20 @@ 

  

  class TestNewBuild(unittest.TestCase):

      def setUp(self):

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

-         self.get_external_repo_id = mock.patch('kojihub.get_external_repo_id').start()

-         self.nextval = mock.patch('kojihub.nextval').start()

-         self.Savepoint = mock.patch('kojihub.Savepoint').start()

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

+         self.get_external_repo_id = mock.patch('kojihub.kojihub.get_external_repo_id').start()

+         self.nextval = mock.patch('kojihub.kojihub.nextval').start()

+         self.Savepoint = mock.patch('kojihub.kojihub.Savepoint').start()

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

-         self.lookup_package = mock.patch('kojihub.lookup_package').start()

-         self.new_package = mock.patch('kojihub.new_package').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.recycle_build = mock.patch('kojihub.recycle_build').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.lookup_package = mock.patch('kojihub.kojihub.lookup_package').start()

+         self.new_package = mock.patch('kojihub.kojihub.new_package').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.recycle_build = mock.patch('kojihub.kojihub.recycle_build').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -10,11 +10,11 @@ 

  

  class TestNewMavenBuild(unittest.TestCase):

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

-         self.get_maven_build = mock.patch('kojihub.get_maven_build').start()

+         self.get_maven_build = mock.patch('kojihub.kojihub.get_maven_build').start()

          self.get_maven_build.return_value = None

          self.build_info = {

              'id': 100,

@@ -6,9 +6,9 @@ 

  

  class TestNewTypedBuild(unittest.TestCase):

  

-     @mock.patch('kojihub.lookup_name')

-     @mock.patch('kojihub.QueryProcessor')

-     @mock.patch('kojihub.InsertProcessor')

+     @mock.patch('kojihub.kojihub.lookup_name')

+     @mock.patch('kojihub.kojihub.QueryProcessor')

+     @mock.patch('kojihub.kojihub.InsertProcessor')

      def test_new_typed_build(self, InsertProcessor, QueryProcessor, lookup_name):

  

          binfo = {'id': 1, 'foo': '137'}

@@ -10,7 +10,7 @@ 

  

  class TestNewWinBuild(unittest.TestCase):

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

          self.insert_execute = mock.MagicMock()

@@ -9,8 +9,8 @@ 

  

  class TestPerm(unittest.TestCase):

  

-     @mock.patch('kojihub.context')

-     @mock.patch('kojihub.lookup_perm', return_value=None)

+     @mock.patch('kojihub.kojihub.context')

+     @mock.patch('kojihub.kojihub.lookup_perm', return_value=None)

      def test_has_perm(self, lookup_perm, context):

          rv = kojihub.RootExports().hasPerm('perm')

          self.assertEqual(rv, context.session.hasPerm.return_value)

file modified
+13 -13
@@ -22,25 +22,25 @@ 

  

  class TestPkglist(unittest.TestCase):

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.user_id = 112233

          self.context.session.user_data = {'name': 'username'}

          self.run_callbacks = mock.patch('koji.plugin.run_callbacks').start()

-         self.read_package_list = mock.patch('kojihub.readPackageList').start()

-         self.lookup_package = mock.patch('kojihub.lookup_package').start()

-         self._pkglist_add = mock.patch('kojihub._pkglist_add').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self._pkglist_remove = mock.patch('kojihub._pkglist_remove').start()

-         self.assert_policy = mock.patch('kojihub.assert_policy').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.read_package_list = mock.patch('kojihub.kojihub.readPackageList').start()

+         self.lookup_package = mock.patch('kojihub.kojihub.lookup_package').start()

+         self._pkglist_add = mock.patch('kojihub.kojihub._pkglist_add').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self._pkglist_remove = mock.patch('kojihub.kojihub._pkglist_remove').start()

+         self.assert_policy = mock.patch('kojihub.kojihub.assert_policy').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

  

      def tearDown(self):

          mock.patch.stopall()

  

-     @mock.patch('kojihub.pkglist_add')

+     @mock.patch('kojihub.kojihub.pkglist_add')

      def test_pkglist_block(self, pkglist_add):

          force = mock.MagicMock()

          self.get_tag.return_value = {'name': 'tag', 'id': 123}
@@ -53,7 +53,7 @@ 

          self.lookup_package.assert_called_once_with('pkg', strict=True)

          pkglist_add.assert_called_once_with('tag', 'pkg', block=True, force=force)

  

-     @mock.patch('kojihub.pkglist_add')

+     @mock.patch('kojihub.kojihub.pkglist_add')

      def test_pkglist_block_package_error(self, pkglist_add):

          pkg_name = 'pkg'

          tag_name = 'tag'
@@ -173,20 +173,20 @@ 

          self._pkglist_add.assert_not_called()

          self._pkglist_remove.assert_not_called()

  

-     @mock.patch('kojihub.pkglist_add')

+     @mock.patch('kojihub.kojihub.pkglist_add')

      def test_pkglist_setowner(self, pkglist_add):

          force = mock.MagicMock()

          kojihub.pkglist_setowner('tag', 'pkg', 'owner', force=force)

          pkglist_add.assert_called_once_with('tag', 'pkg', owner='owner', force=force, update=True)

  

-     @mock.patch('kojihub.pkglist_add')

+     @mock.patch('kojihub.kojihub.pkglist_add')

      def test_pkglist_setarches(self, pkglist_add):

          force = mock.MagicMock()

          kojihub.pkglist_setarches('tag', 'pkg', 'arches', force=force)

          pkglist_add.assert_called_once_with('tag', 'pkg', extra_arches='arches', force=force,

                                              update=True)

  

-     @mock.patch('kojihub._direct_pkglist_add')

+     @mock.patch('kojihub.kojihub._direct_pkglist_add')

      def test_pkglist_add(self, _direct_pkglist_add):

          # just transition of params + policy=True

          kojihub.pkglist_add('tag', 'pkg', owner='owner', block='block',

@@ -12,7 +12,7 @@ 

          self.assertFalse(obj.run({'operation': 'FOOBAR'}))

          self.assertTrue(obj.run({'operation': 'foobar'}))

  

-     @mock.patch('kojihub.policy_get_pkg')

+     @mock.patch('kojihub.kojihub.policy_get_pkg')

      def test_package_test(self, policy_get_pkg):

          obj = kojihub.PackageTest('package foo*')

          policy_get_pkg.return_value = {'name': 'mypackage'}
@@ -20,7 +20,7 @@ 

          policy_get_pkg.return_value = {'name': 'foobar'}

          self.assertTrue(obj.run({}))

  

-     @mock.patch('kojihub.policy_get_version')

+     @mock.patch('kojihub.kojihub.policy_get_version')

      def test_version_test(self, policy_get_version):

          obj = kojihub.VersionTest('version 1.2.*')

          policy_get_version.return_value = '0.0.1'
@@ -28,7 +28,7 @@ 

          policy_get_version.return_value = '1.2.1'

          self.assertTrue(obj.run({}))

  

-     @mock.patch('kojihub.policy_get_release')

+     @mock.patch('kojihub.kojihub.policy_get_release')

      def test_release_test(self, policy_get_release):

          obj = kojihub.ReleaseTest('release 1.2.*')

          policy_get_release.return_value = '0.0.1'
@@ -36,7 +36,7 @@ 

          policy_get_release.return_value = '1.2.1'

          self.assertTrue(obj.run({}))

  

-     @mock.patch('kojihub.policy_get_pkg')

+     @mock.patch('kojihub.kojihub.policy_get_pkg')

      def test_new_package_test(self, policy_get_pkg):

          obj = kojihub.NewPackageTest('is_new_package')

          policy_get_pkg.return_value = {'name': 'mypackage', 'id': 42}
@@ -45,7 +45,7 @@ 

          self.assertTrue(obj.run({}))

  

      def test_skip_tag_test(self):

-         obj = kojihub.SkipTagTest('skip_tag')

+         obj = kojihub.kojihub.SkipTagTest('skip_tag')

          data = {'skip_tag': True}

          self.assertTrue(obj.run(data))

          data = {'skip_tag': False}
@@ -59,8 +59,8 @@ 

  class TestPolicyGetUser(unittest.TestCase):

  

      def setUp(self):

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.context = mock.patch('kojihub.context').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -97,11 +97,11 @@ 

  class TestPolicyGetCGs(unittest.TestCase):

  

      def setUp(self):

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.list_rpms = mock.patch('kojihub.list_rpms').start()

-         self.list_archives = mock.patch('kojihub.list_archives').start()

-         self.get_buildroot = mock.patch('kojihub.get_buildroot').start()

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.list_rpms = mock.patch('kojihub.kojihub.list_rpms').start()

+         self.list_archives = mock.patch('kojihub.kojihub.list_archives').start()

+         self.get_buildroot = mock.patch('kojihub.kojihub.get_buildroot').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -116,12 +116,12 @@ 

      def _cgname(self, br_id):

          if br_id is None:

              return None

-         return 'cg for br %s'% br_id

+         return 'cg for br %s' % br_id

  

      def test_policy_get_cg_from_brs(self):

          self.get_build.return_value = {'id': 42}

-         br1 = [1,1,1,2,3,4,5,5]

-         br2 = [2,2,7,7,8,8,9,9,None]

+         br1 = [1, 1, 1, 2, 3, 4, 5, 5]

+         br2 = [2, 2, 7, 7, 8, 8, 9, 9, None]

          self.list_rpms.return_value = [{'buildroot_id': n} for n in br1]

          self.list_archives.return_value = [{'buildroot_id': n} for n in br2]

          self.get_buildroot.side_effect = self._fakebr
@@ -135,10 +135,10 @@ 

  

      def test_policy_get_cg_from_cgs(self):

          data = {

-                 'cg_list': [1,1,1,2,2,2,3,3,3],

-                 'build': 'whatever',

-                 'buildroots': [],

-                 }

+             'cg_list': [1, 1, 1, 2, 2, 2, 3, 3, 3],

+             'build': 'whatever',

+             'buildroots': [],

+         }

  

          def my_lookup_name(table, info, strict=False, create=False):

              self.assertEqual(strict, True)
@@ -162,11 +162,11 @@ 

  class TestBuildTagTest(unittest.TestCase):

  

      def setUp(self):

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.list_rpms = mock.patch('kojihub.list_rpms').start()

-         self.list_archives = mock.patch('kojihub.list_archives').start()

-         self.get_buildroot = mock.patch('kojihub.get_buildroot').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.list_rpms = mock.patch('kojihub.kojihub.list_rpms').start()

+         self.list_archives = mock.patch('kojihub.kojihub.list_archives').start()

+         self.get_buildroot = mock.patch('kojihub.kojihub.get_buildroot').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -255,7 +255,7 @@ 

  class TestHasTagTest(unittest.TestCase):

  

      def setUp(self):

-         self.list_tags = mock.patch('kojihub.list_tags').start()

+         self.list_tags = mock.patch('kojihub.kojihub.list_tags').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -276,8 +276,8 @@ 

  class TestBuildTagInheritsFromTest(unittest.TestCase):

  

      def setUp(self):

-         self.policy_get_build_tags = mock.patch('kojihub.policy_get_build_tags').start()

-         self.readFullInheritance = mock.patch('kojihub.readFullInheritance').start()

+         self.policy_get_build_tags = mock.patch('kojihub.kojihub.policy_get_build_tags').start()

+         self.readFullInheritance = mock.patch('kojihub.kojihub.readFullInheritance').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -333,8 +333,8 @@ 

  

  class TestBuildTypeTest(unittest.TestCase):

      def setUp(self):

-         self.get_build_type = mock.patch('kojihub.get_build_type').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.get_build_type = mock.patch('kojihub.kojihub.get_build_type').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -358,7 +358,7 @@ 

          self.get_build_type.assert_called_once_with(binfo)

  

      def test_prepopulated(self):

-         #self.get_build.return_value = {'id': 1, 'name': 'nvr-1-2'}

+         # self.get_build.return_value = {'id': 1, 'name': 'nvr-1-2'}

          self.get_build_type.return_value = {'rpm': None}

          obj = kojihub.BuildTypeTest('buildtype rpm')

          data = {'build': 123, 'btypes': set(['rpm'])}
@@ -368,9 +368,9 @@ 

  

  class TestImportedTest(unittest.TestCase):

      def setUp(self):

-         self.list_rpms = mock.patch('kojihub.list_rpms').start()

-         self.list_archives = mock.patch('kojihub.list_archives').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

+         self.list_rpms = mock.patch('kojihub.kojihub.list_rpms').start()

+         self.list_archives = mock.patch('kojihub.kojihub.list_archives').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

  

      def tearDown(self):

          mock.patch.stopall()

@@ -16,10 +16,10 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

          self.rinfo = {'arch': 'x86_64',

                        'build_id': 1,

                        'buildroot_id': None,

@@ -19,14 +19,14 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.exports = kojihub.RootExports()

-         self.readTaggedBuilds = mock.patch('kojihub.readTaggedBuilds').start()

+         self.readTaggedBuilds = mock.patch('kojihub.kojihub.readTaggedBuilds').start()

          self.tag_name = 'test-tag'

          self.columns = ['archiveinfo.id', 'archiveinfo.type_id', 'archiveinfo.btype_id',

                          'btype.name', 'archiveinfo.build_id', 'archiveinfo.buildroot_id',

@@ -19,15 +19,15 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.exports = kojihub.RootExports()

-         self.readPackageList = mock.patch('kojihub.readPackageList').start()

-         self.lookup_name = mock.patch('kojihub.lookup_name').start()

+         self.readPackageList = mock.patch('kojihub.kojihub.readPackageList').start()

+         self.lookup_name = mock.patch('kojihub.kojihub.lookup_name').start()

          self.tag_name = 'test-tag'

          self.columns = ['tag.id', 'tag.name', 'build.id', 'build.version', 'build.release',

                          'build.epoch', 'build.state', 'build.completion_time', 'build.start_time',

@@ -19,14 +19,14 @@ 

          return query

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.exports = kojihub.RootExports()

-         self.readTaggedBuilds = mock.patch('kojihub.readTaggedBuilds').start()

+         self.readTaggedBuilds = mock.patch('kojihub.kojihub.readTaggedBuilds').start()

          self.tag_name = 'test-tag'

          self.columns = ['rpminfo.name', 'rpminfo.version', 'rpminfo.release', 'rpminfo.arch',

                          'rpminfo.id', 'rpminfo.epoch', 'rpminfo.payloadhash', 'rpminfo.size',
@@ -56,7 +56,6 @@ 

              kojihub.readTaggedRPMS(self.tag_name, arch=1245)

          self.assertEqual(error_message, str(cm.exception))

  

- 

      def test_get_tagged_rpms_package_arch_list_without_extra(self):

          self.readTaggedBuilds.return_value = self.build_list

          kojihub.readTaggedRPMS(self.tag_name, package=self.pkg_name, arch=['x86_64', 'ppc'],

@@ -10,10 +10,10 @@ 

  

  class TestRecycleBuild(unittest.TestCase):

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor').start()

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor').start()

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

-         self._dml = mock.patch('kojihub._dml').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

          self.run_callbacks = mock.patch('koji.plugin.run_callbacks').start()

          self.rmtree = mock.patch('koji.util.rmtree').start()

          self.exists = mock.patch('os.path.exists').start()

@@ -16,10 +16,10 @@ 

          return update

  

      def setUp(self):

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"
@@ -29,9 +29,9 @@ 

          self.context_db.session.user_id = 23

          self.context.opts = {'HostPrincipalFormat': '-%s-'}

          self.exports = kojihub.RootExports()

-         self.list_channels = mock.patch('kojihub.list_channels').start()

-         self.get_channel_id = mock.patch('kojihub.get_channel_id').start()

-         self.get_host = mock.patch('kojihub.get_host').start()

+         self.list_channels = mock.patch('kojihub.kojihub.list_channels').start()

+         self.get_channel_id = mock.patch('kojihub.kojihub.get_channel_id').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

          self.hostname = 'hostname'

          self.hostinfo = {'id': 123, 'name': self.hostname}

          self.channel_id = 234

file modified
+5 -5
@@ -15,18 +15,18 @@ 

  class TestRepoFunctions(unittest.TestCase):

  

      def setUp(self):

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self._dml = mock.patch('kojihub._dml').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

          self.exports = kojihub.RootExports()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

          self.query_executeOne = mock.MagicMock()

  

      def tearDown(self):

@@ -10,9 +10,9 @@ 

  

      def setUp(self):

          self.exports = kojihub.RootExports()

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

  

      def test_options_is_none(self):

          self.make_task.return_value = 13

@@ -4,7 +4,7 @@ 

  import unittest

  

  import koji

- import kojihub

+ from kojihub import kojihub

  

  

  class TestRPMDiff(unittest.TestCase):
@@ -161,20 +161,20 @@ 

  

  

  class TestCheckNoarchRpms(unittest.TestCase):

-     @mock.patch('kojihub.rpmdiff')

+     @mock.patch('kojihub.kojihub.rpmdiff')

      def test_check_noarch_rpms_empty_invocation(self, rpmdiff):

          originals = ['foo', 'bar']

          result = kojihub.check_noarch_rpms('basepath', copy.copy(originals))

          self.assertEqual(result, originals)

  

-     @mock.patch('kojihub.rpmdiff')

+     @mock.patch('kojihub.kojihub.rpmdiff')

      def test_check_noarch_rpms_simple_invocation(self, rpmdiff):

          originals = ['12/1234/foo.noarch.rpm', '23/2345/foo.noarch.rpm']

          result = kojihub.check_noarch_rpms('basepath', copy.copy(originals))

          self.assertEqual(result, originals[0:1])

          self.assertEqual(len(rpmdiff.mock_calls), 1)

  

-     @mock.patch('kojihub.rpmdiff')

+     @mock.patch('kojihub.kojihub.rpmdiff')

      def test_check_noarch_rpms_with_duplicates(self, rpmdiff):

          originals = [

              'bar.noarch.rpm',
@@ -185,7 +185,7 @@ 

          self.assertEqual(result, ['bar.noarch.rpm'])

          rpmdiff.assert_called_once_with('basepath', originals, hashes={})

  

-     @mock.patch('kojihub.rpmdiff')

+     @mock.patch('kojihub.kojihub.rpmdiff')

      def test_check_noarch_rpms_with_mixed(self, rpmdiff):

          originals = [

              'foo.x86_64.rpm',

@@ -15,17 +15,17 @@ 

          return update

  

      def setUp(self):

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.assertPerm = mock.MagicMock()

          self.exports = kojihub.RootExports()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

          self.run_callbacks = mock.patch('koji.plugin.run_callbacks').start()

  

      def tearDown(self):

@@ -22,14 +22,15 @@ 

          return update

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

+         self.get_host = mock.patch('kojihub.kojihub.get_host').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context_db.session.assertLogin = mock.MagicMock()
@@ -41,16 +42,14 @@ 

  

      def test_enableHost_missing(self):

          # non-existing hostname

-         kojihub.get_host = mock.MagicMock()

-         kojihub.get_host.return_value = {}

+         self.get_host.return_value = {}

          with self.assertRaises(koji.GenericError):

              self.exports.enableHost('hostname')

          self.assertEqual(self.updates, [])

          self.assertEqual(self.inserts, [])

-         kojihub.get_host.assert_called_once_with('hostname')

+         self.get_host.assert_called_once_with('hostname')

  

      def test_enableHost_valid(self):

-         kojihub.get_host = mock.MagicMock()

          hostinfo = {

              'id': 123,

              'user_id': 234,
@@ -61,16 +60,16 @@ 

              'comment': 'comment',

              'enabled': False,

          }

-         kojihub.get_host.return_value = hostinfo

+         self.get_host.return_value = hostinfo

          self.context_db.event_id = 42

          self.context_db.session.user_id = 23

  

          self.exports.enableHost('hostname')

  

-         kojihub.get_host.assert_called_once_with('hostname')

+         self.get_host.assert_called_once_with('hostname')

          # revoke

          self.assertEqual(len(self.updates), 1)

-         values = kojihub.get_host.return_value

+         values = self.get_host.return_value

          clauses = ['host_id = %(id)i', 'active = TRUE']

          revoke_data = {

              'revoke_event': 42,
@@ -102,7 +101,6 @@ 

          self.assertEqual(len(self.inserts), 1)

  

      def test_disableHost_valid(self):

-         kojihub.get_host = mock.MagicMock()

          hostinfo = {

              'id': 123,

              'user_id': 234,
@@ -113,16 +111,16 @@ 

              'comment': 'comment',

              'enabled': True,

          }

-         kojihub.get_host.return_value = hostinfo

+         self.get_host.return_value = hostinfo

          self.context_db.event_id = 42

          self.context_db.session.user_id = 23

  

          self.exports.disableHost('hostname')

  

-         kojihub.get_host.assert_called_once_with('hostname')

+         self.get_host.assert_called_once_with('hostname')

          # revoke

          self.assertEqual(len(self.updates), 1)

-         values = kojihub.get_host.return_value

+         values = self.get_host.return_value

          clauses = ['host_id = %(id)i', 'active = TRUE']

          revoke_data = {

              'revoke_event': 42,

@@ -11,7 +11,7 @@ 

  class TestShowOpts(unittest.TestCase):

      def setUp(self):

          self.maxDiff = None

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.exports = kojihub.RootExports()

          self.context.opts = {'MaxNameLengthInternal': 15,

@@ -6,19 +6,19 @@ 

  

  class TestSnapshotTag(unittest.TestCase):

      def setUp(self):

-         self._create_tag = mock.patch('kojihub._create_tag').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self._direct_tag_build = mock.patch('kojihub._direct_tag_build').start()

-         self._direct_pkglist_add = mock.patch('kojihub._direct_pkglist_add').start()

-         self._delete_event_id = mock.patch('kojihub._delete_event_id').start()

-         self._grplist_add = mock.patch('kojihub._grplist_add').start()

-         self._grp_pkg_add = mock.patch('kojihub._grp_pkg_add').start()

-         self._grp_req_add = mock.patch('kojihub._grp_req_add').start()

-         self.readTagGroups = mock.patch('kojihub.readTagGroups').start()

-         self.readTaggedBuilds = mock.patch('kojihub.readTaggedBuilds').start()

-         self.context = mock.patch('kojihub.context').start()

+         self._create_tag = mock.patch('kojihub.kojihub._create_tag').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self._direct_tag_build = mock.patch('kojihub.kojihub._direct_tag_build').start()

+         self._direct_pkglist_add = mock.patch('kojihub.kojihub._direct_pkglist_add').start()

+         self._delete_event_id = mock.patch('kojihub.kojihub._delete_event_id').start()

+         self._grplist_add = mock.patch('kojihub.kojihub._grplist_add').start()

+         self._grp_pkg_add = mock.patch('kojihub.kojihub._grp_pkg_add').start()

+         self._grp_req_add = mock.patch('kojihub.kojihub._grp_req_add').start()

+         self.readTagGroups = mock.patch('kojihub.kojihub.readTagGroups').start()

+         self.readTaggedBuilds = mock.patch('kojihub.kojihub.readTaggedBuilds').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.hub = kojihub.RootExports()

          self.hub.listPackages = mock.MagicMock()

@@ -6,27 +6,27 @@ 

  

  class TestSnapshotTagModify(unittest.TestCase):

      def setUp(self):

-         self._create_tag = mock.patch('kojihub._create_tag').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self._direct_tag_build = mock.patch('kojihub._direct_tag_build').start()

-         self._direct_untag_build = mock.patch('kojihub._direct_untag_build').start()

-         self._tag_build = mock.patch('kojihub._tag_build').start()

-         self._untag_build = mock.patch('kojihub._untag_build').start()

-         self._direct_pkglist_add = mock.patch('kojihub._direct_pkglist_add').start()

-         self._delete_event_id = mock.patch('kojihub._delete_event_id').start()

-         self._grplist_add = mock.patch('kojihub._grplist_add').start()

-         self._grplist_remove = mock.patch('kojihub._grplist_remove').start()

-         self._grp_pkg_add = mock.patch('kojihub._grp_pkg_add').start()

-         self._grp_pkg_remove = mock.patch('kojihub._grp_pkg_remove').start()

-         self._grp_req_add = mock.patch('kojihub._grp_req_add').start()

-         self._grp_req_remove = mock.patch('kojihub._grp_req_remove').start()

-         self.readTagGroups = mock.patch('kojihub.readTagGroups').start()

-         self.readTaggedBuilds = mock.patch('kojihub.readTaggedBuilds').start()

-         self.context = mock.patch('kojihub.context').start()

+         self._create_tag = mock.patch('kojihub.kojihub._create_tag').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self._direct_tag_build = mock.patch('kojihub.kojihub._direct_tag_build').start()

+         self._direct_untag_build = mock.patch('kojihub.kojihub._direct_untag_build').start()

+         self._tag_build = mock.patch('kojihub.kojihub._tag_build').start()

+         self._untag_build = mock.patch('kojihub.kojihub._untag_build').start()

+         self._direct_pkglist_add = mock.patch('kojihub.kojihub._direct_pkglist_add').start()

+         self._delete_event_id = mock.patch('kojihub.kojihub._delete_event_id').start()

+         self._grplist_add = mock.patch('kojihub.kojihub._grplist_add').start()

+         self._grplist_remove = mock.patch('kojihub.kojihub._grplist_remove').start()

+         self._grp_pkg_add = mock.patch('kojihub.kojihub._grp_pkg_add').start()

+         self._grp_pkg_remove = mock.patch('kojihub.kojihub._grp_pkg_remove').start()

+         self._grp_req_add = mock.patch('kojihub.kojihub._grp_req_add').start()

+         self._grp_req_remove = mock.patch('kojihub.kojihub._grp_req_remove').start()

+         self.readTagGroups = mock.patch('kojihub.kojihub.readTagGroups').start()

+         self.readTaggedBuilds = mock.patch('kojihub.kojihub.readTaggedBuilds').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

-         self.edit_tag = mock.patch('kojihub.edit_tag').start()

+         self.edit_tag = mock.patch('kojihub.kojihub.edit_tag').start()

          self.hub = kojihub.RootExports()

          self.hub.listPackages = mock.MagicMock()

          self.hub.massTag = mock.MagicMock()

@@ -32,24 +32,24 @@ 

          return query

  

      def setUp(self):

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

          self.query_executeOne = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self._dml = mock.patch('kojihub._dml').start()

-         self.get_tag = mock.patch('kojihub.get_tag').start()

-         self.get_build = mock.patch('kojihub.get_build').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.get_tag_id = mock.patch('kojihub.get_tag_id').start()

-         self.check_tag_access = mock.patch('kojihub.check_tag_access').start()

-         self.writeInheritanceData = mock.patch('kojihub.writeInheritanceData').start()

-         self.context = mock.patch('kojihub.context').start()

+         self._dml = mock.patch('kojihub.kojihub._dml').start()

+         self.get_tag = mock.patch('kojihub.kojihub.get_tag').start()

+         self.get_build = mock.patch('kojihub.kojihub.get_build').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()

+         self.check_tag_access = mock.patch('kojihub.kojihub.check_tag_access').start()

+         self.writeInheritanceData = mock.patch('kojihub.kojihub.writeInheritanceData').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"
@@ -218,7 +218,7 @@ 

  

      def setUp(self):

          self.query_executeOne = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

          self.tagname = 'test-tag'

@@ -12,17 +12,17 @@ 

  class TestTaskWaitResults(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.host_id = 99

          self.context.session.getHostId.return_value = self.host_id

          self.host_exports = kojihub.Host(self.host_id)

          self.host_exports.taskUnwait = mock.MagicMock()

-         self.Task = mock.patch('kojihub.Task', side_effect=self.getTask).start()

+         self.Task = mock.patch('kojihub.kojihub.Task', side_effect=self.getTask).start()

          self.tasks = {}

          self.queries = []

          self.execute = mock.MagicMock()

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

-             side_effect=self.get_query).start()

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

+                                          side_effect=self.get_query).start()

  

      def tearDown(self):

          mock.patch.stopall()
@@ -43,7 +43,7 @@ 

  

      def test_basic(self):

          parent = 1

-         task_ids = [5,6,7]

+         task_ids = [5, 6, 7]

          for t in task_ids:

              task = self.getTask(t)

              task.getResult.return_value = "OK"
@@ -57,7 +57,7 @@ 

      def test_error(self):

          """Ensure that errors is propagated when they should be"""

          parent = 1

-         task_ids = [5,6,7]

+         task_ids = [5, 6, 7]

          for t in task_ids:

              task = self.getTask(t)

              task.getResult.return_value = "OK"
@@ -75,7 +75,7 @@ 

      def test_canfail_canceled(self):

          """Canceled canfail tasks should not raise exceptions"""

          parent = 1

-         task_ids = [5,6,7]

+         task_ids = [5, 6, 7]

          canfail = [7]

          for t in task_ids:

              task = self.getTask(t)
@@ -83,8 +83,7 @@ 

              task.isCanceled.return_value = False

          self.tasks[7].getResult.side_effect = koji.GenericError('canceled')

          self.tasks[7].isCanceled.return_value = True

-         results = self.host_exports.taskWaitResults(parent, task_ids,

-                         canfail=canfail)

+         results = self.host_exports.taskWaitResults(parent, task_ids, canfail=canfail)

          expect_f = {'faultCode': koji.GenericError.faultCode,

                      'faultString': 'canceled'}

          expect = [[5, "OK"], [6, "OK"], [7, expect_f]]
@@ -95,7 +94,7 @@ 

      def test_all_tasks(self):

          """Canceled canfail tasks should not raise exceptions"""

          parent = 1

-         task_ids = [5,6,7]

+         task_ids = [5, 6, 7]

          self.execute.return_value = [[t] for t in task_ids]

          for t in task_ids:

              task = self.getTask(t)

@@ -29,24 +29,24 @@ 

          return update

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.opts = {

              'EmailDomain': 'test.domain.com',

              'NotifyOnSuccess': True,

          }

  

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

-         self.get_build_notifications = mock.patch('kojihub.get_build_notifications').start()

-         self.get_tag_id = mock.patch('kojihub.get_tag_id').start()

-         self.get_package_id = mock.patch('kojihub.get_package_id').start()

+         self.get_build_notifications = mock.patch('kojihub.kojihub.get_build_notifications').start()

+         self.get_tag_id = mock.patch('kojihub.kojihub.get_tag_id').start()

+         self.get_package_id = mock.patch('kojihub.kojihub.get_package_id').start()

  

          self.exports = kojihub.RootExports()

          self.exports.getLoggedInUser = mock.MagicMock()

@@ -31,22 +31,22 @@ 

          return update

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context_db = mock.patch('koji.db.context').start()

-         self.get_user = mock.patch('kojihub.get_user').start()

-         self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()

+         self.get_user = mock.patch('kojihub.kojihub.get_user').start()

+         self.verify_name_internal = mock.patch('kojihub.kojihub.verify_name_internal').start()

          # It seems MagicMock will not automatically handle attributes that

          # start with "assert"

          self.context.session.assertPerm = mock.MagicMock()

          self.context_db.session.assertLogin = mock.MagicMock()

  

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                                           side_effect=self.getQuery).start()

          self.queries = []

-         self.InsertProcessor = mock.patch('kojihub.InsertProcessor',

+         self.InsertProcessor = mock.patch('kojihub.kojihub.InsertProcessor',

                                            side_effect=self.getInsert).start()

          self.inserts = []

-         self.UpdateProcessor = mock.patch('kojihub.UpdateProcessor',

+         self.UpdateProcessor = mock.patch('kojihub.kojihub.UpdateProcessor',

                                            side_effect=self.getUpdate).start()

          self.updates = []

  
@@ -176,7 +176,7 @@ 

          self.assertEqual(i.data['group_id'], gid)

          self.assertEqual(i.data['user_id'], uid)

  

-     @mock.patch('kojihub.get_group_members')

+     @mock.patch('kojihub.kojihub.get_group_members')

      def test_drop_group_member(self, get_group_members):

          group, gid = 'test_group', 1

          user, uid = 'username', 2

@@ -10,7 +10,7 @@ 

  class TestVerifyNameInternal(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.context.opts = {'MaxNameLengthInternal': 15,

                               'RegexNameInternal.compiled': re.compile('^[A-Za-z0-9/_.+-]+$')}
@@ -38,7 +38,7 @@ 

  

  class TestVerifyUser(unittest.TestCase):

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.context.session.assertPerm = mock.MagicMock()

          self.context.opts = {'MaxNameLengthInternal': 15,

                               'RegexUserName.compiled': re.compile('^[A-Za-z0-9/_.@-]+$')}

@@ -7,14 +7,14 @@ 

  class TestWinBuild(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

-         self.assert_policy = mock.patch('kojihub.assert_policy').start()

-         self.get_build_target = mock.patch('kojihub.get_build_target').start()

-         self.make_task = mock.patch('kojihub.make_task').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

+         self.assert_policy = mock.patch('kojihub.kojihub.assert_policy').start()

+         self.get_build_target = mock.patch('kojihub.kojihub.get_build_target').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

          self.vm = 'test-vm'

          self.url = 'https://test-url.com'

          self.target = 'test-target'

@@ -7,14 +7,14 @@ 

  class TestWrapperRPM(unittest.TestCase):

  

      def setUp(self):

-         self.context = mock.patch('kojihub.context').start()

+         self.context = mock.patch('kojihub.kojihub.context').start()

          self.exports = kojihub.RootExports()

          self.context.session.assertLogin = mock.MagicMock()

          self.context.session.hasPerm = mock.MagicMock()

-         self.get_channel = mock.patch('kojihub.get_channel').start()

+         self.get_channel = mock.patch('kojihub.kojihub.get_channel').start()

          self.exports.getBuild = mock.MagicMock()

-         self.make_task = mock.patch('kojihub.make_task').start()

-         self.list_rpms = mock.patch('kojihub.list_rpms').start()

+         self.make_task = mock.patch('kojihub.kojihub.make_task').start()

+         self.list_rpms = mock.patch('kojihub.kojihub.list_rpms').start()

          self.exports.getTag = mock.MagicMock()

          self.exports.getBuildTarget = mock.MagicMock()

          self.exports.getRepo = mock.MagicMock()

@@ -10,7 +10,7 @@ 

      # Show long diffs in error output...

      maxDiff = None

  

-     @mock.patch('kojihub._generate_maven_metadata')

+     @mock.patch('kojihub.kojihub._generate_maven_metadata')

      def test_write_maven_repo_metadata(self, gendata_mock):

          destdir = '/tmp'

          artifacts = set()
@@ -26,7 +26,7 @@ 

          artifacts.add(('0', '1', '1.3.11'))

  

          now = datetime.datetime.now()

-         with mock.patch('kojihub.open', create=True) as openf_mock:

+         with mock.patch('kojihub.kojihub.open', create=True) as openf_mock:

              with mock.patch('datetime.datetime') as datetime_mock:

                  datetime_mock.now.return_value = now

                  _write_maven_repo_metadata(destdir, artifacts)

@@ -7,7 +7,7 @@ 

  

  class TestWriteSignedRPM(unittest.TestCase):

      def setUp(self):

-         self.get_rpm = mock.patch('kojihub.get_rpm').start()

+         self.get_rpm = mock.patch('kojihub.kojihub.get_rpm').start()

  

      def tearDown(self):

          mock.patch.stopall()

file modified
+1 -1
@@ -12,7 +12,7 @@ 

          mock.patch.stopall()

          self.qp_execute_return_value = []

          self.qp_execute_side_effect = None

-         self.QueryProcessor = mock.patch('kojihub.QueryProcessor',

+         self.QueryProcessor = mock.patch('kojihub.kojihub.QueryProcessor',

                  side_effect=self.get_query).start()

          self.queries = []

  

file modified
+2 -2
@@ -34,7 +34,7 @@ 

  [testenv:py3]

  setenv = 

      {[testenv]setenv}

-     PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib

+     PYTHONPATH=kojihub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib

  commands_pre =

      {[testenv]commands_pre}

      {envbindir}/coverage3 erase --rcfile .coveragerc3
@@ -85,7 +85,7 @@ 

      bandit

  commands =

      bandit -ll -s B108,B608 -r \

-         builder cli hub koji plugins util vm www \

+         builder cli kojihub koji plugins util vm www \

          builder/kojid \

          cli/koji \

          util/koji-gc util/kojira util/koji-shadow util/koji-sweep-db \

Related: https://pagure.io/koji/issue/3587

Backward-compatible - it is not nice that we have koji, koji_cli and kojihub modules. But leaving it this way doesn't need any change to plugins, etc which contain import kojihub.

(need double check with proper selinux installation, tested just in podman)

I've also left symlink to /usr/share/kojihub. Mainly for not changing httpd.conf with every python update.

rebased onto ece7bc6e317d754f38d131b792088f8503ea8b6f

a year ago

I always imagined we'd keep a stub loader in /usr/share/koji-hub. E.g. something like from kojihub.kojixmlrpc import application.

+1 for not changing httpd.conf for every python version :smile:

If we rename hub/ → kojihub/ then PYTHONPATH=$CHECKOUT_DIR would make that import work as expected.

it is not nice that we have koji, koji_cli and kojihub modules

I kind of like having some separation indicating that these are not part of the core library, but yeah.

Could always adjust and leave compat wrappers

rebased onto cfa898a23dd8e5b4956be6dbe6621d7b83150fef

a year ago

Addressed comments. One more slight incompatilibity in regard to plugins. As kojihub.__init__.py contains from .kojihub import *, private functions are not imported into that namespace. So, sidetag_hub.py is calling from kojihub.kojihub import. I'm not sure if it is good enough. On one hand I like separation of private methods to submodule, on the other hand some plugins can stop work.

We could always add some explicit imports of those private functions for backwards compatibility. We have internal plugins that rely on some of them as well. Granted, it's an easy enough change to make and plugins have a different expectation of compatibility across versions.

devtools/fakehub2 also needs the path fix

1 new commit added

  • import private functions
a year ago

Added private functions to kojihub/__init__.py. Do you've some problems with fakehub? It works for me with current path.

Do you've some problems with fakehub?

Oh, haha. Apparently fakehub2 is only in my checkout. The fakehub script works fine. Sorry for the confusion.

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

a year ago

1 new commit added

  • block py2 building for hub/web/util
a year ago

4 new commits added

  • block py2 building for hub/web/util
  • import private functions
  • further changes
  • Move hub code to site-packages
a year ago

@mikem One more question - placeholder /usr/share/koji-hub/kojiapp.py means updating httpd.conf. Not sure if it is better to use confusing kojixmlrpc.py placeholder name or to force admins to update their configurations.

kojiapp is certainly a better name, but I'm not sure that kojixmlrpc is that confusing. We could always put a comment in the file explaining that the name is for backward compat.

I guess if we wanted to get fancy, we could have both, but issue a deprecation warning when loading the old one. Not sure if it's worth the effort.

The other issue is namespace collision, in two ways. Currently, kojiapp.py and kojixmlrpc.py are in the same directory in the the checkout, so a simple rename would collide them. Also, I'm not entirely sure that we couldn't have a situation where plugin code had import kojixmlrpc and got the wrong one. Granted, I'm not sure any plugins do that.

Actually, regardless of the name, it seems wrong for kojiapp.py to be in the same dir of the checkout as the rest, since it is not part of the lib. It would probably be better to clearly separate the lib from the app here. Perhaps move kojiapp.py (or whatever we call it), httpd.conf, and hub.conf elsewhere? E.g. hub-app, kojihub/app?

rebased onto ddb9e3acb38aa31453901b0ae06e83ee24693c91

a year ago

Moved to kojihub/app and leaving kojiapp.py without duplicate kojixmlrpc.py

Metadata Update from @tkopecek:
- Pull-request tagged with: scheduler

a year ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

a year ago

rebased onto 95912eb

a year ago

Commit 463e469 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago
Changes Summary 157
+8 -1
file changed
Makefile
+1 -1
file changed
devtools/fakehub
-0
file removed
hub/__init__.py
+3 -4
file changed
koji.spec
+15 -11
file renamed
hub/Makefile
kojihub/Makefile
+48
file added
kojihub/__init__.py
+1 -1
file renamed
hub/httpd.conf
kojihub/app/httpd.conf
+0 -0
file renamed
hub/hub.conf
kojihub/app/hub.conf
+1
file added
kojihub/app/kojiapp.py
+1 -0
file renamed
hub/kojihub.py
kojihub/kojihub.py
+1 -9
file renamed
hub/kojixmlrpc.py
kojihub/kojixmlrpc.py
+1 -4
file changed
plugins/hub/runroot_hub.py
+1 -4
file changed
plugins/hub/save_failed_tree.py
+1 -3
file changed
plugins/hub/sidetag_hub.py
+8 -7
file changed
tests/test_hub/test_add_archivetype.py
+4 -4
file changed
tests/test_hub/test_add_btype.py
+5 -5
file changed
tests/test_hub/test_add_channel.py
+3 -3
file changed
tests/test_hub/test_add_external_repo_to_tag.py
+5 -5
file changed
tests/test_hub/test_add_external_rpm.py
+1 -1
file changed
tests/test_hub/test_add_group_member.py
+11 -11
file changed
tests/test_hub/test_add_host.py
+7 -7
file changed
tests/test_hub/test_add_host_to_channel.py
+6 -6
file changed
tests/test_hub/test_add_rpm_sig.py
+3 -3
file changed
tests/test_hub/test_add_user_krb_principal.py
+2 -2
file changed
tests/test_hub/test_add_volume.py
+10 -10
file changed
tests/test_hub/test_apply_query_opts.py
+3 -3
file changed
tests/test_hub/test_build.py
+2 -2
file changed
tests/test_hub/test_build_image.py
+1 -1
file changed
tests/test_hub/test_build_image_indirection.py
+1 -1
file changed
tests/test_hub/test_build_image_oz.py
+16 -15
file changed
tests/test_hub/test_cg_importer.py
+3 -3
file changed
tests/test_hub/test_chain_build.py
+3 -3
file changed
tests/test_hub/test_chain_maven.py
+3 -3
file changed
tests/test_hub/test_check_volume_policy.py
+15 -15
file changed
tests/test_hub/test_complete_image_build.py
+13 -13
file changed
tests/test_hub/test_complete_maven_build.py
+4 -4
file changed
tests/test_hub/test_create_build_target.py
+3 -3
file changed
tests/test_hub/test_create_external_repo.py
+2 -2
file changed
tests/test_hub/test_create_image_build.py
+3 -3
file changed
tests/test_hub/test_create_maven_build.py
+7 -7
file changed
tests/test_hub/test_create_notification.py
+7 -7
file changed
tests/test_hub/test_create_notification_block.py
+8 -8
file changed
tests/test_hub/test_create_tag.py
+4 -4
file changed
tests/test_hub/test_create_user.py
+3 -3
file changed
tests/test_hub/test_create_win_build.py
+14 -14
file changed
tests/test_hub/test_delete_build.py
+1 -1
file changed
tests/test_hub/test_delete_build_target.py
+2 -2
file changed
tests/test_hub/test_delete_notification.py
+3 -3
file changed
tests/test_hub/test_delete_notification_block.py
+5 -5
file changed
tests/test_hub/test_delete_rpm_sig.py
+3 -3
file changed
tests/test_hub/test_delete_tag.py
+2 -2
file changed
tests/test_hub/test_disable_channel.py
+1 -1
file changed
tests/test_hub/test_disable_user.py
+11 -11
file changed
tests/test_hub/test_dist_repo.py
+4 -4
file changed
tests/test_hub/test_edit_build_target.py
+7 -7
file changed
tests/test_hub/test_edit_channel.py
+3 -3
file changed
tests/test_hub/test_edit_external_repo.py
+17 -19
file changed
tests/test_hub/test_edit_host.py
+3 -3
file changed
tests/test_hub/test_edit_permission.py
+7 -7
file changed
tests/test_hub/test_edit_tag.py
+6 -6
file changed
tests/test_hub/test_edit_tag_external_repo.py
+5 -5
file changed
tests/test_hub/test_edit_user.py
+2 -2
file changed
tests/test_hub/test_enable_channel.py
+1 -1
file changed
tests/test_hub/test_enable_user.py
+3 -3
file changed
tests/test_hub/test_ensure_volume_symlink.py
+1 -1
file changed
tests/test_hub/test_find_build_id.py
+6 -6
file changed
tests/test_hub/test_getRPM.py
+6 -6
file changed
tests/test_hub/test_getRPMDeps.py
+6 -6
file changed
tests/test_hub/test_getRPMFile.py
+1 -1
file changed
tests/test_hub/test_get_active_repos.py
+4 -4
file changed
tests/test_hub/test_get_archive.py
+3 -3
file changed
tests/test_hub/test_get_archive_file.py
+1 -1
file changed
tests/test_hub/test_get_build.py
+6 -6
file changed
tests/test_hub/test_get_build_config.py
+36 -36
file changed
tests/test_hub/test_get_build_logs.py
+1 -1
file changed
tests/test_hub/test_get_build_notification.py
+1 -1
file changed
tests/test_hub/test_get_build_notification_block.py
+2 -2
file changed
tests/test_hub/test_get_build_notification_blocks.py
+2 -2
file changed
tests/test_hub/test_get_build_notifications.py
+1 -1
file changed
tests/test_hub/test_get_build_target.py
+4 -4
file changed
tests/test_hub/test_get_build_targets.py
+5 -5
file changed
tests/test_hub/test_get_build_type.py
+1 -1
file changed
tests/test_hub/test_get_buildroot.py
+2 -2
file changed
tests/test_hub/test_get_changelog_entries.py
+2 -2
file changed
tests/test_hub/test_get_channel.py
+1 -1
file changed
tests/test_hub/test_get_external_repo.py
+3 -1
file changed
tests/test_hub/test_get_group_members.py
+2 -2
file changed
tests/test_hub/test_get_host.py
+1 -1
file changed
tests/test_hub/test_get_last_host_update.py
+3 -3
file changed
tests/test_hub/test_get_next_build.py
+3 -3
file changed
tests/test_hub/test_get_next_release.py
+6 -6
file changed
tests/test_hub/test_get_notification_recipients.py
+3 -3
file changed
tests/test_hub/test_get_session_info.py
+4 -4
file changed
tests/test_hub/test_get_tag_external_repos.py
+3 -2
file changed
tests/test_hub/test_get_task_children.py
+3 -3
file changed
tests/test_hub/test_get_upload_path.py
+3 -3
file changed
tests/test_hub/test_get_user.py
+1 -1
file changed
tests/test_hub/test_get_user_perms.py
+1 -1
file changed
tests/test_hub/test_get_volume.py
+6 -6
file changed
tests/test_hub/test_grant_permissions.py
+10 -10
file changed
tests/test_hub/test_group_operations.py
+1 -1
file changed
tests/test_hub/test_import_archive.py
+10 -10
file changed
tests/test_hub/test_import_build.py
+6 -5
file changed
tests/test_hub/test_import_image_internal.py
+6 -6
file changed
tests/test_hub/test_import_rpm.py
+8 -8
file changed
tests/test_hub/test_list_archive_files.py
+7 -7
file changed
tests/test_hub/test_list_archives.py
+1 -1
file changed
tests/test_hub/test_list_btypes.py
+4 -4
file changed
tests/test_hub/test_list_builds.py
+3 -3
file changed
tests/test_hub/test_list_channels.py
+9 -9
file changed
tests/test_hub/test_list_hosts.py
+1 -1
file changed
tests/test_hub/test_list_packages_simple.py
+4 -4
file changed
tests/test_hub/test_list_rpms.py
+4 -4
file changed
tests/test_hub/test_list_tagged.py
+4 -4
file changed
tests/test_hub/test_list_tagged_archives.py
+4 -4
file changed
tests/test_hub/test_list_tagged_rpms.py
+5 -5
file changed
tests/test_hub/test_list_tags.py
+2 -2
file changed
tests/test_hub/test_list_task_output.py
+7 -7
file changed
tests/test_hub/test_list_tasks.py
+2 -2
file changed
tests/test_hub/test_list_user_krb_principals.py
+4 -4
file changed
tests/test_hub/test_lookup_name.py
+8 -8
file changed
tests/test_hub/test_massTag.py
+3 -3
file changed
tests/test_hub/test_maven_build.py
+14 -14
file changed
tests/test_hub/test_models/test_host.py
+2 -2
file changed
tests/test_hub/test_multicall.py
+11 -11
file changed
tests/test_hub/test_new_build.py
+2 -2
file changed
tests/test_hub/test_new_maven_build.py
+3 -3
file changed
tests/test_hub/test_new_typed_build.py
+1 -1
file changed
tests/test_hub/test_new_win_build.py
+2 -2
file changed
tests/test_hub/test_perm_operations.py
+13 -13
file changed
tests/test_hub/test_pkglist.py
+33 -33
file changed
tests/test_hub/test_policy_tests.py
+2 -2
file changed
tests/test_hub/test_query_rpm_sigs.py
+3 -3
file changed
tests/test_hub/test_read_tagged_archives.py
+4 -4
file changed
tests/test_hub/test_read_tagged_builds.py
+3 -4
file changed
tests/test_hub/test_read_tagged_rpms.py
+3 -3
file changed
tests/test_hub/test_recycle_build.py
+5 -5
file changed
tests/test_hub/test_remove_host_from_channel.py
+5 -5
file changed
tests/test_hub/test_repos.py
+2 -2
file changed
tests/test_hub/test_restart_hosts.py
+5 -5
file changed
tests/test_hub/test_rpmdiff.py
+4 -4
file changed
tests/test_hub/test_set_build_owner.py
+12 -14
file changed
tests/test_hub/test_set_host_enabled.py
+1 -1
file changed
tests/test_hub/test_show_opts.py
+13 -13
file changed
tests/test_hub/test_snapshotTag.py
+20 -20
file changed
tests/test_hub/test_snapshotTagModify.py
+12 -12
file changed
tests/test_hub/test_tag_operations.py
+9 -10
file changed
tests/test_hub/test_task_wait_results.py
+7 -7
file changed
tests/test_hub/test_update_notification.py
+7 -7
file changed
tests/test_hub/test_user_groups.py
+2 -2
file changed
tests/test_hub/test_verify_names.py
+5 -5
file changed
tests/test_hub/test_win_build.py
+4 -4
file changed
tests/test_hub/test_wrapper_rpm.py
+2 -2
file changed
tests/test_hub/test_write_maven_repo_metadata.py
+1 -1
file changed
tests/test_hub/test_write_signed_rpm.py
+1 -1
file changed
tests/test_hub/utils.py
+2 -2
file changed
tox.ini