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