{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/comments/74898876","id":74898876,"diff_hunk":"@@ -283,3 +284,155 @@ def test_download_csv(self, data_api_client):\n         response = self._return_user_export_response(data_api_client, framework, users)\n         assert response.status_code == 200\n         self._assert_things_about_user_export(response, users)\n+\n+\n+@mock.patch('app.main.views.users.data_api_client')\n+class TestBuyersExport(LoggedInApplicationTest):\n+\n+    def test_response_data_has_buyer_info(self, data_api_client):\n+        data_api_client.find_users_iter.return_value = [\n+            {\n+                'id': 1,\n+                \"name\": \"Chris\",\n+                \"emailAddress\": \"chris@gov.uk\",\n+                \"phoneNumber\": \"01234567891\",\n+                \"createdAt\": \"Thu, 04 Aug 2016 12:00:00 GMT\"\n+            }\n+        ]\n+\n+        data_api_client.find_briefs_iter.return_value = [\n+            {\n+                'title': 'This is a brief',\n+                'status': 'draft',\n+                'users': [{\n+                    'id': 1\n+                }]\n+            }\n+        ]\n+\n+        response = self.client.get('/admin/users/download/buyers')\n+        rows = [line.split(\",\") for line in response.get_data(as_text=True).splitlines()]\n+        buyer = rows[1]\n+\n+        assert response.status_code == 200\n+        assert buyer == [u'Chris', u'chris@gov.uk', u'01234567891',","path":"tests/app/main/views/test_users.py","position":42,"original_position":42,"commit_id":"92589d08ba6a79a62ebff87387b676187a39364c","original_commit_id":"92589d08ba6a79a62ebff87387b676187a39364c","user":{"login":"idavidmcdonald","id":7228605,"avatar_url":"https://avatars.githubusercontent.com/u/7228605?v=3","gravatar_id":"","url":"https://api.github.com/users/idavidmcdonald","html_url":"https://github.com/idavidmcdonald","followers_url":"https://api.github.com/users/idavidmcdonald/followers","following_url":"https://api.github.com/users/idavidmcdonald/following{/other_user}","gists_url":"https://api.github.com/users/idavidmcdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/idavidmcdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idavidmcdonald/subscriptions","organizations_url":"https://api.github.com/users/idavidmcdonald/orgs","repos_url":"https://api.github.com/users/idavidmcdonald/repos","events_url":"https://api.github.com/users/idavidmcdonald/events{/privacy}","received_events_url":"https://api.github.com/users/idavidmcdonald/received_events","type":"User","site_admin":false},"body":"Could be good to assert the values of the header row too (probably just in one of your tests, no need for overkill).","created_at":"2016-08-16T09:00:15Z","updated_at":"2016-08-16T09:00:15Z","html_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/202#discussion_r74898876","pull_request_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202","_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/comments/74898876"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/202#discussion_r74898876"},"pull_request":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202","id":80624970,"html_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/202","diff_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/202.diff","patch_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/202.patch","issue_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/202","number":202,"state":"open","locked":false,"title":"Add link for admin's to download a csv of buyers details and their breifs","user":{"login":"Wynndow","id":13836290,"avatar_url":"https://avatars.githubusercontent.com/u/13836290?v=3","gravatar_id":"","url":"https://api.github.com/users/Wynndow","html_url":"https://github.com/Wynndow","followers_url":"https://api.github.com/users/Wynndow/followers","following_url":"https://api.github.com/users/Wynndow/following{/other_user}","gists_url":"https://api.github.com/users/Wynndow/gists{/gist_id}","starred_url":"https://api.github.com/users/Wynndow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wynndow/subscriptions","organizations_url":"https://api.github.com/users/Wynndow/orgs","repos_url":"https://api.github.com/users/Wynndow/repos","events_url":"https://api.github.com/users/Wynndow/events{/privacy}","received_events_url":"https://api.github.com/users/Wynndow/received_events","type":"User","site_admin":false},"body":"Part of [this](https://www.pivotaltracker.com/story/show/124104161) story on Pivotal.\r\n\r\nThis PR supersedes [this](https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/201) PR for the same story.\r\n\r\nFor [this](https://www.pivotaltracker.com/story/show/124104161) story on Pivotal.\r\n\r\nAdmin's need to be able to extract a list of buyers with their contact details and their briefs.\r\n\r\nThis PR adds a link to the download user list page which hits the api at /briefs and /users and combines the results into a csv for download.. Api PR is [here](https://github.com/alphagov/digitalmarketplace-api/pull/431) and apiclient PR is [here](https://github.com/alphagov/digitalmarketplace-apiclient/pull/33)\r\n\r\nApiclient PR will need merging for tests to go green.\r\n\r\n![download_buyer_csv](https://cloud.githubusercontent.com/assets/13836290/17441126/89a06510-5b27-11e6-8f60-d0ae0e736ba3.gif)\r\n","created_at":"2016-08-09T13:57:22Z","updated_at":"2016-08-16T09:00:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f764318d23ed25f094ad045962b4c31fece6fa3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202/commits","review_comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202/comments","review_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/202/comments","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/statuses/92589d08ba6a79a62ebff87387b676187a39364c","head":{"label":"alphagov:other_way_of_extracting_buyers_and_briefs","ref":"other_way_of_extracting_buyers_and_briefs","sha":"92589d08ba6a79a62ebff87387b676187a39364c","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":31009853,"name":"digitalmarketplace-admin-frontend","full_name":"alphagov/digitalmarketplace-admin-frontend","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend","description":"Frontend administration application for the digital marketplace","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/deployments","created_at":"2015-02-19T10:09:45Z","updated_at":"2016-07-01T17:36:58Z","pushed_at":"2016-08-15T16:00:18Z","git_url":"git://github.com/alphagov/digitalmarketplace-admin-frontend.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-admin-frontend.git","clone_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend.git","svn_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend","homepage":"","size":848,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"4befdb8388a7f8b2db92676b1d2236cf2c4edeeb","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":31009853,"name":"digitalmarketplace-admin-frontend","full_name":"alphagov/digitalmarketplace-admin-frontend","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend","description":"Frontend administration application for the digital marketplace","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/deployments","created_at":"2015-02-19T10:09:45Z","updated_at":"2016-07-01T17:36:58Z","pushed_at":"2016-08-15T16:00:18Z","git_url":"git://github.com/alphagov/digitalmarketplace-admin-frontend.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-admin-frontend.git","clone_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend.git","svn_url":"https://github.com/alphagov/digitalmarketplace-admin-frontend","homepage":"","size":848,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-admin-frontend/pull/202"},"issue":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/202"},"comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/issues/202/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/pulls/202/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-admin-frontend/statuses/92589d08ba6a79a62ebff87387b676187a39364c"}}}}
{"actor":{"display_login":"idavidmcdonald"}}