You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/08/08 15:34:49 UTC

[30/50] git commit: [#3154] ticket:407 added pagination and location header tests for ForgeBlog API

[#3154]  ticket:407 added pagination and location header tests for ForgeBlog API


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

Branch: refs/heads/tv/6458
Commit: 93d12e6989d08658dad218d7bab0ec51fb675192
Parents: e23020d
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Jul 29 16:03:35 2013 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 31 21:00:25 2013 +0000

----------------------------------------------------------------------
 ForgeBlog/forgeblog/tests/functional/test_rest.py | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/93d12e69/ForgeBlog/forgeblog/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_rest.py b/ForgeBlog/forgeblog/tests/functional/test_rest.py
index 0ab05c2..f545c7e 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_rest.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_rest.py
@@ -16,6 +16,7 @@
 #       KIND, either express or implied.  See the License for the
 #       specific language governing permissions and limitations
 #       under the License.
+from datetime import date
 
 from nose.tools import assert_equal
 from allura.lib import helpers as h
@@ -43,6 +44,7 @@ class TestBlogApi(TestRestApiBase):
             'labels': 'label1, label2'
         }
         r = self.api_post('/rest/p/test/blog/', **data)
+        assert_equal(r.location, 'http://localhost:80/rest/p/test/blog/%s/%s/test/' % (date.today().strftime("%Y"), date.today().strftime("%m")))
         assert_equal(r.status_int, 201)
         url = '/rest' + BM.BlogPost.query.find().first().url()
         r = self.api_get('/rest/p/test/blog/')
@@ -56,6 +58,8 @@ class TestBlogApi(TestRestApiBase):
         assert_equal(r.json['state'], data['state'])
         assert_equal(r.json['labels'], data['labels'].split(','))
 
+
+
     def test_update_post(self):
         data = {
             'title': 'test',
@@ -175,12 +179,14 @@ class TestBlogApi(TestRestApiBase):
         self.api_post('/rest/p/test/blog/', title='test3', text='test text3', state='published')
         r = self.api_get('/rest/p/test/blog/', limit='1', page='0')
         assert_equal(r.json['posts'][0]['title'], 'test3')
+        assert_equal(len(r.json['posts']), 1)
         assert_equal(r.json['count'], 3)
         assert_equal(r.json['limit'], 1)
         assert_equal(r.json['page'], 0)
         r = self.api_get('/rest/p/test/blog/', limit='2', page='0')
         assert_equal(r.json['posts'][0]['title'], 'test3')
         assert_equal(r.json['posts'][1]['title'], 'test2')
+        assert_equal(len(r.json['posts']), 2)
         assert_equal(r.json['count'], 3)
         assert_equal(r.json['limit'], 2)
         assert_equal(r.json['page'], 0)