{"action":"created","comment":{"url":"https://api.github.com/repos/andmichalski/family/pulls/comments/194249823","pull_request_review_id":127389479,"id":194249823,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDI0OTgyMw==","diff_hunk":"@@ -56,25 +61,149 @@ def test_i_am_not_in_the_first_place_in_database(self):\n class ChildAdminTests(TestCase):\n \n     def setUp(self):\n-        father1 = Father.objects.create(name=\"Andrzej\", last_name=\"Michalski\")\n-        father2 = Father.objects.create(name=\"Marcin\", last_name=\"Pietraszek\")\n+        father1 = Father.objects.create(name=\"Andrzej\", last_name=\"Michalski\", email=\"andrzej@michalski.pl\")\n+        father2 = Father.objects.create(name=\"Marcin\", last_name=\"Pietraszek\", email=\"marcin@pietraszek.pl\")\n         Child.objects.create(name=\"Jan\", last_name=\"Michalski\", birth=datetime(2014, 9, 11), father=father1)\n         Child.objects.create(name=\"Franciszek\", last_name=\"Pietraszek\", birth=datetime(2018, 1, 5), father=father2)\n         Child.objects.create(name=\"Tomasz\", last_name=\"Pietraszek\", birth=datetime(2016, 11, 15), father=father2)\n+        admin_user = get_user_model().objects.create_superuser('admin', 'admin@example.com', 'password')\n+        self.client.login(username=admin_user.username, password='password')\n \n     def test_should_change_last_name_michalski_when_call_queryset(self):\n         url = reverse(\"admin:tree_child_changelist\")\n         childs = Child.objects.filter(father__last_name=\"Pietraszek\")\n         selected_ids = [child.pk for child in childs]\n \n         data = {\"action\": \"change_last_name_michalski\", \"_selected_action\": selected_ids}\n-        admin_user = get_user_model().objects.create_superuser('admin', 'admin@example.com', 'password')\n \n-        self.client.login(username=admin_user.username, password='password')\n         response = self.client.post(url, data, follow=True)\n         self.assertEqual(response.status_code, 200)\n         self.assertEqual(['Michalski', 'Michalski'], [c.last_name for c in Child.objects.filter(id__in=selected_ids)])\n \n     def test_action_should_write_json_file(self):\n+        url = reverse(\"admin:tree_child_changelist\")\n+        child = Child.objects.get(id=1)\n+        data = {\"action\": \"export_to_json\", \"_selected_action\": [child.pk]}\n+        self.client.post(url, data, follow=True)\n+        with open(\"json.txt\", 'r') as f:\n+            json_file = f.read()\n+\n+        self.assertTrue(path.isfile(\"json.txt\"))\n+        remove(\"json.txt\")\n+\n+        json_output = [{\"model\": \"tree.child\", \"pk\": 1,\n+                        \"fields\": {\"name\": \"Jan\", \"last_name\": \"Michalski\", \"father\": 1, \"birth\": \"2014-09-11\"}}]\n+        json_file = json.loads(json_file)\n+        self.assertEqual(json_output, json_file)\n+\n+    def test_should_change_last_name(self):\n+        url = reverse(\"admin:tree_child_changelist\")\n+        child = Child.objects.get(id=1)\n+        data = {\"action\": \"change_lastname\", \"_selected_action\": [child.pk], \"_last_name\": \"Pietraszek\"}\n+        response = self.client.post(url, data, follow=True)\n+        self.assertEqual(\"Pietraszek\", Child.objects.get(id=1).last_name)\n+\n+    @patch('tree.admin.ChildAdmin.message_user')\n+    def test_should_display_correct_message(self, mock_message):\n+        url = reverse(\"admin:tree_child_changelist\")\n+        child = Child.objects.get(id=1)\n+        data = {\"action\": \"change_lastname\", \"_selected_action\": [child.pk], \"_last_name\": \"Pietraszek\"}\n+        response = self.client.post(url, data, follow=True)","path":"tree/tests.py","position":96,"original_position":96,"commit_id":"a9d301da3ab3255c1705e2c257db3d41697c3eb3","original_commit_id":"a9d301da3ab3255c1705e2c257db3d41697c3eb3","user":{"login":"rsiera","id":2650375,"node_id":"MDQ6VXNlcjI2NTAzNzU=","avatar_url":"https://avatars3.githubusercontent.com/u/2650375?v=4","gravatar_id":"","url":"https://api.github.com/users/rsiera","html_url":"https://github.com/rsiera","followers_url":"https://api.github.com/users/rsiera/followers","following_url":"https://api.github.com/users/rsiera/following{/other_user}","gists_url":"https://api.github.com/users/rsiera/gists{/gist_id}","starred_url":"https://api.github.com/users/rsiera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsiera/subscriptions","organizations_url":"https://api.github.com/users/rsiera/orgs","repos_url":"https://api.github.com/users/rsiera/repos","events_url":"https://api.github.com/users/rsiera/events{/privacy}","received_events_url":"https://api.github.com/users/rsiera/received_events","type":"User","site_admin":false},"body":"Don't use follow=True, instead of changing method=\"POST\" later.","created_at":"2018-06-10T08:29:55Z","updated_at":"2018-06-10T08:29:55Z","html_url":"https://github.com/andmichalski/family/pull/5#discussion_r194249823","pull_request_url":"https://api.github.com/repos/andmichalski/family/pulls/5","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/andmichalski/family/pulls/comments/194249823"},"html":{"href":"https://github.com/andmichalski/family/pull/5#discussion_r194249823"},"pull_request":{"href":"https://api.github.com/repos/andmichalski/family/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/andmichalski/family/pulls/5","id":193342936,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMzQyOTM2","html_url":"https://github.com/andmichalski/family/pull/5","diff_url":"https://github.com/andmichalski/family/pull/5.diff","patch_url":"https://github.com/andmichalski/family/pull/5.patch","issue_url":"https://api.github.com/repos/andmichalski/family/issues/5","number":5,"state":"open","locked":false,"title":"Dev","user":{"login":"andmichalski","id":38986141,"node_id":"MDQ6VXNlcjM4OTg2MTQx","avatar_url":"https://avatars2.githubusercontent.com/u/38986141?v=4","gravatar_id":"","url":"https://api.github.com/users/andmichalski","html_url":"https://github.com/andmichalski","followers_url":"https://api.github.com/users/andmichalski/followers","following_url":"https://api.github.com/users/andmichalski/following{/other_user}","gists_url":"https://api.github.com/users/andmichalski/gists{/gist_id}","starred_url":"https://api.github.com/users/andmichalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andmichalski/subscriptions","organizations_url":"https://api.github.com/users/andmichalski/orgs","repos_url":"https://api.github.com/users/andmichalski/repos","events_url":"https://api.github.com/users/andmichalski/events{/privacy}","received_events_url":"https://api.github.com/users/andmichalski/received_events","type":"User","site_admin":false},"body":"When I override modeladmin - changelist_view on get_queryset method. How I can go inside this queryset in unittesting\r\n\r\nWhy in unittesting if I write self.c.post(....) when debuging and dig into response - method is GET.\r\n\r\nIn unittesting if I compare queryset from response.context_data (all children) with model (for example Child.objects.all() ) it is not equal.\r\n\r\nThanks","created_at":"2018-06-07T14:32:43Z","updated_at":"2018-06-10T08:29:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9304755f3c5b2d2a4988c7fc6dd04e1733ca2345","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andmichalski/family/pulls/5/commits","review_comments_url":"https://api.github.com/repos/andmichalski/family/pulls/5/comments","review_comment_url":"https://api.github.com/repos/andmichalski/family/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andmichalski/family/issues/5/comments","statuses_url":"https://api.github.com/repos/andmichalski/family/statuses/a9d301da3ab3255c1705e2c257db3d41697c3eb3","head":{"label":"andmichalski:dev","ref":"dev","sha":"a9d301da3ab3255c1705e2c257db3d41697c3eb3","user":{"login":"andmichalski","id":38986141,"node_id":"MDQ6VXNlcjM4OTg2MTQx","avatar_url":"https://avatars2.githubusercontent.com/u/38986141?v=4","gravatar_id":"","url":"https://api.github.com/users/andmichalski","html_url":"https://github.com/andmichalski","followers_url":"https://api.github.com/users/andmichalski/followers","following_url":"https://api.github.com/users/andmichalski/following{/other_user}","gists_url":"https://api.github.com/users/andmichalski/gists{/gist_id}","starred_url":"https://api.github.com/users/andmichalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andmichalski/subscriptions","organizations_url":"https://api.github.com/users/andmichalski/orgs","repos_url":"https://api.github.com/users/andmichalski/repos","events_url":"https://api.github.com/users/andmichalski/events{/privacy}","received_events_url":"https://api.github.com/users/andmichalski/received_events","type":"User","site_admin":false},"repo":{"id":134990533,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ5OTA1MzM=","name":"family","full_name":"andmichalski/family","owner":{"login":"andmichalski","id":38986141,"node_id":"MDQ6VXNlcjM4OTg2MTQx","avatar_url":"https://avatars2.githubusercontent.com/u/38986141?v=4","gravatar_id":"","url":"https://api.github.com/users/andmichalski","html_url":"https://github.com/andmichalski","followers_url":"https://api.github.com/users/andmichalski/followers","following_url":"https://api.github.com/users/andmichalski/following{/other_user}","gists_url":"https://api.github.com/users/andmichalski/gists{/gist_id}","starred_url":"https://api.github.com/users/andmichalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andmichalski/subscriptions","organizations_url":"https://api.github.com/users/andmichalski/orgs","repos_url":"https://api.github.com/users/andmichalski/repos","events_url":"https://api.github.com/users/andmichalski/events{/privacy}","received_events_url":"https://api.github.com/users/andmichalski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andmichalski/family","description":"Project about relations in family","fork":false,"url":"https://api.github.com/repos/andmichalski/family","forks_url":"https://api.github.com/repos/andmichalski/family/forks","keys_url":"https://api.github.com/repos/andmichalski/family/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andmichalski/family/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andmichalski/family/teams","hooks_url":"https://api.github.com/repos/andmichalski/family/hooks","issue_events_url":"https://api.github.com/repos/andmichalski/family/issues/events{/number}","events_url":"https://api.github.com/repos/andmichalski/family/events","assignees_url":"https://api.github.com/repos/andmichalski/family/assignees{/user}","branches_url":"https://api.github.com/repos/andmichalski/family/branches{/branch}","tags_url":"https://api.github.com/repos/andmichalski/family/tags","blobs_url":"https://api.github.com/repos/andmichalski/family/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andmichalski/family/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andmichalski/family/git/refs{/sha}","trees_url":"https://api.github.com/repos/andmichalski/family/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andmichalski/family/statuses/{sha}","languages_url":"https://api.github.com/repos/andmichalski/family/languages","stargazers_url":"https://api.github.com/repos/andmichalski/family/stargazers","contributors_url":"https://api.github.com/repos/andmichalski/family/contributors","subscribers_url":"https://api.github.com/repos/andmichalski/family/subscribers","subscription_url":"https://api.github.com/repos/andmichalski/family/subscription","commits_url":"https://api.github.com/repos/andmichalski/family/commits{/sha}","git_commits_url":"https://api.github.com/repos/andmichalski/family/git/commits{/sha}","comments_url":"https://api.github.com/repos/andmichalski/family/comments{/number}","issue_comment_url":"https://api.github.com/repos/andmichalski/family/issues/comments{/number}","contents_url":"https://api.github.com/repos/andmichalski/family/contents/{+path}","compare_url":"https://api.github.com/repos/andmichalski/family/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andmichalski/family/merges","archive_url":"https://api.github.com/repos/andmichalski/family/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andmichalski/family/downloads","issues_url":"https://api.github.com/repos/andmichalski/family/issues{/number}","pulls_url":"https://api.github.com/repos/andmichalski/family/pulls{/number}","milestones_url":"https://api.github.com/repos/andmichalski/family/milestones{/number}","notifications_url":"https://api.github.com/repos/andmichalski/family/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andmichalski/family/labels{/name}","releases_url":"https://api.github.com/repos/andmichalski/family/releases{/id}","deployments_url":"https://api.github.com/repos/andmichalski/family/deployments","created_at":"2018-05-26T19:51:51Z","updated_at":"2018-06-05T19:23:03Z","pushed_at":"2018-06-08T11:13:52Z","git_url":"git://github.com/andmichalski/family.git","ssh_url":"git@github.com:andmichalski/family.git","clone_url":"https://github.com/andmichalski/family.git","svn_url":"https://github.com/andmichalski/family","homepage":null,"size":97,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"andmichalski:master","ref":"master","sha":"56b2937ce7657882a4ad8f055539e5a38d6cddfd","user":{"login":"andmichalski","id":38986141,"node_id":"MDQ6VXNlcjM4OTg2MTQx","avatar_url":"https://avatars2.githubusercontent.com/u/38986141?v=4","gravatar_id":"","url":"https://api.github.com/users/andmichalski","html_url":"https://github.com/andmichalski","followers_url":"https://api.github.com/users/andmichalski/followers","following_url":"https://api.github.com/users/andmichalski/following{/other_user}","gists_url":"https://api.github.com/users/andmichalski/gists{/gist_id}","starred_url":"https://api.github.com/users/andmichalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andmichalski/subscriptions","organizations_url":"https://api.github.com/users/andmichalski/orgs","repos_url":"https://api.github.com/users/andmichalski/repos","events_url":"https://api.github.com/users/andmichalski/events{/privacy}","received_events_url":"https://api.github.com/users/andmichalski/received_events","type":"User","site_admin":false},"repo":{"id":134990533,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQ5OTA1MzM=","name":"family","full_name":"andmichalski/family","owner":{"login":"andmichalski","id":38986141,"node_id":"MDQ6VXNlcjM4OTg2MTQx","avatar_url":"https://avatars2.githubusercontent.com/u/38986141?v=4","gravatar_id":"","url":"https://api.github.com/users/andmichalski","html_url":"https://github.com/andmichalski","followers_url":"https://api.github.com/users/andmichalski/followers","following_url":"https://api.github.com/users/andmichalski/following{/other_user}","gists_url":"https://api.github.com/users/andmichalski/gists{/gist_id}","starred_url":"https://api.github.com/users/andmichalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andmichalski/subscriptions","organizations_url":"https://api.github.com/users/andmichalski/orgs","repos_url":"https://api.github.com/users/andmichalski/repos","events_url":"https://api.github.com/users/andmichalski/events{/privacy}","received_events_url":"https://api.github.com/users/andmichalski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andmichalski/family","description":"Project about relations in family","fork":false,"url":"https://api.github.com/repos/andmichalski/family","forks_url":"https://api.github.com/repos/andmichalski/family/forks","keys_url":"https://api.github.com/repos/andmichalski/family/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andmichalski/family/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andmichalski/family/teams","hooks_url":"https://api.github.com/repos/andmichalski/family/hooks","issue_events_url":"https://api.github.com/repos/andmichalski/family/issues/events{/number}","events_url":"https://api.github.com/repos/andmichalski/family/events","assignees_url":"https://api.github.com/repos/andmichalski/family/assignees{/user}","branches_url":"https://api.github.com/repos/andmichalski/family/branches{/branch}","tags_url":"https://api.github.com/repos/andmichalski/family/tags","blobs_url":"https://api.github.com/repos/andmichalski/family/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andmichalski/family/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andmichalski/family/git/refs{/sha}","trees_url":"https://api.github.com/repos/andmichalski/family/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andmichalski/family/statuses/{sha}","languages_url":"https://api.github.com/repos/andmichalski/family/languages","stargazers_url":"https://api.github.com/repos/andmichalski/family/stargazers","contributors_url":"https://api.github.com/repos/andmichalski/family/contributors","subscribers_url":"https://api.github.com/repos/andmichalski/family/subscribers","subscription_url":"https://api.github.com/repos/andmichalski/family/subscription","commits_url":"https://api.github.com/repos/andmichalski/family/commits{/sha}","git_commits_url":"https://api.github.com/repos/andmichalski/family/git/commits{/sha}","comments_url":"https://api.github.com/repos/andmichalski/family/comments{/number}","issue_comment_url":"https://api.github.com/repos/andmichalski/family/issues/comments{/number}","contents_url":"https://api.github.com/repos/andmichalski/family/contents/{+path}","compare_url":"https://api.github.com/repos/andmichalski/family/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andmichalski/family/merges","archive_url":"https://api.github.com/repos/andmichalski/family/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andmichalski/family/downloads","issues_url":"https://api.github.com/repos/andmichalski/family/issues{/number}","pulls_url":"https://api.github.com/repos/andmichalski/family/pulls{/number}","milestones_url":"https://api.github.com/repos/andmichalski/family/milestones{/number}","notifications_url":"https://api.github.com/repos/andmichalski/family/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andmichalski/family/labels{/name}","releases_url":"https://api.github.com/repos/andmichalski/family/releases{/id}","deployments_url":"https://api.github.com/repos/andmichalski/family/deployments","created_at":"2018-05-26T19:51:51Z","updated_at":"2018-06-05T19:23:03Z","pushed_at":"2018-06-08T11:13:52Z","git_url":"git://github.com/andmichalski/family.git","ssh_url":"git@github.com:andmichalski/family.git","clone_url":"https://github.com/andmichalski/family.git","svn_url":"https://github.com/andmichalski/family","homepage":null,"size":97,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andmichalski/family/pulls/5"},"html":{"href":"https://github.com/andmichalski/family/pull/5"},"issue":{"href":"https://api.github.com/repos/andmichalski/family/issues/5"},"comments":{"href":"https://api.github.com/repos/andmichalski/family/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/andmichalski/family/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/andmichalski/family/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andmichalski/family/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/andmichalski/family/statuses/a9d301da3ab3255c1705e2c257db3d41697c3eb3"}},"author_association":"OWNER"}}
{"actor":{"display_login":"rsiera"}}