Imported Debian patch 4.8.10-2
This commit is contained in:
committed by
Mario Fetka
parent
8bc559c5a1
commit
358acdd85f
@@ -4,23 +4,24 @@ from __future__ import print_function
|
||||
import ipaserver.install.adtrust as adtr
|
||||
from ipaserver.install.adtrust import set_and_check_netbios_name
|
||||
from collections import namedtuple
|
||||
from unittest import TestCase
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
from unittest import mock
|
||||
from io import StringIO
|
||||
|
||||
import pytest
|
||||
|
||||
class ApiMockup(object):
|
||||
|
||||
class ApiMockup:
|
||||
Backend = namedtuple('Backend', 'ldap2')
|
||||
Calls = namedtuple('Callbacks', 'retrieve_netbios_name')
|
||||
env = namedtuple('Environment', 'domain')
|
||||
|
||||
|
||||
class TestNetbiosName(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
class TestNetbiosName:
|
||||
api = None
|
||||
|
||||
@pytest.fixture(autouse=True, scope="class")
|
||||
def netbiosname_setup(self, request):
|
||||
cls = request.cls
|
||||
api = ApiMockup()
|
||||
ldap2 = namedtuple('LDAP', 'isconnected')
|
||||
ldap2.isconnected = mock.MagicMock(return_value=True)
|
||||
@@ -29,9 +30,9 @@ class TestNetbiosName(TestCase):
|
||||
adtr.retrieve_netbios_name = mock.MagicMock(return_value=None)
|
||||
cls.api = api
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
adtr.retrieve_netbios_name = cls.api.Calls.retrieve_netbios_name
|
||||
def fin():
|
||||
adtr.retrieve_netbios_name = cls.api.Calls.retrieve_netbios_name
|
||||
request.addfinalizer(fin)
|
||||
|
||||
def test_NetbiosName(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user