{"action":"created","comment":{"url":"https://api.github.com/repos/DO2016/mysite/pulls/comments/80673095","pull_request_review_id":1713011,"id":80673095,"diff_hunk":"@@ -1,3 +1,87 @@\n from django.test import TestCase\n \n # Create your tests here.\n+import json\n+import random\n+import string\n+from django.test import Client\n+from django.shortcuts import redirect\n+from .models import CustomUser, Item, Currency\n+from django.test import TestCase, RequestFactory\n+from django.core.urlresolvers import reverse, resolve\n+from django.contrib.auth.models import AnonymousUser, User\n+\n+#from .views import registration_view\n+\n+class SimpleTest(TestCase):\n+\n+    def setUp(self):\n+        #uname = ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(10))\n+        self.plain_password = 'top_secret'\n+        self.user = CustomUser.objects.create_user(username='3PgtXSpw8P', email='dorlov@merann.ru', password=self.plain_password)\n+        self.user.confirmation_code = ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(33))\n+        self.user.save()\n+\n+\n+    def test_a_register(self):\n+        c = Client()\n+        new_username = self.user.username + '123'\n+\n+        response = c.post('http://127.0.0.1:8080/app2/register', { 'first_name': new_username,\n+            'last_name' : 'levinson', 'email' : self.user.email, 'password' : self.user.password \n+        })\n+        self.assertEqual(response.status_code, 200)\n+        user = CustomUser.objects.get(username=new_username)\n+        self.assertEqual(user is not None and user.is_active, False)\n+\n+        # confirmation\n+        # 127.0.0.1:8080/app2/confirm/QGVkHLtpJoJeFNyJJeipB4U7G1CIl7b0c/TTT\n+\n+        url = 'http://127.0.0.1:8080/app2/confirm/' + user.confirmation_code + '/' + user.username\n+        response = c.get(url)\n+        self.assertEqual(response.status_code, 302)\n+        user = CustomUser.objects.get(username=new_username)\n+        self.assertTrue(user is not None and user.is_active)\n+\n+\n+    def test_b_profile(self):\n+        c = Client()\n+        user = User.objects.get(username=self.user.username)\n+        response = c.get('http://127.0.0.1:8080/app2/profile/{0}/'.format(str(user.id)), {})\n+        self.assertEqual(response.status_code, 200)\n+        self.assertTrue(user.username in response.content)\n+\n+  \n+    def test_c_login(self):\n+        c = Client()\n+        url = 'http://127.0.0.1:8080/app2/confirm/' + self.user.confirmation_code + '/' + self.user.username\n+        response = c.get(url)\n+        self.assertEqual(response.status_code, 302)\n+        response = c.post('http://127.0.0.1:8080/app2/login', { 'username': self.user.username, 'password' : self.plain_password, })\n+        self.assertEqual(response.status_code, 302)\n+        self.assertTrue(response['Location'].endswith('/app2/'))\n+\n+\n+    def test_d_logout(self):\n+        c = Client()\n+        response = c.get('http://127.0.0.1:8080/app2/logout', {})\n+        self.assertEqual(response.status_code, 302)\n+        self.assertTrue(response['Location'].endswith, '/app2/login')\n+\n+\n+    def test_e_itemlist(self):\n+        c = Client()\n+        response = c.get('http://127.0.0.1:8080/app2/items/', {})\n+        self.assertEqual(response.status_code, 200)\n+\n+\n+    def test_f_details(self):\n+        c = Client()\n+        iname = ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(10))\n+        currency = Currency.objects.create(name='test_currency')\n+\n+        item = Item.objects.create(name=iname, content='test', currency=Currency.objects.get(pk=currency.pk))\n+        url = 'http://127.0.0.1:8080/app2/details/' + str(item.pk)","path":"app2/tests.py","position":84,"original_position":84,"commit_id":"e6adc55b69d1d1daa2f972e843df0e099fe02c79","original_commit_id":"e6adc55b69d1d1daa2f972e843df0e099fe02c79","user":{"login":"vsdudakov","id":1876709,"avatar_url":"https://avatars.githubusercontent.com/u/1876709?v=3","gravatar_id":"","url":"https://api.github.com/users/vsdudakov","html_url":"https://github.com/vsdudakov","followers_url":"https://api.github.com/users/vsdudakov/followers","following_url":"https://api.github.com/users/vsdudakov/following{/other_user}","gists_url":"https://api.github.com/users/vsdudakov/gists{/gist_id}","starred_url":"https://api.github.com/users/vsdudakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsdudakov/subscriptions","organizations_url":"https://api.github.com/users/vsdudakov/orgs","repos_url":"https://api.github.com/users/vsdudakov/repos","events_url":"https://api.github.com/users/vsdudakov/events{/privacy}","received_events_url":"https://api.github.com/users/vsdudakov/received_events","type":"User","site_admin":false},"body":"хардкод не делает тебя тру питонистом. Use reverse, reverse_lazy with url name","created_at":"2016-09-27T11:42:52Z","updated_at":"2016-09-27T11:47:00Z","html_url":"https://github.com/DO2016/mysite/pull/4#discussion_r80673095","pull_request_url":"https://api.github.com/repos/DO2016/mysite/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/DO2016/mysite/pulls/comments/80673095"},"html":{"href":"https://github.com/DO2016/mysite/pull/4#discussion_r80673095"},"pull_request":{"href":"https://api.github.com/repos/DO2016/mysite/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/DO2016/mysite/pulls/4","id":85554476,"html_url":"https://github.com/DO2016/mysite/pull/4","diff_url":"https://github.com/DO2016/mysite/pull/4.diff","patch_url":"https://github.com/DO2016/mysite/pull/4.patch","issue_url":"https://api.github.com/repos/DO2016/mysite/issues/4","number":4,"state":"open","locked":false,"title":"Test branch","user":{"login":"DO2016","id":22077131,"avatar_url":"https://avatars.githubusercontent.com/u/22077131?v=3","gravatar_id":"","url":"https://api.github.com/users/DO2016","html_url":"https://github.com/DO2016","followers_url":"https://api.github.com/users/DO2016/followers","following_url":"https://api.github.com/users/DO2016/following{/other_user}","gists_url":"https://api.github.com/users/DO2016/gists{/gist_id}","starred_url":"https://api.github.com/users/DO2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DO2016/subscriptions","organizations_url":"https://api.github.com/users/DO2016/orgs","repos_url":"https://api.github.com/users/DO2016/repos","events_url":"https://api.github.com/users/DO2016/events{/privacy}","received_events_url":"https://api.github.com/users/DO2016/received_events","type":"User","site_admin":false},"body":"@vsdudakov \r\n\"Add login & user authentication\"","created_at":"2016-09-16T11:01:12Z","updated_at":"2016-09-27T11:47:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"092b7a76ec1bce06ef2b9eb33280df5d231a8446","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DO2016/mysite/pulls/4/commits","review_comments_url":"https://api.github.com/repos/DO2016/mysite/pulls/4/comments","review_comment_url":"https://api.github.com/repos/DO2016/mysite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DO2016/mysite/issues/4/comments","statuses_url":"https://api.github.com/repos/DO2016/mysite/statuses/e6adc55b69d1d1daa2f972e843df0e099fe02c79","head":{"label":"DO2016:test_branch","ref":"test_branch","sha":"e6adc55b69d1d1daa2f972e843df0e099fe02c79","user":{"login":"DO2016","id":22077131,"avatar_url":"https://avatars.githubusercontent.com/u/22077131?v=3","gravatar_id":"","url":"https://api.github.com/users/DO2016","html_url":"https://github.com/DO2016","followers_url":"https://api.github.com/users/DO2016/followers","following_url":"https://api.github.com/users/DO2016/following{/other_user}","gists_url":"https://api.github.com/users/DO2016/gists{/gist_id}","starred_url":"https://api.github.com/users/DO2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DO2016/subscriptions","organizations_url":"https://api.github.com/users/DO2016/orgs","repos_url":"https://api.github.com/users/DO2016/repos","events_url":"https://api.github.com/users/DO2016/events{/privacy}","received_events_url":"https://api.github.com/users/DO2016/received_events","type":"User","site_admin":false},"repo":{"id":67704686,"name":"mysite","full_name":"DO2016/mysite","owner":{"login":"DO2016","id":22077131,"avatar_url":"https://avatars.githubusercontent.com/u/22077131?v=3","gravatar_id":"","url":"https://api.github.com/users/DO2016","html_url":"https://github.com/DO2016","followers_url":"https://api.github.com/users/DO2016/followers","following_url":"https://api.github.com/users/DO2016/following{/other_user}","gists_url":"https://api.github.com/users/DO2016/gists{/gist_id}","starred_url":"https://api.github.com/users/DO2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DO2016/subscriptions","organizations_url":"https://api.github.com/users/DO2016/orgs","repos_url":"https://api.github.com/users/DO2016/repos","events_url":"https://api.github.com/users/DO2016/events{/privacy}","received_events_url":"https://api.github.com/users/DO2016/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DO2016/mysite","description":null,"fork":false,"url":"https://api.github.com/repos/DO2016/mysite","forks_url":"https://api.github.com/repos/DO2016/mysite/forks","keys_url":"https://api.github.com/repos/DO2016/mysite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DO2016/mysite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DO2016/mysite/teams","hooks_url":"https://api.github.com/repos/DO2016/mysite/hooks","issue_events_url":"https://api.github.com/repos/DO2016/mysite/issues/events{/number}","events_url":"https://api.github.com/repos/DO2016/mysite/events","assignees_url":"https://api.github.com/repos/DO2016/mysite/assignees{/user}","branches_url":"https://api.github.com/repos/DO2016/mysite/branches{/branch}","tags_url":"https://api.github.com/repos/DO2016/mysite/tags","blobs_url":"https://api.github.com/repos/DO2016/mysite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DO2016/mysite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DO2016/mysite/git/refs{/sha}","trees_url":"https://api.github.com/repos/DO2016/mysite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DO2016/mysite/statuses/{sha}","languages_url":"https://api.github.com/repos/DO2016/mysite/languages","stargazers_url":"https://api.github.com/repos/DO2016/mysite/stargazers","contributors_url":"https://api.github.com/repos/DO2016/mysite/contributors","subscribers_url":"https://api.github.com/repos/DO2016/mysite/subscribers","subscription_url":"https://api.github.com/repos/DO2016/mysite/subscription","commits_url":"https://api.github.com/repos/DO2016/mysite/commits{/sha}","git_commits_url":"https://api.github.com/repos/DO2016/mysite/git/commits{/sha}","comments_url":"https://api.github.com/repos/DO2016/mysite/comments{/number}","issue_comment_url":"https://api.github.com/repos/DO2016/mysite/issues/comments{/number}","contents_url":"https://api.github.com/repos/DO2016/mysite/contents/{+path}","compare_url":"https://api.github.com/repos/DO2016/mysite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DO2016/mysite/merges","archive_url":"https://api.github.com/repos/DO2016/mysite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DO2016/mysite/downloads","issues_url":"https://api.github.com/repos/DO2016/mysite/issues{/number}","pulls_url":"https://api.github.com/repos/DO2016/mysite/pulls{/number}","milestones_url":"https://api.github.com/repos/DO2016/mysite/milestones{/number}","notifications_url":"https://api.github.com/repos/DO2016/mysite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DO2016/mysite/labels{/name}","releases_url":"https://api.github.com/repos/DO2016/mysite/releases{/id}","deployments_url":"https://api.github.com/repos/DO2016/mysite/deployments","created_at":"2016-09-08T13:17:10Z","updated_at":"2016-09-08T13:20:26Z","pushed_at":"2016-09-27T10:13:45Z","git_url":"git://github.com/DO2016/mysite.git","ssh_url":"git@github.com:DO2016/mysite.git","clone_url":"https://github.com/DO2016/mysite.git","svn_url":"https://github.com/DO2016/mysite","homepage":null,"size":938,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"DO2016:master","ref":"master","sha":"5c1167e6452dbf6945aa19515d57696048f48a72","user":{"login":"DO2016","id":22077131,"avatar_url":"https://avatars.githubusercontent.com/u/22077131?v=3","gravatar_id":"","url":"https://api.github.com/users/DO2016","html_url":"https://github.com/DO2016","followers_url":"https://api.github.com/users/DO2016/followers","following_url":"https://api.github.com/users/DO2016/following{/other_user}","gists_url":"https://api.github.com/users/DO2016/gists{/gist_id}","starred_url":"https://api.github.com/users/DO2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DO2016/subscriptions","organizations_url":"https://api.github.com/users/DO2016/orgs","repos_url":"https://api.github.com/users/DO2016/repos","events_url":"https://api.github.com/users/DO2016/events{/privacy}","received_events_url":"https://api.github.com/users/DO2016/received_events","type":"User","site_admin":false},"repo":{"id":67704686,"name":"mysite","full_name":"DO2016/mysite","owner":{"login":"DO2016","id":22077131,"avatar_url":"https://avatars.githubusercontent.com/u/22077131?v=3","gravatar_id":"","url":"https://api.github.com/users/DO2016","html_url":"https://github.com/DO2016","followers_url":"https://api.github.com/users/DO2016/followers","following_url":"https://api.github.com/users/DO2016/following{/other_user}","gists_url":"https://api.github.com/users/DO2016/gists{/gist_id}","starred_url":"https://api.github.com/users/DO2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DO2016/subscriptions","organizations_url":"https://api.github.com/users/DO2016/orgs","repos_url":"https://api.github.com/users/DO2016/repos","events_url":"https://api.github.com/users/DO2016/events{/privacy}","received_events_url":"https://api.github.com/users/DO2016/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DO2016/mysite","description":null,"fork":false,"url":"https://api.github.com/repos/DO2016/mysite","forks_url":"https://api.github.com/repos/DO2016/mysite/forks","keys_url":"https://api.github.com/repos/DO2016/mysite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DO2016/mysite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DO2016/mysite/teams","hooks_url":"https://api.github.com/repos/DO2016/mysite/hooks","issue_events_url":"https://api.github.com/repos/DO2016/mysite/issues/events{/number}","events_url":"https://api.github.com/repos/DO2016/mysite/events","assignees_url":"https://api.github.com/repos/DO2016/mysite/assignees{/user}","branches_url":"https://api.github.com/repos/DO2016/mysite/branches{/branch}","tags_url":"https://api.github.com/repos/DO2016/mysite/tags","blobs_url":"https://api.github.com/repos/DO2016/mysite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DO2016/mysite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DO2016/mysite/git/refs{/sha}","trees_url":"https://api.github.com/repos/DO2016/mysite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DO2016/mysite/statuses/{sha}","languages_url":"https://api.github.com/repos/DO2016/mysite/languages","stargazers_url":"https://api.github.com/repos/DO2016/mysite/stargazers","contributors_url":"https://api.github.com/repos/DO2016/mysite/contributors","subscribers_url":"https://api.github.com/repos/DO2016/mysite/subscribers","subscription_url":"https://api.github.com/repos/DO2016/mysite/subscription","commits_url":"https://api.github.com/repos/DO2016/mysite/commits{/sha}","git_commits_url":"https://api.github.com/repos/DO2016/mysite/git/commits{/sha}","comments_url":"https://api.github.com/repos/DO2016/mysite/comments{/number}","issue_comment_url":"https://api.github.com/repos/DO2016/mysite/issues/comments{/number}","contents_url":"https://api.github.com/repos/DO2016/mysite/contents/{+path}","compare_url":"https://api.github.com/repos/DO2016/mysite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DO2016/mysite/merges","archive_url":"https://api.github.com/repos/DO2016/mysite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DO2016/mysite/downloads","issues_url":"https://api.github.com/repos/DO2016/mysite/issues{/number}","pulls_url":"https://api.github.com/repos/DO2016/mysite/pulls{/number}","milestones_url":"https://api.github.com/repos/DO2016/mysite/milestones{/number}","notifications_url":"https://api.github.com/repos/DO2016/mysite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DO2016/mysite/labels{/name}","releases_url":"https://api.github.com/repos/DO2016/mysite/releases{/id}","deployments_url":"https://api.github.com/repos/DO2016/mysite/deployments","created_at":"2016-09-08T13:17:10Z","updated_at":"2016-09-08T13:20:26Z","pushed_at":"2016-09-27T10:13:45Z","git_url":"git://github.com/DO2016/mysite.git","ssh_url":"git@github.com:DO2016/mysite.git","clone_url":"https://github.com/DO2016/mysite.git","svn_url":"https://github.com/DO2016/mysite","homepage":null,"size":938,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DO2016/mysite/pulls/4"},"html":{"href":"https://github.com/DO2016/mysite/pull/4"},"issue":{"href":"https://api.github.com/repos/DO2016/mysite/issues/4"},"comments":{"href":"https://api.github.com/repos/DO2016/mysite/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/DO2016/mysite/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/DO2016/mysite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DO2016/mysite/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/DO2016/mysite/statuses/e6adc55b69d1d1daa2f972e843df0e099fe02c79"}}}}
{"actor":{"display_login":"vsdudakov"}}