add bp:rest-clients-return-obj
this is a small blueprint on a change to the way rest clients would work for discussion. It is also a first attempt at using the qa-specs repository. Change-Id: Ica57ec7790f28c670986c4fec2b000de4f9472c9
This commit is contained in:
parent
c3b03c325d
commit
a290798bef
|
@ -0,0 +1,33 @@
|
|||
Rest Clients should return single value
|
||||
=======================================
|
||||
|
||||
Problem
|
||||
-------
|
||||
The current tempest code assumes rest clients are returning a tuple
|
||||
which is the same as returned by httplib2. This leads to a lot of
|
||||
zeroing out one or the other value because we don't use it in tests.
|
||||
|
||||
::
|
||||
tempest(master)> grep -r ' _[, ]' tempest | wc -l
|
||||
267
|
||||
|
||||
About 90% of those are real uses here.
|
||||
|
||||
Proposed Solution
|
||||
-----------------
|
||||
Create a single object return from our rest clients. Embed the
|
||||
httplib2.Response as the ``resp`` attribute of this new response
|
||||
object.
|
||||
|
||||
Map __getattr__ to make a call into the dictionary for that object, so
|
||||
that we'd have code that looks like follows::
|
||||
|
||||
resp = self.client.assign_user_role_on_project(
|
||||
self.project['id'], self.user_body['id'], self.role['id'])
|
||||
self.assertEqual(resp.status, '204')
|
||||
|
||||
Instead of the existing::
|
||||
|
||||
resp, _ = self.client.assign_user_role_on_project(
|
||||
self.project['id'], self.user_body['id'], self.role['id'])
|
||||
self.assertEqual(resp['status'], '204')
|
Loading…
Reference in New Issue