unify relative imports
This commit is contained in:
parent
b0e91e378c
commit
7ceffe391c
6 changed files with 17 additions and 21 deletions
|
|
@ -33,7 +33,7 @@ import koji
|
|||
from koji.context import context
|
||||
from koji.util import to_list
|
||||
|
||||
from kojihub.db import DeleteProcessor, InsertProcessor, QueryProcessor, UpdateProcessor, nextval
|
||||
from .db import DeleteProcessor, InsertProcessor, QueryProcessor, UpdateProcessor, nextval
|
||||
|
||||
|
||||
# 1 - load session if provided
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ from koji.context import context
|
|||
# import xmlrpclib functions from koji to use tweaked Marshaller
|
||||
from koji.server import ServerError, BadRequest, RequestTimeout
|
||||
from koji.xmlrpcplus import ExtendedMarshaller, Fault, dumps, getparser
|
||||
from kojihub import auth
|
||||
from kojihub import db
|
||||
from . import auth
|
||||
from . import db
|
||||
|
||||
|
||||
class Marshaller(ExtendedMarshaller):
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class TestCheckVolumePolicy(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
mock.patch.stopall()
|
||||
|
||||
@mock.patch('kojixmlrpc.kojihub', new=kojihub, create=True)
|
||||
@mock.patch('kojihub.kojixmlrpc.kojihub', new=kojihub, create=True)
|
||||
def load_policy(self, policy):
|
||||
'''policy is the policy dict with text values'''
|
||||
plugin = FakePlugin()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import unittest
|
||||
|
||||
import kojixmlrpc
|
||||
from kojihub import kojixmlrpc
|
||||
|
||||
|
||||
class TestHandler(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class TestAuthSession(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.context = mock.patch('kojihub.auth.context').start()
|
||||
kojihub.db.context = self.context
|
||||
kojihub.auth.context = self.context
|
||||
self.UpdateProcessor = mock.patch('kojihub.auth.UpdateProcessor',
|
||||
side_effect=self.getUpdate).start()
|
||||
self.updates = []
|
||||
|
|
@ -217,11 +218,10 @@ class TestAuthSession(unittest.TestCase):
|
|||
with self.assertRaises(AttributeError):
|
||||
s.non_existing_attribute
|
||||
|
||||
@mock.patch('auth.context')
|
||||
def test_str(self, context):
|
||||
def test_str(self):
|
||||
"""auth.Session string representation"""
|
||||
s, cntext = self.get_session()
|
||||
context.cnx = cntext.cnx
|
||||
self.context.cnx = cntext.cnx
|
||||
|
||||
s.logged_in = False
|
||||
s.message = 'msg'
|
||||
|
|
@ -276,9 +276,8 @@ class TestAuthSession(unittest.TestCase):
|
|||
self.context.environ = {'REMOTE_ADDR': '127.0.0.1'}
|
||||
self.assertEqual(s.get_remote_ip(), 'ip')
|
||||
|
||||
@mock.patch('auth.context')
|
||||
def test_login(self, context):
|
||||
s, cntext = self.get_session()
|
||||
def test_login(self):
|
||||
s, _ = self.get_session()
|
||||
|
||||
# already logged in
|
||||
with self.assertRaises(koji.GenericError):
|
||||
|
|
@ -412,9 +411,8 @@ class TestAuthSession(unittest.TestCase):
|
|||
s.logout()
|
||||
self.assertEqual(cm.exception.args[0], 'Not logged in')
|
||||
|
||||
@mock.patch('auth.context')
|
||||
def test_logout_logged(self, context):
|
||||
s, cntext = self.get_session()
|
||||
def test_logout_logged(self):
|
||||
s, _ = self.get_session()
|
||||
s.logged_in = True
|
||||
s.logout()
|
||||
|
||||
|
|
@ -438,9 +436,8 @@ class TestAuthSession(unittest.TestCase):
|
|||
s.logoutChild(111)
|
||||
self.assertEqual(cm.exception.args[0], 'Not logged in')
|
||||
|
||||
@mock.patch('auth.context')
|
||||
def test_logoutChild_logged(self, context):
|
||||
s, cntext = self.get_session()
|
||||
def test_logoutChild_logged(self):
|
||||
s, _ = self.get_session()
|
||||
s.logged_in = True
|
||||
s.logoutChild(111)
|
||||
|
||||
|
|
@ -485,9 +482,8 @@ class TestAuthSession(unittest.TestCase):
|
|||
self.assertEqual(len(self.queries), 5)
|
||||
self.assertEqual(len(self.updates), 2)
|
||||
|
||||
@mock.patch('auth.context')
|
||||
def test_makeExclusive(self, context):
|
||||
s, cntext = self.get_session()
|
||||
def test_makeExclusive(self):
|
||||
s, _ = self.get_session()
|
||||
s.master = None
|
||||
s.exclusive = False
|
||||
self.query_singleValue.return_value = 123
|
||||
|
|
|
|||
2
tox.ini
2
tox.ini
|
|
@ -34,7 +34,7 @@ commands_pre =
|
|||
[testenv:py3]
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
PYTHONPATH=kojihub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib
|
||||
PYTHONPATH=.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib
|
||||
commands_pre =
|
||||
{[testenv]commands_pre}
|
||||
{envbindir}/coverage3 erase --rcfile .coveragerc3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue