{"action":"created","comment":{"url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/comments/221684166","pull_request_review_id":160391426,"id":221684166,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTY4NDE2Ng==","diff_hunk":"@@ -0,0 +1,285 @@\n+---\n+layout: post\n+title: \"Mocking SOAP APIs in functional tests using Nock\"\n+date: 2018-10-02 12:00:00 -0800\n+cover: /assets/images/headers/using-nock.jpg\n+excerpt: This post explains why and how to mock the external REST and SOAP\n+  APIs in the functional tests of a service written in NodeJS to have a more\n+  robust CICD. In this post, We will write a simple functional tests and mock\n+  the external API using `nock` node module.\n+authors:\n+  - name: Deepti Agrawal\n+    url: https://www.linkedin.com/in/adeepti10/\n+    photo: /assets/images/dagrawal.jpg\n+---\n+\n+I work on writing services using `Node.js` on a customer experience team at\n+GoDaddy. These services use data from different products across GoDaddy to\n+provide personalized customer data to the client teams. To collect these data,\n+we call different GoDaddy wide services. And this is where the real complication\n+comes in. Since we don't have control of these services, some of them are still\n+legacy. And by legacy here I mean SOAP services as well. Yes, you read it right.\n+[SOAP services](https://en.wikipedia.org/wiki/SOAP).\n+\n+We initially started writing our functional tests using real data. But then the\n+functional tests became unreliable.\n+\n+Here are the reasons why:\n+1. The dependent services were slow.\n+1. The dependent services were flaky.\n+1. Covering corner cases with real test data is challenging. An example: Your\n+   service has a special handling for data returned by external service which\n+   contains products having last day of their free trial.\n+\n+Using real data became more of a pain for our CICD process. It also made our\n+CICD process slow and flaky.\n+\n+This is when we spent time looking at different options to fix the test\n+flakiness. One of the approach was to avoid calling the dependent services in\n+our functional tests. During investigation of this approach, we came across\n+[Nock](https://github.com/nock/nock).\n+\n+## What is Nock?\n+\n+Nock is an HTTP server mocking library for Node.js applications.\n+\n+Nock intercepts HTTP request made using Node's `http.request` or\n+`http.ClientRequest` modules and responds with the expected/mocked status code\n+and response.\n+\n+## Nock setup\n+\n+Using Nock is simple. Run below command on terminal.","path":"_posts/2018-10-02-mocking-soap-apis-in-functional-tests-using-nock.md","position":52,"original_position":52,"commit_id":"717112a4f3fa066caf329469ba2759e05de3ea9d","original_commit_id":"717112a4f3fa066caf329469ba2759e05de3ea9d","user":{"login":"silasbw","id":1919311,"node_id":"MDQ6VXNlcjE5MTkzMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/1919311?v=4","gravatar_id":"","url":"https://api.github.com/users/silasbw","html_url":"https://github.com/silasbw","followers_url":"https://api.github.com/users/silasbw/followers","following_url":"https://api.github.com/users/silasbw/following{/other_user}","gists_url":"https://api.github.com/users/silasbw/gists{/gist_id}","starred_url":"https://api.github.com/users/silasbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silasbw/subscriptions","organizations_url":"https://api.github.com/users/silasbw/orgs","repos_url":"https://api.github.com/users/silasbw/repos","events_url":"https://api.github.com/users/silasbw/events{/privacy}","received_events_url":"https://api.github.com/users/silasbw/received_events","type":"User","site_admin":false},"body":"You're explaining how to install Nock here, not use it.\r\n\r\n\"Install Nock by running:\"","created_at":"2018-10-01T17:02:59Z","updated_at":"2018-10-01T17:04:43Z","html_url":"https://github.com/godaddy/godaddy.github.io/pull/78#discussion_r221684166","pull_request_url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/comments/221684166"},"html":{"href":"https://github.com/godaddy/godaddy.github.io/pull/78#discussion_r221684166"},"pull_request":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78","id":218479894,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NDc5ODk0","html_url":"https://github.com/godaddy/godaddy.github.io/pull/78","diff_url":"https://github.com/godaddy/godaddy.github.io/pull/78.diff","patch_url":"https://github.com/godaddy/godaddy.github.io/pull/78.patch","issue_url":"https://api.github.com/repos/godaddy/godaddy.github.io/issues/78","number":78,"state":"closed","locked":false,"title":"feat(post): mocking soap services using nock","user":{"login":"deeptiagrawa","id":10557763,"node_id":"MDQ6VXNlcjEwNTU3NzYz","avatar_url":"https://avatars2.githubusercontent.com/u/10557763?v=4","gravatar_id":"","url":"https://api.github.com/users/deeptiagrawa","html_url":"https://github.com/deeptiagrawa","followers_url":"https://api.github.com/users/deeptiagrawa/followers","following_url":"https://api.github.com/users/deeptiagrawa/following{/other_user}","gists_url":"https://api.github.com/users/deeptiagrawa/gists{/gist_id}","starred_url":"https://api.github.com/users/deeptiagrawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deeptiagrawa/subscriptions","organizations_url":"https://api.github.com/users/deeptiagrawa/orgs","repos_url":"https://api.github.com/users/deeptiagrawa/repos","events_url":"https://api.github.com/users/deeptiagrawa/events{/privacy}","received_events_url":"https://api.github.com/users/deeptiagrawa/received_events","type":"User","site_admin":false},"body":"Cover page:\r\n![image](https://user-images.githubusercontent.com/10557763/46114062-dad5a800-c1a5-11e8-91d8-f3d7fb66bd6a.png)\r\n\r\nArticle:\r\n![image](https://user-images.githubusercontent.com/10557763/46114072-eb861e00-c1a5-11e8-8464-db4347ec7acd.png)\r\n\r\n","created_at":"2018-09-26T23:05:45Z","updated_at":"2018-10-01T17:04:43Z","closed_at":"2018-10-01T16:59:34Z","merged_at":"2018-10-01T16:59:34Z","merge_commit_sha":"8dd00b983046a18b193c75b83914808044aef9cd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78/commits","review_comments_url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78/comments","review_comment_url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/godaddy/godaddy.github.io/issues/78/comments","statuses_url":"https://api.github.com/repos/godaddy/godaddy.github.io/statuses/717112a4f3fa066caf329469ba2759e05de3ea9d","head":{"label":"deeptiagrawa:nock","ref":"nock","sha":"717112a4f3fa066caf329469ba2759e05de3ea9d","user":{"login":"deeptiagrawa","id":10557763,"node_id":"MDQ6VXNlcjEwNTU3NzYz","avatar_url":"https://avatars2.githubusercontent.com/u/10557763?v=4","gravatar_id":"","url":"https://api.github.com/users/deeptiagrawa","html_url":"https://github.com/deeptiagrawa","followers_url":"https://api.github.com/users/deeptiagrawa/followers","following_url":"https://api.github.com/users/deeptiagrawa/following{/other_user}","gists_url":"https://api.github.com/users/deeptiagrawa/gists{/gist_id}","starred_url":"https://api.github.com/users/deeptiagrawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deeptiagrawa/subscriptions","organizations_url":"https://api.github.com/users/deeptiagrawa/orgs","repos_url":"https://api.github.com/users/deeptiagrawa/repos","events_url":"https://api.github.com/users/deeptiagrawa/events{/privacy}","received_events_url":"https://api.github.com/users/deeptiagrawa/received_events","type":"User","site_admin":false},"repo":{"id":150494440,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA0OTQ0NDA=","name":"godaddy.github.io","full_name":"deeptiagrawa/godaddy.github.io","private":false,"owner":{"login":"deeptiagrawa","id":10557763,"node_id":"MDQ6VXNlcjEwNTU3NzYz","avatar_url":"https://avatars2.githubusercontent.com/u/10557763?v=4","gravatar_id":"","url":"https://api.github.com/users/deeptiagrawa","html_url":"https://github.com/deeptiagrawa","followers_url":"https://api.github.com/users/deeptiagrawa/followers","following_url":"https://api.github.com/users/deeptiagrawa/following{/other_user}","gists_url":"https://api.github.com/users/deeptiagrawa/gists{/gist_id}","starred_url":"https://api.github.com/users/deeptiagrawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deeptiagrawa/subscriptions","organizations_url":"https://api.github.com/users/deeptiagrawa/orgs","repos_url":"https://api.github.com/users/deeptiagrawa/repos","events_url":"https://api.github.com/users/deeptiagrawa/events{/privacy}","received_events_url":"https://api.github.com/users/deeptiagrawa/received_events","type":"User","site_admin":false},"html_url":"https://github.com/deeptiagrawa/godaddy.github.io","description":"Jekyll website and blog showcasing open source projects by GoDaddy employees","fork":true,"url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io","forks_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/forks","keys_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/teams","hooks_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/hooks","issue_events_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/events","assignees_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/tags","blobs_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/languages","stargazers_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/stargazers","contributors_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/contributors","subscribers_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/subscribers","subscription_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/subscription","commits_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/merges","archive_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/downloads","issues_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/labels{/name}","releases_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/deeptiagrawa/godaddy.github.io/deployments","created_at":"2018-09-26T21:52:11Z","updated_at":"2018-09-26T21:52:13Z","pushed_at":"2018-09-26T23:03:21Z","git_url":"git://github.com/deeptiagrawa/godaddy.github.io.git","ssh_url":"git@github.com:deeptiagrawa/godaddy.github.io.git","clone_url":"https://github.com/deeptiagrawa/godaddy.github.io.git","svn_url":"https://github.com/deeptiagrawa/godaddy.github.io","homepage":"https://godaddy.github.io","size":16055,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"godaddy:master","ref":"master","sha":"3260c03c831f081eccfe64212174d51d44e23cae","user":{"login":"godaddy","id":1406546,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MDY1NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/1406546?v=4","gravatar_id":"","url":"https://api.github.com/users/godaddy","html_url":"https://github.com/godaddy","followers_url":"https://api.github.com/users/godaddy/followers","following_url":"https://api.github.com/users/godaddy/following{/other_user}","gists_url":"https://api.github.com/users/godaddy/gists{/gist_id}","starred_url":"https://api.github.com/users/godaddy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godaddy/subscriptions","organizations_url":"https://api.github.com/users/godaddy/orgs","repos_url":"https://api.github.com/users/godaddy/repos","events_url":"https://api.github.com/users/godaddy/events{/privacy}","received_events_url":"https://api.github.com/users/godaddy/received_events","type":"Organization","site_admin":false},"repo":{"id":29800005,"node_id":"MDEwOlJlcG9zaXRvcnkyOTgwMDAwNQ==","name":"godaddy.github.io","full_name":"godaddy/godaddy.github.io","private":false,"owner":{"login":"godaddy","id":1406546,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MDY1NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/1406546?v=4","gravatar_id":"","url":"https://api.github.com/users/godaddy","html_url":"https://github.com/godaddy","followers_url":"https://api.github.com/users/godaddy/followers","following_url":"https://api.github.com/users/godaddy/following{/other_user}","gists_url":"https://api.github.com/users/godaddy/gists{/gist_id}","starred_url":"https://api.github.com/users/godaddy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godaddy/subscriptions","organizations_url":"https://api.github.com/users/godaddy/orgs","repos_url":"https://api.github.com/users/godaddy/repos","events_url":"https://api.github.com/users/godaddy/events{/privacy}","received_events_url":"https://api.github.com/users/godaddy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/godaddy/godaddy.github.io","description":"Jekyll website and blog showcasing open source projects by GoDaddy employees","fork":false,"url":"https://api.github.com/repos/godaddy/godaddy.github.io","forks_url":"https://api.github.com/repos/godaddy/godaddy.github.io/forks","keys_url":"https://api.github.com/repos/godaddy/godaddy.github.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/godaddy/godaddy.github.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/godaddy/godaddy.github.io/teams","hooks_url":"https://api.github.com/repos/godaddy/godaddy.github.io/hooks","issue_events_url":"https://api.github.com/repos/godaddy/godaddy.github.io/issues/events{/number}","events_url":"https://api.github.com/repos/godaddy/godaddy.github.io/events","assignees_url":"https://api.github.com/repos/godaddy/godaddy.github.io/assignees{/user}","branches_url":"https://api.github.com/repos/godaddy/godaddy.github.io/branches{/branch}","tags_url":"https://api.github.com/repos/godaddy/godaddy.github.io/tags","blobs_url":"https://api.github.com/repos/godaddy/godaddy.github.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/godaddy/godaddy.github.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/godaddy/godaddy.github.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/godaddy/godaddy.github.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/godaddy/godaddy.github.io/statuses/{sha}","languages_url":"https://api.github.com/repos/godaddy/godaddy.github.io/languages","stargazers_url":"https://api.github.com/repos/godaddy/godaddy.github.io/stargazers","contributors_url":"https://api.github.com/repos/godaddy/godaddy.github.io/contributors","subscribers_url":"https://api.github.com/repos/godaddy/godaddy.github.io/subscribers","subscription_url":"https://api.github.com/repos/godaddy/godaddy.github.io/subscription","commits_url":"https://api.github.com/repos/godaddy/godaddy.github.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/godaddy/godaddy.github.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/godaddy/godaddy.github.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/godaddy/godaddy.github.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/godaddy/godaddy.github.io/contents/{+path}","compare_url":"https://api.github.com/repos/godaddy/godaddy.github.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/godaddy/godaddy.github.io/merges","archive_url":"https://api.github.com/repos/godaddy/godaddy.github.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/godaddy/godaddy.github.io/downloads","issues_url":"https://api.github.com/repos/godaddy/godaddy.github.io/issues{/number}","pulls_url":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls{/number}","milestones_url":"https://api.github.com/repos/godaddy/godaddy.github.io/milestones{/number}","notifications_url":"https://api.github.com/repos/godaddy/godaddy.github.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/godaddy/godaddy.github.io/labels{/name}","releases_url":"https://api.github.com/repos/godaddy/godaddy.github.io/releases{/id}","deployments_url":"https://api.github.com/repos/godaddy/godaddy.github.io/deployments","created_at":"2015-01-25T02:35:31Z","updated_at":"2018-10-01T16:59:36Z","pushed_at":"2018-10-01T16:59:35Z","git_url":"git://github.com/godaddy/godaddy.github.io.git","ssh_url":"git@github.com:godaddy/godaddy.github.io.git","clone_url":"https://github.com/godaddy/godaddy.github.io.git","svn_url":"https://github.com/godaddy/godaddy.github.io","homepage":"https://godaddy.github.io","size":15020,"stargazers_count":5,"watchers_count":5,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":13,"open_issues":4,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78"},"html":{"href":"https://github.com/godaddy/godaddy.github.io/pull/78"},"issue":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/issues/78"},"comments":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/godaddy/godaddy.github.io/statuses/717112a4f3fa066caf329469ba2759e05de3ea9d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"silasbw"}}