{"action":"created","comment":{"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments/33901028","id":33901028,"diff_hunk":"@@ -0,0 +1,107 @@\n+from django.test import TestCase, Client, SimpleTestCase\n+from rest_framework import status\n+from rest_framework.authtoken.models import Token\n+from nose.tools import assert_equals\n+from api.models import User, Page, Procedure\n+from utils.decorators import add_group_permissions\n+import json\n+\n+\n+class PageTest(TestCase):\n+\n+    def setUp(self):\n+        self.client = Client()\n+        self.user = User.objects.create_user(\n+                    'admin',\n+                    'test@email.com',\n+                    'password'\n+                )\n+        self.procedure = Procedure.objects.create(\n+                    author='tester',\n+                    title='test procedure',\n+                    owner=self.user\n+                )\n+        self.page1 = Page.objects.create(\n+                    display_index=0,\n+                    procedure=self.procedure\n+                )\n+        self.page2 = Page.objects.create(\n+                    display_index=1,\n+                    procedure=self.procedure\n+                )\n+        self.page3 = Page.objects.create(\n+                    display_index=2,\n+                    procedure=self.procedure\n+                )\n+\n+    @add_group_permissions\n+    def test_page_reorder_back(self):\n+        data = [","path":"src-backend/api/tests/test_pages.py","position":39,"original_position":39,"commit_id":"f89afdc3ad667e828b376bf8e7b8b8c0f6691574","original_commit_id":"f89afdc3ad667e828b376bf8e7b8b8c0f6691574","user":{"login":"Ommy","id":978947,"avatar_url":"https://avatars.githubusercontent.com/u/978947?v=3","gravatar_id":"","url":"https://api.github.com/users/Ommy","html_url":"https://github.com/Ommy","followers_url":"https://api.github.com/users/Ommy/followers","following_url":"https://api.github.com/users/Ommy/following{/other_user}","gists_url":"https://api.github.com/users/Ommy/gists{/gist_id}","starred_url":"https://api.github.com/users/Ommy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ommy/subscriptions","organizations_url":"https://api.github.com/users/Ommy/orgs","repos_url":"https://api.github.com/users/Ommy/repos","events_url":"https://api.github.com/users/Ommy/events{/privacy}","received_events_url":"https://api.github.com/users/Ommy/received_events","type":"User","site_admin":false},"body":"Different indices, not sure if we really need to do that. I tried using a json serializer, but it only worked on objects returned by `Page.objects.find(...)` so it had to be data already stored in the database. Modifying that would be a lot uglier and more work than simply defining the data as this","created_at":"2015-07-06T00:41:42Z","updated_at":"2015-07-06T00:41:42Z","html_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/165#discussion_r33901028","pull_request_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165","_links":{"self":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments/33901028"},"html":{"href":"https://github.com/SanaMobile/sana.protocol_builder/pull/165#discussion_r33901028"},"pull_request":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165"}}},"pull_request":{"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165","id":39229305,"html_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/165","diff_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/165.diff","patch_url":"https://github.com/SanaMobile/sana.protocol_builder/pull/165.patch","issue_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/165","number":165,"state":"open","locked":false,"title":"Added in backend support to reorder pages","user":{"login":"Ommy","id":978947,"avatar_url":"https://avatars.githubusercontent.com/u/978947?v=3","gravatar_id":"","url":"https://api.github.com/users/Ommy","html_url":"https://github.com/Ommy","followers_url":"https://api.github.com/users/Ommy/followers","following_url":"https://api.github.com/users/Ommy/following{/other_user}","gists_url":"https://api.github.com/users/Ommy/gists{/gist_id}","starred_url":"https://api.github.com/users/Ommy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ommy/subscriptions","organizations_url":"https://api.github.com/users/Ommy/orgs","repos_url":"https://api.github.com/users/Ommy/repos","events_url":"https://api.github.com/users/Ommy/events{/privacy}","received_events_url":"https://api.github.com/users/Ommy/received_events","type":"User","site_admin":false},"body":"Reorder page functionality now in the backend, by calling `/api/pages/partial_bulk_update` with a JSON array of all the pages in the procedure with their new values. The method returns all the new data. \r\n\r\nAlso added in a decorator called `initialize_once` that we can use for tests that calls the `run_once` method that initializes the group permissions for users. In the future this `run_once` will probably have more things going on. ","created_at":"2015-07-06T00:10:15Z","updated_at":"2015-07-06T00:41:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae42cba96b649602b05e1347cd7f5f8b0c714960","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165/commits","review_comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165/comments","review_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/165/comments","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/f89afdc3ad667e828b376bf8e7b8b8c0f6691574","head":{"label":"SanaMobile:fasih/fix_index_pages","ref":"fasih/fix_index_pages","sha":"f89afdc3ad667e828b376bf8e7b8b8c0f6691574","user":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"repo":{"id":25015456,"name":"sana.protocol_builder","full_name":"SanaMobile/sana.protocol_builder","owner":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SanaMobile/sana.protocol_builder","description":"Web app for building Sana Protocols","fork":false,"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder","forks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/forks","keys_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/teams","hooks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/hooks","issue_events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/events{/number}","events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/events","assignees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/assignees{/user}","branches_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/branches{/branch}","tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/tags","blobs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/{sha}","languages_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/languages","stargazers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/stargazers","contributors_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contributors","subscribers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscribers","subscription_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscription","commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contents/{+path}","compare_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/merges","archive_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/downloads","issues_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues{/number}","pulls_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls{/number}","milestones_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/milestones{/number}","notifications_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/labels{/name}","releases_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/releases{/id}","created_at":"2014-10-10T01:24:58Z","updated_at":"2015-06-23T18:17:42Z","pushed_at":"2015-07-06T00:10:15Z","git_url":"git://github.com/SanaMobile/sana.protocol_builder.git","ssh_url":"git@github.com:SanaMobile/sana.protocol_builder.git","clone_url":"https://github.com/SanaMobile/sana.protocol_builder.git","svn_url":"https://github.com/SanaMobile/sana.protocol_builder","homepage":"","size":7149,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":3,"default_branch":"master"}},"base":{"label":"SanaMobile:master","ref":"master","sha":"a12575e451edfa06fb983bc4792d66b5ce985e66","user":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"repo":{"id":25015456,"name":"sana.protocol_builder","full_name":"SanaMobile/sana.protocol_builder","owner":{"login":"SanaMobile","id":6865473,"avatar_url":"https://avatars.githubusercontent.com/u/6865473?v=3","gravatar_id":"","url":"https://api.github.com/users/SanaMobile","html_url":"https://github.com/SanaMobile","followers_url":"https://api.github.com/users/SanaMobile/followers","following_url":"https://api.github.com/users/SanaMobile/following{/other_user}","gists_url":"https://api.github.com/users/SanaMobile/gists{/gist_id}","starred_url":"https://api.github.com/users/SanaMobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanaMobile/subscriptions","organizations_url":"https://api.github.com/users/SanaMobile/orgs","repos_url":"https://api.github.com/users/SanaMobile/repos","events_url":"https://api.github.com/users/SanaMobile/events{/privacy}","received_events_url":"https://api.github.com/users/SanaMobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SanaMobile/sana.protocol_builder","description":"Web app for building Sana Protocols","fork":false,"url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder","forks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/forks","keys_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/teams","hooks_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/hooks","issue_events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/events{/number}","events_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/events","assignees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/assignees{/user}","branches_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/branches{/branch}","tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/tags","blobs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/{sha}","languages_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/languages","stargazers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/stargazers","contributors_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contributors","subscribers_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscribers","subscription_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/subscription","commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/contents/{+path}","compare_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/merges","archive_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/downloads","issues_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues{/number}","pulls_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls{/number}","milestones_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/milestones{/number}","notifications_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/labels{/name}","releases_url":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/releases{/id}","created_at":"2014-10-10T01:24:58Z","updated_at":"2015-06-23T18:17:42Z","pushed_at":"2015-07-06T00:10:15Z","git_url":"git://github.com/SanaMobile/sana.protocol_builder.git","ssh_url":"git@github.com:SanaMobile/sana.protocol_builder.git","clone_url":"https://github.com/SanaMobile/sana.protocol_builder.git","svn_url":"https://github.com/SanaMobile/sana.protocol_builder","homepage":"","size":7149,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":24,"forks":0,"open_issues":24,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165"},"html":{"href":"https://github.com/SanaMobile/sana.protocol_builder/pull/165"},"issue":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/165"},"comments":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/issues/165/comments"},"review_comments":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165/comments"},"review_comment":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/pulls/165/commits"},"statuses":{"href":"https://api.github.com/repos/SanaMobile/sana.protocol_builder/statuses/f89afdc3ad667e828b376bf8e7b8b8c0f6691574"}}}}