allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/2] git commit: [#6692] fix api_post tests
Date Fri, 01 Nov 2013 14:24:33 GMT
[#6692] fix api_post tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5adec29a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5adec29a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5adec29a

Branch: refs/heads/master
Commit: 5adec29a77c6233f62823b2d5c698a271ac0a305
Parents: d002a11
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri Nov 1 03:35:53 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Nov 1 03:36:17 2013 +0000

----------------------------------------------------------------------
 AlluraTest/alluratest/controller.py             |  6 ++++
 .../forgetracker/tests/functional/test_rest.py  | 30 +++++++++++---------
 2 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5adec29a/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 9f104e5..43cdf75 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -166,6 +166,12 @@ class TestRestApiBase(TestController):
 
     def _api_getpost(self, method, path, api_key=None, api_timestamp=None, api_signature=None,
                  wrap_args=None, user='test-admin', status=None, **params):
+        '''
+        If you need to use one of the method kwargs as a URL parameter,
+        pass params={...} as a dict instead of **kwargs
+        '''
+        if 'params' in params:
+            params = params['params']
         if wrap_args:
             params = {wrap_args: params}
         if status is None:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5adec29a/ForgeTracker/forgetracker/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_rest.py b/ForgeTracker/forgetracker/tests/functional/test_rest.py
index 87e2d44..aad1401 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_rest.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_rest.py
@@ -44,12 +44,14 @@ class TestTrackerApiBase(TestRestApiBase):
         return self.api_post(
             '/rest/p/test/bugs/new',
             wrap_args='ticket_form',
-            summary='test new ticket',
-            status=self.tracker_globals.open_status_names.split()[0],
-            labels='',
-            description='',
-            assigned_to='',
-            **{'custom_fields._milestone':''})
+            params=dict(
+                summary='test new ticket',
+                status=self.tracker_globals.open_status_names.split()[0],
+                labels='',
+                description='',
+                assigned_to='',
+                **{'custom_fields._milestone':''})
+            )
 
 
 class TestRestNewTicket(TestTrackerApiBase):
@@ -59,12 +61,14 @@ class TestRestNewTicket(TestTrackerApiBase):
         ticket_view = self.api_post(
             '/rest/p/test/bugs/new',
             wrap_args='ticket_form',
-            summary=summary,
-            status=self.tracker_globals.open_status_names.split()[0],
-            labels='foo,bar',
-            description='descr',
-            assigned_to='',
-            **{'custom_fields._milestone':''})
+            params=dict(
+                summary=summary,
+                status=self.tracker_globals.open_status_names.split()[0],
+                labels='foo,bar',
+                description='descr',
+                assigned_to='',
+                **{'custom_fields._milestone':''}
+            ))
         json = ticket_view.json['ticket']
         assert json['status'] == 'open', json
         assert json['summary'] == 'test new ticket', json
@@ -90,7 +94,7 @@ class TestRestUpdateTicket(TestTrackerApiBase):
                 'reported_by', 'reported_by_id', '_id', 'votes_up', 'votes_down'):
             del args[bad_key]
         args['private'] = str(args['private'])
-        ticket_view = self.api_post('/rest/p/test/bugs/1/save', wrap_args='ticket_form',
**h.encode_keys(args))
+        ticket_view = self.api_post('/rest/p/test/bugs/1/save', wrap_args='ticket_form',
params=h.encode_keys(args))
         assert ticket_view.status_int == 200, ticket_view.showbrowser()
         json = ticket_view.json['ticket']
         assert int(json['ticket_num']) == 1


Mime
View raw message