{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/32745525","id":32745525,"diff_hunk":"@@ -605,6 +610,85 @@ def test_partial_update_private_project_logged_in_non_contributor(self):\n         res = self.app.patch_json(self.private_url, {'title': self.new_title}, auth=self.basic_auth_two, expect_errors=True)\n         assert_equal(res.status_code, 403)\n \n+\n+class TestNodeDelete(ApiTestCase):\n+\n+    def setUp(self):\n+        ApiTestCase.setUp(self)\n+        self.user = UserFactory.build()\n+        self.user.set_password('password')\n+        self.user.save()\n+        self.basic_auth = (self.user.username, 'password')\n+\n+        self.project = ProjectFactory(creator=self.user, is_public=False)\n+        self.private_url = '/{}nodes/{}/'.format(API_BASE, self.project._id)\n+\n+        self.user_two = UserFactory.build()\n+        self.user_two.set_password('password')\n+        self.user_two.save()\n+        self.basic_auth_two = (self.user_two.username, 'password')\n+\n+        self.public_project = ProjectFactory(is_public=True, creator=self.user)\n+        self.public_url = '/{}nodes/{}/'.format(API_BASE, self.public_project._id)\n+\n+        self.fake_url = '/{}nodes/{}/'.format(API_BASE, '12345')\n+\n+    def test_deletes_public_node_logged_out(self):\n+        res = self.app.delete(self.public_url, expect_errors=True)\n+        # This is 403 instead of 401 because basic authentication is only for unit tests and, in order to keep from\n+        # presenting a basic authentication dialog box in the front end. We may change this as we understand CAS\n+        # a little better\n+        assert_equal(res.status_code, 403)\n+\n+    def test_deletes_public_node_logged_in(self):\n+        res = self.app.delete(self.public_url, auth=self.basic_auth_two, expect_errors=True)\n+        assert_equal(res.status_code, 403)\n+        assert_equal(self.public_project.is_deleted, False)\n+\n+        res = self.app.delete(self.public_url, auth=self.basic_auth, expect_errors=True)\n+        assert_equal(res.status_code, 202)\n+        assert_equal(self.public_project.is_deleted, False)\n+        detail = ast.literal_eval(res.json['detail'])","path":"tests/api_tests/nodes/test_views.py","position":82,"original_position":82,"commit_id":"0b01ba0e4ff4ec7823d923200ff57cc05a58e30c","original_commit_id":"0b01ba0e4ff4ec7823d923200ff57cc05a58e30c","user":{"login":"brianjgeiger","id":6599111,"avatar_url":"https://avatars.githubusercontent.com/u/6599111?v=3","gravatar_id":"","url":"https://api.github.com/users/brianjgeiger","html_url":"https://github.com/brianjgeiger","followers_url":"https://api.github.com/users/brianjgeiger/followers","following_url":"https://api.github.com/users/brianjgeiger/following{/other_user}","gists_url":"https://api.github.com/users/brianjgeiger/gists{/gist_id}","starred_url":"https://api.github.com/users/brianjgeiger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianjgeiger/subscriptions","organizations_url":"https://api.github.com/users/brianjgeiger/orgs","repos_url":"https://api.github.com/users/brianjgeiger/repos","events_url":"https://api.github.com/users/brianjgeiger/events{/privacy}","received_events_url":"https://api.github.com/users/brianjgeiger/received_events","type":"User","site_admin":false},"body":"So all that being said, now that I'm looking at the response object, this should be a dictionary, not a list. The URL should be a… relation link, I believe. We might want to have a serializer specifically for this response so people will know the structure of what they're getting back before they get it. Probably will have an id, a warning message, and the link dictionary with the relation field.","created_at":"2015-06-18T15:52:49Z","updated_at":"2015-06-18T15:52:49Z","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3156#discussion_r32745525","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/32745525"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/3156#discussion_r32745525"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156","id":37826141,"html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3156","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/3156.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/3156.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3156","number":3156,"state":"open","locked":false,"title":"[feature] Delete node in API","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"body":"<h1> Purpose </h1>\r\nIssue #3143.  Adding capabilities to delete node via API.   \r\n<ul>\r\n<li> User sends DELETE request containing node id</li>\r\n<li> Server returns error, asking the user to confirm they want to delete project, along with a new url </li>\r\n<li> User sends DELETE request to second url, containing node id and token </li>\r\n<li> Provided token and node id are valid, node is deleted </li>\r\n</ul>\r\n\r\n<h1> Changes </h1>\r\n<ul> \r\n<li> token creator added to utils.py, which is part of the new url returned </li>\r\n<li> url added to urls.py </li>\r\n<li> translatable warning text added to language.py </li>\r\n<li> NodeDetail expanded to include first delete node logic and new class NodeDeleteConfirm added for second delete node logic in views.py </li>\r\n<li> tests for deleting node in test_views.py </li>\r\n<li> correction to test_deletes_private_node_pointer_logged_in_non_contributor.  URL and assert were incorrect. (I originally wrote this test). </li>\r\n</ul> \r\n<h1> Side Effects </h1>\r\nTwo lines added in Swagger documentation \r\n![screen shot 2015-06-16 at 2 28 01 pm](https://cloud.githubusercontent.com/assets/9755598/8191003/fe1e1efa-1433-11e5-882a-b0c9cedd59ec.png)\r\n\r\n\r\n","created_at":"2015-06-16T18:29:14Z","updated_at":"2015-06-18T15:52:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be42bbd51157df8d649bdb329e938c4e671c4002","assignee":{"login":"lyndsysimon","id":131414,"avatar_url":"https://avatars.githubusercontent.com/u/131414?v=3","gravatar_id":"","url":"https://api.github.com/users/lyndsysimon","html_url":"https://github.com/lyndsysimon","followers_url":"https://api.github.com/users/lyndsysimon/followers","following_url":"https://api.github.com/users/lyndsysimon/following{/other_user}","gists_url":"https://api.github.com/users/lyndsysimon/gists{/gist_id}","starred_url":"https://api.github.com/users/lyndsysimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyndsysimon/subscriptions","organizations_url":"https://api.github.com/users/lyndsysimon/orgs","repos_url":"https://api.github.com/users/lyndsysimon/repos","events_url":"https://api.github.com/users/lyndsysimon/events{/privacy}","received_events_url":"https://api.github.com/users/lyndsysimon/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones/39","html_url":"https://github.com/CenterForOpenScience/osf.io/milestones/0.41.0","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones/39/labels","id":1162008,"number":39,"title":"0.41.0","description":"PR's + Continued API v2 enhancements","creator":{"login":"samanehsan","id":6414394,"avatar_url":"https://avatars.githubusercontent.com/u/6414394?v=3","gravatar_id":"","url":"https://api.github.com/users/samanehsan","html_url":"https://github.com/samanehsan","followers_url":"https://api.github.com/users/samanehsan/followers","following_url":"https://api.github.com/users/samanehsan/following{/other_user}","gists_url":"https://api.github.com/users/samanehsan/gists{/gist_id}","starred_url":"https://api.github.com/users/samanehsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samanehsan/subscriptions","organizations_url":"https://api.github.com/users/samanehsan/orgs","repos_url":"https://api.github.com/users/samanehsan/repos","events_url":"https://api.github.com/users/samanehsan/events{/privacy}","received_events_url":"https://api.github.com/users/samanehsan/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":15,"state":"open","created_at":"2015-06-12T13:50:24Z","updated_at":"2015-06-18T02:28:06Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3156/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/0b01ba0e4ff4ec7823d923200ff57cc05a58e30c","head":{"label":"pattisdr:delete_node_in_API","ref":"delete_node_in_API","sha":"0b01ba0e4ff4ec7823d923200ff57cc05a58e30c","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"repo":{"id":35900874,"name":"osf.io","full_name":"pattisdr/osf.io","owner":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pattisdr/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/pattisdr/osf.io","forks_url":"https://api.github.com/repos/pattisdr/osf.io/forks","keys_url":"https://api.github.com/repos/pattisdr/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pattisdr/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pattisdr/osf.io/teams","hooks_url":"https://api.github.com/repos/pattisdr/osf.io/hooks","issue_events_url":"https://api.github.com/repos/pattisdr/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/pattisdr/osf.io/events","assignees_url":"https://api.github.com/repos/pattisdr/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/pattisdr/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/pattisdr/osf.io/tags","blobs_url":"https://api.github.com/repos/pattisdr/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pattisdr/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pattisdr/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/pattisdr/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/pattisdr/osf.io/languages","stargazers_url":"https://api.github.com/repos/pattisdr/osf.io/stargazers","contributors_url":"https://api.github.com/repos/pattisdr/osf.io/contributors","subscribers_url":"https://api.github.com/repos/pattisdr/osf.io/subscribers","subscription_url":"https://api.github.com/repos/pattisdr/osf.io/subscription","commits_url":"https://api.github.com/repos/pattisdr/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/pattisdr/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/pattisdr/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/pattisdr/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/pattisdr/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pattisdr/osf.io/merges","archive_url":"https://api.github.com/repos/pattisdr/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pattisdr/osf.io/downloads","issues_url":"https://api.github.com/repos/pattisdr/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/pattisdr/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/pattisdr/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/pattisdr/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pattisdr/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/pattisdr/osf.io/releases{/id}","created_at":"2015-05-19T18:33:09Z","updated_at":"2015-05-19T18:33:13Z","pushed_at":"2015-06-17T16:54:52Z","git_url":"git://github.com/pattisdr/osf.io.git","ssh_url":"git@github.com:pattisdr/osf.io.git","clone_url":"https://github.com/pattisdr/osf.io.git","svn_url":"https://github.com/pattisdr/osf.io","homepage":"http://osf.io","size":91780,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"ac72efe1dd12144793a4fd8cc095b6cd249310bc","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":10199599,"name":"osf.io","full_name":"CenterForOpenScience/osf.io","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/osf.io","description":"Facilitating Open Science","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/osf.io","forks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/releases{/id}","created_at":"2013-05-21T15:53:37Z","updated_at":"2015-06-12T13:26:03Z","pushed_at":"2015-06-18T15:20:51Z","git_url":"git://github.com/CenterForOpenScience/osf.io.git","ssh_url":"git@github.com:CenterForOpenScience/osf.io.git","clone_url":"https://github.com/CenterForOpenScience/osf.io.git","svn_url":"https://github.com/CenterForOpenScience/osf.io","homepage":"http://osf.io","size":209834,"stargazers_count":112,"watchers_count":112,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":98,"mirror_url":null,"open_issues_count":451,"forks":98,"open_issues":451,"watchers":112,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/3156"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3156"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3156/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3156/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/0b01ba0e4ff4ec7823d923200ff57cc05a58e30c"}}}}