mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
xmlrpc tests: add a test for user plugin with non-existing idp
Add new tests checking the error returned for ipa user-add ... --idp nonexistingidp ipa user-mod ... --idp nonexistingidp ipa stageuser-add ... --idp nonexistingidp ipa stageuser-mod ... --idp nonexistingidp The expected error message is: ipa: ERROR: External IdP configuration nonexistingidp not found Related: https://pagure.io/freeipa/issue/9416 Signed-off-by: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
f57a7dbf50
commit
7517e2ce21
@@ -39,6 +39,8 @@ gid = u'456'
|
||||
invalidrealm1 = u'suser1@NOTFOUND.ORG'
|
||||
invalidrealm2 = u'suser1@BAD@NOTFOUND.ORG'
|
||||
|
||||
nonexistentidp = 'IdPDoesNotExist'
|
||||
|
||||
invaliduser1 = u'+tuser1'
|
||||
invaliduser2 = u'tuser1234567890123456789012345678901234567890'
|
||||
invaliduser3 = u'1234'
|
||||
@@ -431,6 +433,15 @@ class TestCreateInvalidAttributes(XMLRPC_test):
|
||||
invalidrealm2))):
|
||||
command()
|
||||
|
||||
def test_create_invalid_idp(self, stageduser):
|
||||
stageduser.ensure_missing()
|
||||
command = stageduser.make_create_command(
|
||||
options={u'ipaidpconfiglink': nonexistentidp})
|
||||
with raises_exact(errors.NotFound(
|
||||
reason="External IdP configuration {} not found".format(
|
||||
nonexistentidp))):
|
||||
command()
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class TestUpdateInvalidAttributes(XMLRPC_test):
|
||||
@@ -466,6 +477,15 @@ class TestUpdateInvalidAttributes(XMLRPC_test):
|
||||
message=u'invalid \'gidnumber\': must be at least 1')):
|
||||
command()
|
||||
|
||||
def test_update_invalididp(self, stageduser):
|
||||
stageduser.ensure_exists()
|
||||
command = stageduser.make_update_command(
|
||||
updates={u'ipaidpconfiglink': nonexistentidp})
|
||||
with raises_exact(errors.NotFound(
|
||||
reason="External IdP configuration {} not found".format(
|
||||
nonexistentidp))):
|
||||
command()
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class TestActive(XMLRPC_test):
|
||||
|
||||
@@ -86,6 +86,8 @@ expired_expiration_string = "1991-12-07T19:54:13Z"
|
||||
# Date in ISO format (2013-12-10T12:00:00)
|
||||
isodate_re = re.compile(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$')
|
||||
|
||||
nonexistentidp = 'IdPDoesNotExist'
|
||||
|
||||
|
||||
@pytest.fixture(scope='class')
|
||||
def user_min(request, xmlrpc_setup):
|
||||
@@ -543,6 +545,18 @@ class TestUpdate(XMLRPC_test):
|
||||
command()
|
||||
user.delete()
|
||||
|
||||
def test_update_invalid_idp(self, user):
|
||||
""" Test user-mod --idp with a non-existent idp """
|
||||
user.ensure_exists()
|
||||
command = user.make_update_command(
|
||||
updates=dict(ipaidpconfiglink=nonexistentidp)
|
||||
)
|
||||
with raises_exact(errors.NotFound(
|
||||
reason="External IdP configuration {} not found".format(
|
||||
nonexistentidp)
|
||||
)):
|
||||
command()
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class TestCreate(XMLRPC_test):
|
||||
@@ -771,6 +785,17 @@ class TestCreate(XMLRPC_test):
|
||||
user_radius.check_create(result)
|
||||
user_radius.delete()
|
||||
|
||||
def test_create_with_invalididp(self):
|
||||
testuser = UserTracker(
|
||||
name='idpuser', givenname='idp', sn='user',
|
||||
ipaidpconfiglink=nonexistentidp
|
||||
)
|
||||
with raises_exact(errors.NotFound(
|
||||
reason="External IdP configuration {} not found".format(
|
||||
nonexistentidp)
|
||||
)):
|
||||
testuser.create()
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class TestUserWithGroup(XMLRPC_test):
|
||||
|
||||
Reference in New Issue
Block a user