~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/ivle-makeuser

ivle.webapp.testing: Add, with fake request and user.
ivle.webapp.base.test: Add! Test the JSONRESTView, using the new mocks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import os
32
32
import getopt
33
33
 
34
 
if os.getuid() != 0:
35
 
    print "Must run %s as root." % os.path.basename(sys.argv[0])
36
 
    sys.exit(1)
37
 
 
38
34
from ivle.database import get_store, User
39
35
from ivle.pulldown_subj import enrol_user
40
36
 
41
37
# Requireds and optionals will be used to display the usage message
42
38
# AND do argument processing
43
39
# The names here must correspond to the fields in the database.
44
 
requireds = ["login", "fullname"]
 
40
requireds = ["login", "fullname", "rolenm"]
45
41
optionals = [
46
42
    ('p', 'password', "Cleartext password for this user"),
47
43
    ('n', 'nick', "Display name (defaults to <fullname>)"),
59
55
        print t + (' ' * max(28 - len(t), 2)) + desc
60
56
    sys.exit(1)
61
57
 
 
58
if os.getuid() != 0:
 
59
    print "Must run %s as root." % os.path.basename(sys.argv[0])
 
60
    sys.exit(1)
 
61
 
62
62
shorts = ''.join([o[0] + ":" for o in optionals])
63
63
longs = [o[1] + "=" for o in optionals]
64
64
opts, args = getopt.gnu_getopt(sys.argv[1:], shorts, longs)