doc webdav: use credentials at tests
bzr revid: p_christ@hol.gr-20101103112534-ig2s9ijq0qlrw4ug
This commit is contained in:
parent
97a1f09deb
commit
23103d89cf
|
@ -8,5 +8,6 @@
|
|||
reload(te) # reload..
|
||||
dc = te.DAVClient()
|
||||
dc.gd_options()
|
||||
dc.get_creds(self, cr, uid)
|
||||
dc.gd_options(path=cr.dbname, expect={'DAV': ['1',]})
|
||||
-
|
||||
|
|
|
@ -346,6 +346,22 @@ class DAVClient(object):
|
|||
self.passwd = passwd
|
||||
self.dbg = dbg
|
||||
|
||||
def get_creds(self, obj, cr, uid):
|
||||
"""Read back the user credentials from cr, uid
|
||||
|
||||
@param obj is any orm object, in order to use its pool
|
||||
@param uid is the numeric id, which we will try to reverse resolve
|
||||
|
||||
note: this is a hackish way to get the credentials. It is expected
|
||||
to break if "base_crypt" is used.
|
||||
"""
|
||||
ruob = obj.pool.get('res.users')
|
||||
res = ruob.read(cr, 1, [uid,], ['login', 'password'])
|
||||
assert res, "uid %s not found" % uid
|
||||
self.user = res[0]['login']
|
||||
self.passwd = res[0]['password']
|
||||
return True
|
||||
|
||||
def _http_request(self, path, method='GET', hdrs=None, body=None):
|
||||
if not hdrs:
|
||||
hdrs = {}
|
||||
|
@ -422,8 +438,6 @@ class DAVClient(object):
|
|||
if hval.strip() != v.strip():
|
||||
raise AssertionError("HTTP header \"%s: %s\"" % (k, hval))
|
||||
|
||||
|
||||
|
||||
def gd_options(self, path='*', expect=None):
|
||||
""" Test the http options functionality
|
||||
If a dictionary is defined in expect, those options are
|
||||
|
|
Loading…
Reference in New Issue