xref: /freebsd/crypto/krb5/src/tests/t_stringattr.py (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert# Copyright (C) 2011 by the Massachusetts Institute of Technology.
2*7f2fe78bSCy Schubert# All rights reserved.
3*7f2fe78bSCy Schubert
4*7f2fe78bSCy Schubert# Export of this software from the United States of America may
5*7f2fe78bSCy Schubert#   require a specific license from the United States Government.
6*7f2fe78bSCy Schubert#   It is the responsibility of any person or organization contemplating
7*7f2fe78bSCy Schubert#   export to obtain such a license before exporting.
8*7f2fe78bSCy Schubert#
9*7f2fe78bSCy Schubert# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
10*7f2fe78bSCy Schubert# distribute this software and its documentation for any purpose and
11*7f2fe78bSCy Schubert# without fee is hereby granted, provided that the above copyright
12*7f2fe78bSCy Schubert# notice appear in all copies and that both that copyright notice and
13*7f2fe78bSCy Schubert# this permission notice appear in supporting documentation, and that
14*7f2fe78bSCy Schubert# the name of M.I.T. not be used in advertising or publicity pertaining
15*7f2fe78bSCy Schubert# to distribution of the software without specific, written prior
16*7f2fe78bSCy Schubert# permission.  Furthermore if you modify this software you must label
17*7f2fe78bSCy Schubert# your software as modified software and not distribute it in such a
18*7f2fe78bSCy Schubert# fashion that it might be confused with the original M.I.T. software.
19*7f2fe78bSCy Schubert# M.I.T. makes no representations about the suitability of
20*7f2fe78bSCy Schubert# this software for any purpose.  It is provided "as is" without express
21*7f2fe78bSCy Schubert# or implied warranty.
22*7f2fe78bSCy Schubert
23*7f2fe78bSCy Schubertfrom k5test import *
24*7f2fe78bSCy Schubert
25*7f2fe78bSCy Schubertrealm = K5Realm(start_kadmind=True, create_host=False, get_creds=False)
26*7f2fe78bSCy Schubert
27*7f2fe78bSCy Schubertrealm.prep_kadmin()
28*7f2fe78bSCy Schubert
29*7f2fe78bSCy Schubertrealm.run_kadmin(['getstrs', 'user'], expected_msg='(No string attributes.)')
30*7f2fe78bSCy Schubert
31*7f2fe78bSCy Schubertrealm.run_kadmin(['setstr', 'user', 'attr1', 'value1'])
32*7f2fe78bSCy Schubertrealm.run_kadmin(['setstr', 'user', 'attr2', 'value2'])
33*7f2fe78bSCy Schubertrealm.run_kadmin(['delstr', 'user', 'attr1'])
34*7f2fe78bSCy Schubertrealm.run_kadmin(['setstr', 'user', 'attr3', 'value3'])
35*7f2fe78bSCy Schubert
36*7f2fe78bSCy Schubertout = realm.run_kadmin(['getstrs', 'user'])
37*7f2fe78bSCy Schubertif ('attr2: value2' not in out or 'attr3: value3' not in out or
38*7f2fe78bSCy Schubert    'attr1:' in out):
39*7f2fe78bSCy Schubert    fail('Final attribute query')
40*7f2fe78bSCy Schubert
41*7f2fe78bSCy Schubertsuccess('KDB string attributes')
42