Univention Bugzilla – Attachment 5834 Details for
Bug 34369
Test case for changing the password on login via UMC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
sample code
umc-test-change-password.py (text/plain), 2.14 KB, created by
Alexander Kläser
on 2014-03-19 11:24:32 CET
(
hide
)
Description:
sample code
Filename:
MIME Type:
Creator:
Alexander Kläser
Created:
2014-03-19 11:24:32 CET
Size:
2.14 KB
patch
obsolete
>import univention.testing.strings as uts >import univention.testing.ucr as ucr_test >import univention.testing.ucsschool as utu >from univention.lib.umc_connection import UMCConnection >import univention.testing.ucr as ucr_test >import sys, os, time > >def auth(host, username, password): > newpassword = uts.random_string() > connection = UMCConnection(host) > try: > data = connection.build_data({'username' : username, 'password' : password}) > co = connection.get_connection() > co.request('POST', '/umcp/auth', data) > response = co.getresponse() > print "---------------------------------------------------------------------\n\n" > print 'response: %s ' % response.status > if response.status == 415: > print 'new password: ', newpassword > cookie = response.getheader('set-cookie') > #TODO: -> cookie == None > print 'cookie: ', cookie > data = connection.build_data({ > 'username' : username, > 'password' : password, > 'new_password' : newpassword > }) > co = connection.get_connection() > co.request('POST', '/umcp/auth', data, headers={ > 'Cookie': cookie > }) > response = co.getresponse() > #TODO: -> 411 > print 'response: %r ' % dir(response) > print 'response: %r ' % response.read() > if response.status == 200: > returnvalue = 0 > else: > returnValue = 1 > else: > returnValue = 0 > except Exception as e: > print "Auth exception: '%s' '%s' '%r'" % (str(e), type(e), e) > returnValue = 1 > > print "\n\n---------------------------------------------------------------------" > return returnValue
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 34369
:
5834
|
5835