{"action":"created","comment":{"url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/comments/92956228","pull_request_review_id":13477364,"id":92956228,"diff_hunk":"@@ -0,0 +1,325 @@\n+import { assert } from 'chai';\n+import MockServer from '../../util/mock-server';\n+import {\n+    changeProtocol,\n+    changeHost,\n+    changePort,\n+    checkIn,\n+    checkOutItems,\n+    createItem,\n+    createModel,\n+    deleteItem,\n+    getAllItems,\n+    getAllModels,\n+    searchItem,\n+    searchModel,\n+    searchStudent\n+} from '../../../.dist/lib/api-client';\n+\n+describe('API Client', () => {\n+\n+    before(() => {\n+        changeProtocol('http');\n+        changeHost('localhost');\n+        changePort(8080);\n+    });\n+\n+    it('checkIn', () => {\n+        let response = {\n+            status: 'success',\n+            data: {\n+                itemAddress: 'iGwEZUvfA',\n+                modelName: 'Resistor'\n+            }\n+        };\n+        return MockServer.listen({\n+            port: 8080,\n+            method: 'post',\n+            endpoint: '/api/checkin',\n+            response\n+        }).then(() => {\n+            return checkIn('123456', 'iGwEZUvfA');\n+        }).then(data => {\n+            assert.deepEqual(data, response.data);\n+            MockServer.validate({\n+                studentId: '123456',\n+                itemAddress: 'iGwEZUvfA'\n+            });\n+        });\n+    });\n+\n+    it('checkOutItems', () => {\n+        let response = {\n+            status: 'success'\n+        };\n+        return MockServer.listen({\n+            port: 8080,\n+            method: 'post',\n+            endpoint: '/api/checkout',\n+            response\n+        }).then(() => {\n+            return checkOutItems('123456', ['iGwEZUvfA', 'iGwEZVHHE']);\n+        }).then(data => {\n+            assert.isUndefined(data);\n+            MockServer.validate({\n+                studentId: '123456',\n+                itemAddresses: ['iGwEZUvfA', 'iGwEZVHHE']\n+            });\n+        });\n+    });\n+\n+    it('checkOutItems (with code)', () => {\n+        let response = {\n+            status: 'success'\n+        };\n+        return MockServer.listen({\n+            port: 8080,\n+            method: 'post',\n+            endpoint: '/api/checkout',\n+            response\n+        }).then(() => {\n+            return checkOutItems('123456', ['iGwEZUvfA', 'iGwEZVHHE'], 'abcdef');\n+        }).then(data => {\n+            assert.deepEqual(data, response.data);\n+            MockServer.validate({\n+                studentId: '123456',\n+                itemAddresses: ['iGwEZUvfA', 'iGwEZVHHE'],\n+                adminCode: 'abcdef'\n+            });\n+        });\n+    });\n+\n+    it('createItem', () => {\n+        let response = {\n+            status: 'success',\n+            data: {\n+                address: 'iGwEZUvfA',\n+                modelName: 'Resistor'\n+            }\n+        };\n+        return MockServer.listen({\n+            port: 8080,\n+            method: 'post',\n+            endpoint: '/api/item',\n+            response\n+        }).then(() => {\n+            return createItem('m8y7nEtAe');\n+        }).then(data => {\n+            assert.deepEqual(data, response.data);\n+            MockServer.validate({\n+                modelAddress: 'm8y7nEtAe'\n+            });\n+        });\n+    });\n+\n+    it('createModel', () => {\n+        let response = {\n+            status: 'success',\n+            data: {\n+                address: 'm8y7nEtAe',\n+                name: 'Resistor',\n+                description: 'V = IR',\n+                manufacturer: 'Live',\n+                vendor: 'Mouzer',\n+                location: 'Shelf 14',\n+                isFaulty: false,\n+                faultDescription: '',\n+                price: 10.50,\n+                count: 20\n+            }\n+        };\n+        return MockServer.listen({\n+            port: 8080,\n+            method: 'post',\n+            endpoint: '/api/model',\n+            response\n+        }).then(() => {\n+            return createModel('Resistor', 'V = IR', 'Live', 'Mouzer', 'Shelf 14', false, '', 10.50, 20);\n+        }).then(data => {\n+            assert.deepEqual(data, response.data);\n+            MockServer.validate({\n+                name: 'Resistor',\n+                description: 'V = IR',\n+                manufacturer: 'Live',\n+                vendor: 'Mouzer',\n+                location: 'Shelf 14',\n+                isFaulty: false,\n+                faultDescription: '',\n+                price: 10.50,\n+                count: 20\n+            });\n+        });\n+    });\n+\n+    it('deleteItem', () => {\n+        let response = {\n+            status: 'success',\n+            data: {\n+                items: [{\n+                    address: 'iGwEZVHHE',\n+                    modelAddress: 'm8y7nEtAe',\n+                    status: 'AVAILABLE'\n+                }],\n+                modelName: 'Resistor'\n+            }\n+        };\n+        return MockServer.listen({\n+            port: 8080,\n+            method: 'delete',\n+            endpoint: '/api/item',\n+            response\n+        }).then(() => {\n+            return deleteItem({\n+                address: 'iGwEZUvfA',\n+                modelAddress: 'm8y7nEtAe'","path":"test/unit/lib/api-client.js","position":174,"original_position":174,"commit_id":"9df9e8300bcd765aec22bd0355a1aa0cc532f8ee","original_commit_id":"9df9e8300bcd765aec22bd0355a1aa0cc532f8ee","user":{"login":"mattmahn","id":2239024,"avatar_url":"https://avatars.githubusercontent.com/u/2239024?v=3","gravatar_id":"","url":"https://api.github.com/users/mattmahn","html_url":"https://github.com/mattmahn","followers_url":"https://api.github.com/users/mattmahn/followers","following_url":"https://api.github.com/users/mattmahn/following{/other_user}","gists_url":"https://api.github.com/users/mattmahn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattmahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattmahn/subscriptions","organizations_url":"https://api.github.com/users/mattmahn/orgs","repos_url":"https://api.github.com/users/mattmahn/repos","events_url":"https://api.github.com/users/mattmahn/events{/privacy}","received_events_url":"https://api.github.com/users/mattmahn/received_events","type":"User","site_admin":false},"body":"ain't nobody got time to go back and read that","created_at":"2016-12-19T01:00:30Z","updated_at":"2016-12-19T01:00:30Z","html_url":"https://github.com/TheFourFifths/consus-client/pull/59#discussion_r92956228","pull_request_url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59","_links":{"self":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/comments/92956228"},"html":{"href":"https://github.com/TheFourFifths/consus-client/pull/59#discussion_r92956228"},"pull_request":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59"}}},"pull_request":{"url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59","id":98463716,"html_url":"https://github.com/TheFourFifths/consus-client/pull/59","diff_url":"https://github.com/TheFourFifths/consus-client/pull/59.diff","patch_url":"https://github.com/TheFourFifths/consus-client/pull/59.patch","issue_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues/59","number":59,"state":"open","locked":false,"title":"TFF-117: API Testing","user":{"login":"thofmann","id":5055041,"avatar_url":"https://avatars.githubusercontent.com/u/5055041?v=3","gravatar_id":"","url":"https://api.github.com/users/thofmann","html_url":"https://github.com/thofmann","followers_url":"https://api.github.com/users/thofmann/followers","following_url":"https://api.github.com/users/thofmann/following{/other_user}","gists_url":"https://api.github.com/users/thofmann/gists{/gist_id}","starred_url":"https://api.github.com/users/thofmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thofmann/subscriptions","organizations_url":"https://api.github.com/users/thofmann/orgs","repos_url":"https://api.github.com/users/thofmann/repos","events_url":"https://api.github.com/users/thofmann/events{/privacy}","received_events_url":"https://api.github.com/users/thofmann/received_events","type":"User","site_admin":false},"body":"### Summary\r\n\r\nThis PR adds tests for the API client.\r\n\r\nNote: I'm making the pull request from the `api-testing-TFF-117` TASK straight into `dev`, because it is the last task left in the story, and the story has already been merged into `dev`.\r\n\r\n### Checklist\r\n\r\n- [x] Have you added unit and functional tests as appropriate?\r\n- [x] Did you update/add documentation for new methods or changed functionality?\r\n- [x] Have you merged the target branch down into this one?\r\n\r\nFinally, is it ready to be reviewed and merged: Yes :leaves:\r\n\r\n### How to Review\r\n\r\n1. Read the [added tests](https://github.com/TheFourFifths/consus-client/blob/api-testing-TFF-117/test/unit/lib/api-client.js) for clarity.\r\n2. `npm install` (express and body-parser)\r\n3. `npm test`\r\n4. Verify with [Codecov that all exported API client functions](https://codecov.io/gh/TheFourFifths/consus-client/src/9df9e8300bcd765aec22bd0355a1aa0cc532f8ee/src/lib/api-client.js) are tested.\r\n\r\n### Links\r\n\r\nPut links to Jira tickets, and anything else, here.\r\n\r\n- [TFF-117](https://msoese.atlassian.net/browse/TFF-117)","created_at":"2016-12-18T03:44:50Z","updated_at":"2016-12-19T01:00:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"978defa4d90d08314a2de47c692edcfc471cd13f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59/commits","review_comments_url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59/comments","review_comment_url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues/59/comments","statuses_url":"https://api.github.com/repos/TheFourFifths/consus-client/statuses/9df9e8300bcd765aec22bd0355a1aa0cc532f8ee","head":{"label":"TheFourFifths:api-testing-TFF-117","ref":"api-testing-TFF-117","sha":"9df9e8300bcd765aec22bd0355a1aa0cc532f8ee","user":{"login":"TheFourFifths","id":22348640,"avatar_url":"https://avatars.githubusercontent.com/u/22348640?v=3","gravatar_id":"","url":"https://api.github.com/users/TheFourFifths","html_url":"https://github.com/TheFourFifths","followers_url":"https://api.github.com/users/TheFourFifths/followers","following_url":"https://api.github.com/users/TheFourFifths/following{/other_user}","gists_url":"https://api.github.com/users/TheFourFifths/gists{/gist_id}","starred_url":"https://api.github.com/users/TheFourFifths/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheFourFifths/subscriptions","organizations_url":"https://api.github.com/users/TheFourFifths/orgs","repos_url":"https://api.github.com/users/TheFourFifths/repos","events_url":"https://api.github.com/users/TheFourFifths/events{/privacy}","received_events_url":"https://api.github.com/users/TheFourFifths/received_events","type":"Organization","site_admin":false},"repo":{"id":69761288,"name":"consus-client","full_name":"TheFourFifths/consus-client","owner":{"login":"TheFourFifths","id":22348640,"avatar_url":"https://avatars.githubusercontent.com/u/22348640?v=3","gravatar_id":"","url":"https://api.github.com/users/TheFourFifths","html_url":"https://github.com/TheFourFifths","followers_url":"https://api.github.com/users/TheFourFifths/followers","following_url":"https://api.github.com/users/TheFourFifths/following{/other_user}","gists_url":"https://api.github.com/users/TheFourFifths/gists{/gist_id}","starred_url":"https://api.github.com/users/TheFourFifths/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheFourFifths/subscriptions","organizations_url":"https://api.github.com/users/TheFourFifths/orgs","repos_url":"https://api.github.com/users/TheFourFifths/repos","events_url":"https://api.github.com/users/TheFourFifths/events{/privacy}","received_events_url":"https://api.github.com/users/TheFourFifths/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheFourFifths/consus-client","description":"The Consus desktop application","fork":false,"url":"https://api.github.com/repos/TheFourFifths/consus-client","forks_url":"https://api.github.com/repos/TheFourFifths/consus-client/forks","keys_url":"https://api.github.com/repos/TheFourFifths/consus-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheFourFifths/consus-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheFourFifths/consus-client/teams","hooks_url":"https://api.github.com/repos/TheFourFifths/consus-client/hooks","issue_events_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues/events{/number}","events_url":"https://api.github.com/repos/TheFourFifths/consus-client/events","assignees_url":"https://api.github.com/repos/TheFourFifths/consus-client/assignees{/user}","branches_url":"https://api.github.com/repos/TheFourFifths/consus-client/branches{/branch}","tags_url":"https://api.github.com/repos/TheFourFifths/consus-client/tags","blobs_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheFourFifths/consus-client/statuses/{sha}","languages_url":"https://api.github.com/repos/TheFourFifths/consus-client/languages","stargazers_url":"https://api.github.com/repos/TheFourFifths/consus-client/stargazers","contributors_url":"https://api.github.com/repos/TheFourFifths/consus-client/contributors","subscribers_url":"https://api.github.com/repos/TheFourFifths/consus-client/subscribers","subscription_url":"https://api.github.com/repos/TheFourFifths/consus-client/subscription","commits_url":"https://api.github.com/repos/TheFourFifths/consus-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheFourFifths/consus-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheFourFifths/consus-client/contents/{+path}","compare_url":"https://api.github.com/repos/TheFourFifths/consus-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheFourFifths/consus-client/merges","archive_url":"https://api.github.com/repos/TheFourFifths/consus-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheFourFifths/consus-client/downloads","issues_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues{/number}","pulls_url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls{/number}","milestones_url":"https://api.github.com/repos/TheFourFifths/consus-client/milestones{/number}","notifications_url":"https://api.github.com/repos/TheFourFifths/consus-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheFourFifths/consus-client/labels{/name}","releases_url":"https://api.github.com/repos/TheFourFifths/consus-client/releases{/id}","deployments_url":"https://api.github.com/repos/TheFourFifths/consus-client/deployments","created_at":"2016-10-01T20:11:43Z","updated_at":"2016-11-13T18:44:29Z","pushed_at":"2016-12-18T23:48:24Z","git_url":"git://github.com/TheFourFifths/consus-client.git","ssh_url":"git@github.com:TheFourFifths/consus-client.git","clone_url":"https://github.com/TheFourFifths/consus-client.git","svn_url":"https://github.com/TheFourFifths/consus-client","homepage":null,"size":394,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"dev"}},"base":{"label":"TheFourFifths:dev","ref":"dev","sha":"38305345d08d5dc7894652817d0e9c44442cc1df","user":{"login":"TheFourFifths","id":22348640,"avatar_url":"https://avatars.githubusercontent.com/u/22348640?v=3","gravatar_id":"","url":"https://api.github.com/users/TheFourFifths","html_url":"https://github.com/TheFourFifths","followers_url":"https://api.github.com/users/TheFourFifths/followers","following_url":"https://api.github.com/users/TheFourFifths/following{/other_user}","gists_url":"https://api.github.com/users/TheFourFifths/gists{/gist_id}","starred_url":"https://api.github.com/users/TheFourFifths/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheFourFifths/subscriptions","organizations_url":"https://api.github.com/users/TheFourFifths/orgs","repos_url":"https://api.github.com/users/TheFourFifths/repos","events_url":"https://api.github.com/users/TheFourFifths/events{/privacy}","received_events_url":"https://api.github.com/users/TheFourFifths/received_events","type":"Organization","site_admin":false},"repo":{"id":69761288,"name":"consus-client","full_name":"TheFourFifths/consus-client","owner":{"login":"TheFourFifths","id":22348640,"avatar_url":"https://avatars.githubusercontent.com/u/22348640?v=3","gravatar_id":"","url":"https://api.github.com/users/TheFourFifths","html_url":"https://github.com/TheFourFifths","followers_url":"https://api.github.com/users/TheFourFifths/followers","following_url":"https://api.github.com/users/TheFourFifths/following{/other_user}","gists_url":"https://api.github.com/users/TheFourFifths/gists{/gist_id}","starred_url":"https://api.github.com/users/TheFourFifths/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheFourFifths/subscriptions","organizations_url":"https://api.github.com/users/TheFourFifths/orgs","repos_url":"https://api.github.com/users/TheFourFifths/repos","events_url":"https://api.github.com/users/TheFourFifths/events{/privacy}","received_events_url":"https://api.github.com/users/TheFourFifths/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TheFourFifths/consus-client","description":"The Consus desktop application","fork":false,"url":"https://api.github.com/repos/TheFourFifths/consus-client","forks_url":"https://api.github.com/repos/TheFourFifths/consus-client/forks","keys_url":"https://api.github.com/repos/TheFourFifths/consus-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheFourFifths/consus-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheFourFifths/consus-client/teams","hooks_url":"https://api.github.com/repos/TheFourFifths/consus-client/hooks","issue_events_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues/events{/number}","events_url":"https://api.github.com/repos/TheFourFifths/consus-client/events","assignees_url":"https://api.github.com/repos/TheFourFifths/consus-client/assignees{/user}","branches_url":"https://api.github.com/repos/TheFourFifths/consus-client/branches{/branch}","tags_url":"https://api.github.com/repos/TheFourFifths/consus-client/tags","blobs_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheFourFifths/consus-client/statuses/{sha}","languages_url":"https://api.github.com/repos/TheFourFifths/consus-client/languages","stargazers_url":"https://api.github.com/repos/TheFourFifths/consus-client/stargazers","contributors_url":"https://api.github.com/repos/TheFourFifths/consus-client/contributors","subscribers_url":"https://api.github.com/repos/TheFourFifths/consus-client/subscribers","subscription_url":"https://api.github.com/repos/TheFourFifths/consus-client/subscription","commits_url":"https://api.github.com/repos/TheFourFifths/consus-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheFourFifths/consus-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheFourFifths/consus-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheFourFifths/consus-client/contents/{+path}","compare_url":"https://api.github.com/repos/TheFourFifths/consus-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheFourFifths/consus-client/merges","archive_url":"https://api.github.com/repos/TheFourFifths/consus-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheFourFifths/consus-client/downloads","issues_url":"https://api.github.com/repos/TheFourFifths/consus-client/issues{/number}","pulls_url":"https://api.github.com/repos/TheFourFifths/consus-client/pulls{/number}","milestones_url":"https://api.github.com/repos/TheFourFifths/consus-client/milestones{/number}","notifications_url":"https://api.github.com/repos/TheFourFifths/consus-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheFourFifths/consus-client/labels{/name}","releases_url":"https://api.github.com/repos/TheFourFifths/consus-client/releases{/id}","deployments_url":"https://api.github.com/repos/TheFourFifths/consus-client/deployments","created_at":"2016-10-01T20:11:43Z","updated_at":"2016-11-13T18:44:29Z","pushed_at":"2016-12-18T23:48:24Z","git_url":"git://github.com/TheFourFifths/consus-client.git","ssh_url":"git@github.com:TheFourFifths/consus-client.git","clone_url":"https://github.com/TheFourFifths/consus-client.git","svn_url":"https://github.com/TheFourFifths/consus-client","homepage":null,"size":394,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":2,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59"},"html":{"href":"https://github.com/TheFourFifths/consus-client/pull/59"},"issue":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/issues/59"},"comments":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/TheFourFifths/consus-client/statuses/9df9e8300bcd765aec22bd0355a1aa0cc532f8ee"}}}}
{"actor":{"display_login":"mattmahn"}}