{"action":"created","comment":{"url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/comments/51613284","id":51613284,"diff_hunk":"@@ -0,0 +1,151 @@\n+from django.test import TestCase\n+from rest_framework.test import APIRequestFactory\n+from rest_framework.test import APIClient\n+from rest_framework import status\n+from app.models import Bucketlist, Bucketitems\n+from django.contrib.auth.models import User\n+\n+\n+factory = APIRequestFactory()\n+\n+# Create your tests here.\n+\n+\n+class BucketlistTest(TestCase):\n+\n+    \"\"\" Test for Api responses \"\"\"\n+\n+    def setUp(self):\n+        \"\"\"\n+           Setting for test\n+        \"\"\"\n+        self.factory = APIRequestFactory()\n+        self.client = APIClient()\n+        self.bucketlist = None\n+        data = {\"username\": \"admintest\", \"password\": \"password\"}\n+        response = self.client.post('/api/users/', data, format='json')\n+        self.user = User.objects.all().first()\n+        self.bucketlist = Bucketlist\n+        self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n+\n+    def _require_login(self):\n+        \"\"\"set up login\"\"\"\n+\n+        url = '/api/api-token/'\n+        data = {\"username\": \"admintest\", \"password\": \"password\"}\n+        response = self.client.post(url, data, format='json')\n+        return response.data\n+\n+    def test_user(self):\n+        \"\"\" Test if user exist in the user table\"\"\"\n+\n+        data = {\"username\": \"admintest2\", \"password\": \"password\"}\n+        response = self.client.post('/api/users/', data, format='json')\n+        self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n+        # Test if user has been added and can be retrieved\n+        url = '/api/users/'\n+        response = self.client.get(url, format='json')\n+        self.assertEqual(response.status_code, 200)\n+        self.assertEqual(len(response.data), 2)\n+\n+        # check if user is unique\n+        data = {\"username\": \"admintest2\", \"password\": \"password\"}\n+        response = self.client.post('/api/users/', data, format='json')\n+        self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n+\n+    def _get_token(self):","path":"app/tests.py","position":56,"original_position":56,"commit_id":"0693ea9af51150e89ec3fd9316868876cc32ba00","original_commit_id":"0693ea9af51150e89ec3fd9316868876cc32ba00","user":{"login":"andela-amwaleh","id":12892105,"avatar_url":"https://avatars.githubusercontent.com/u/12892105?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-amwaleh","html_url":"https://github.com/andela-amwaleh","followers_url":"https://api.github.com/users/andela-amwaleh/followers","following_url":"https://api.github.com/users/andela-amwaleh/following{/other_user}","gists_url":"https://api.github.com/users/andela-amwaleh/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-amwaleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-amwaleh/subscriptions","organizations_url":"https://api.github.com/users/andela-amwaleh/orgs","repos_url":"https://api.github.com/users/andela-amwaleh/repos","events_url":"https://api.github.com/users/andela-amwaleh/events{/privacy}","received_events_url":"https://api.github.com/users/andela-amwaleh/received_events","type":"User","site_admin":false},"body":":100: ","created_at":"2016-02-02T18:39:25Z","updated_at":"2016-02-02T18:39:25Z","html_url":"https://github.com/andela-amwaleh/checkpoint3/pull/1#discussion_r51613284","pull_request_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/comments/51613284"},"html":{"href":"https://github.com/andela-amwaleh/checkpoint3/pull/1#discussion_r51613284"},"pull_request":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1","id":57573354,"html_url":"https://github.com/andela-amwaleh/checkpoint3/pull/1","diff_url":"https://github.com/andela-amwaleh/checkpoint3/pull/1.diff","patch_url":"https://github.com/andela-amwaleh/checkpoint3/pull/1.patch","issue_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/1","number":1,"state":"open","locked":false,"title":"Merge into Develop","user":{"login":"andela-amwaleh","id":12892105,"avatar_url":"https://avatars.githubusercontent.com/u/12892105?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-amwaleh","html_url":"https://github.com/andela-amwaleh","followers_url":"https://api.github.com/users/andela-amwaleh/followers","following_url":"https://api.github.com/users/andela-amwaleh/following{/other_user}","gists_url":"https://api.github.com/users/andela-amwaleh/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-amwaleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-amwaleh/subscriptions","organizations_url":"https://api.github.com/users/andela-amwaleh/orgs","repos_url":"https://api.github.com/users/andela-amwaleh/repos","events_url":"https://api.github.com/users/andela-amwaleh/events{/privacy}","received_events_url":"https://api.github.com/users/andela-amwaleh/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-28T22:02:33Z","updated_at":"2016-02-02T18:39:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"234f95bf0f7fe3b060be08c3d6975fe88cddcedf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1/commits","review_comments_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1/comments","review_comment_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/1/comments","statuses_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/statuses/0693ea9af51150e89ec3fd9316868876cc32ba00","head":{"label":"andela-amwaleh:feature/test","ref":"feature/test","sha":"0693ea9af51150e89ec3fd9316868876cc32ba00","user":{"login":"andela-amwaleh","id":12892105,"avatar_url":"https://avatars.githubusercontent.com/u/12892105?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-amwaleh","html_url":"https://github.com/andela-amwaleh","followers_url":"https://api.github.com/users/andela-amwaleh/followers","following_url":"https://api.github.com/users/andela-amwaleh/following{/other_user}","gists_url":"https://api.github.com/users/andela-amwaleh/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-amwaleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-amwaleh/subscriptions","organizations_url":"https://api.github.com/users/andela-amwaleh/orgs","repos_url":"https://api.github.com/users/andela-amwaleh/repos","events_url":"https://api.github.com/users/andela-amwaleh/events{/privacy}","received_events_url":"https://api.github.com/users/andela-amwaleh/received_events","type":"User","site_admin":false},"repo":{"id":48978728,"name":"checkpoint3","full_name":"andela-amwaleh/checkpoint3","owner":{"login":"andela-amwaleh","id":12892105,"avatar_url":"https://avatars.githubusercontent.com/u/12892105?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-amwaleh","html_url":"https://github.com/andela-amwaleh","followers_url":"https://api.github.com/users/andela-amwaleh/followers","following_url":"https://api.github.com/users/andela-amwaleh/following{/other_user}","gists_url":"https://api.github.com/users/andela-amwaleh/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-amwaleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-amwaleh/subscriptions","organizations_url":"https://api.github.com/users/andela-amwaleh/orgs","repos_url":"https://api.github.com/users/andela-amwaleh/repos","events_url":"https://api.github.com/users/andela-amwaleh/events{/privacy}","received_events_url":"https://api.github.com/users/andela-amwaleh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-amwaleh/checkpoint3","description":"Api and Demo Website ","fork":false,"url":"https://api.github.com/repos/andela-amwaleh/checkpoint3","forks_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/forks","keys_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/teams","hooks_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/hooks","issue_events_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/events{/number}","events_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/events","assignees_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/assignees{/user}","branches_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/branches{/branch}","tags_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/tags","blobs_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/languages","stargazers_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/stargazers","contributors_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/contributors","subscribers_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/subscribers","subscription_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/subscription","commits_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/contents/{+path}","compare_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/merges","archive_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/downloads","issues_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues{/number}","pulls_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/labels{/name}","releases_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/releases{/id}","deployments_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/deployments","created_at":"2016-01-04T06:24:23Z","updated_at":"2016-01-28T20:51:01Z","pushed_at":"2016-02-02T15:55:10Z","git_url":"git://github.com/andela-amwaleh/checkpoint3.git","ssh_url":"git@github.com:andela-amwaleh/checkpoint3.git","clone_url":"https://github.com/andela-amwaleh/checkpoint3.git","svn_url":"https://github.com/andela-amwaleh/checkpoint3","homepage":"https://blist-django.herokuapp.com/","size":18142,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"andela-amwaleh:develop","ref":"develop","sha":"bf3892cc46dcaa1f0f1218c31b4522ee74d7a2de","user":{"login":"andela-amwaleh","id":12892105,"avatar_url":"https://avatars.githubusercontent.com/u/12892105?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-amwaleh","html_url":"https://github.com/andela-amwaleh","followers_url":"https://api.github.com/users/andela-amwaleh/followers","following_url":"https://api.github.com/users/andela-amwaleh/following{/other_user}","gists_url":"https://api.github.com/users/andela-amwaleh/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-amwaleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-amwaleh/subscriptions","organizations_url":"https://api.github.com/users/andela-amwaleh/orgs","repos_url":"https://api.github.com/users/andela-amwaleh/repos","events_url":"https://api.github.com/users/andela-amwaleh/events{/privacy}","received_events_url":"https://api.github.com/users/andela-amwaleh/received_events","type":"User","site_admin":false},"repo":{"id":48978728,"name":"checkpoint3","full_name":"andela-amwaleh/checkpoint3","owner":{"login":"andela-amwaleh","id":12892105,"avatar_url":"https://avatars.githubusercontent.com/u/12892105?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-amwaleh","html_url":"https://github.com/andela-amwaleh","followers_url":"https://api.github.com/users/andela-amwaleh/followers","following_url":"https://api.github.com/users/andela-amwaleh/following{/other_user}","gists_url":"https://api.github.com/users/andela-amwaleh/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-amwaleh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-amwaleh/subscriptions","organizations_url":"https://api.github.com/users/andela-amwaleh/orgs","repos_url":"https://api.github.com/users/andela-amwaleh/repos","events_url":"https://api.github.com/users/andela-amwaleh/events{/privacy}","received_events_url":"https://api.github.com/users/andela-amwaleh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-amwaleh/checkpoint3","description":"Api and Demo Website ","fork":false,"url":"https://api.github.com/repos/andela-amwaleh/checkpoint3","forks_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/forks","keys_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/teams","hooks_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/hooks","issue_events_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/events{/number}","events_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/events","assignees_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/assignees{/user}","branches_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/branches{/branch}","tags_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/tags","blobs_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/languages","stargazers_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/stargazers","contributors_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/contributors","subscribers_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/subscribers","subscription_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/subscription","commits_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/contents/{+path}","compare_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/merges","archive_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/downloads","issues_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues{/number}","pulls_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/labels{/name}","releases_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/releases{/id}","deployments_url":"https://api.github.com/repos/andela-amwaleh/checkpoint3/deployments","created_at":"2016-01-04T06:24:23Z","updated_at":"2016-01-28T20:51:01Z","pushed_at":"2016-02-02T15:55:10Z","git_url":"git://github.com/andela-amwaleh/checkpoint3.git","ssh_url":"git@github.com:andela-amwaleh/checkpoint3.git","clone_url":"https://github.com/andela-amwaleh/checkpoint3.git","svn_url":"https://github.com/andela-amwaleh/checkpoint3","homepage":"https://blist-django.herokuapp.com/","size":18142,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1"},"html":{"href":"https://github.com/andela-amwaleh/checkpoint3/pull/1"},"issue":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/1"},"comments":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/andela-amwaleh/checkpoint3/statuses/0693ea9af51150e89ec3fd9316868876cc32ba00"}}}}