{"action":"created","comment":{"url":"https://api.github.com/repos/serverless/serverless/pulls/comments/63692247","id":63692247,"diff_hunk":"@@ -0,0 +1,384 @@\n+'use strict';\n+\n+/**\n+ * Test: Service Class\n+ */\n+\n+const path = require('path');\n+const os = require('os');\n+const YAML = require('js-yaml');\n+const expect = require('chai').expect;\n+const Service = require('../../../lib/classes/Service');\n+const SError = require('../../../lib/classes/Error');\n+const Utils = require('../../../lib/classes/Utils');\n+const Serverless = require('../../../lib/Serverless');\n+\n+describe('Service', () => {\n+\n+  after((done) => {\n+    done();\n+  });\n+\n+  describe('#constructor()', () => {\n+    const S = new Serverless();\n+\n+    it('should attach serverless instance', () => {\n+      const serviceInstance = new Service(S);\n+      expect(typeof serviceInstance.S._version).to.be.equal('string');\n+    });\n+\n+    it('should construct with defaults', () => {\n+      const serviceInstance = new Service(S);\n+\n+      expect(serviceInstance.service).to.be.equal(null);\n+      expect(serviceInstance.custom).to.deep.equal({});\n+      expect(serviceInstance.plugins).to.deep.equal([]);\n+      expect(serviceInstance.functions).to.deep.equal({});\n+      expect(serviceInstance.environment).to.deep.equal({});\n+      expect(serviceInstance.resources.aws).to.deep.equal({});\n+      expect(serviceInstance.resources.azure).to.deep.equal({});\n+      expect(serviceInstance.resources.google).to.deep.equal({});\n+\n+    });\n+\n+    it('should construct with data', () => {\n+      const data = {\n+        service: 'testService',\n+        custom: {\n+          customProp: 'value'\n+        },\n+        plugins: ['testPlugin'],\n+        functions: {\n+          functionA: {}\n+        },\n+        resources: {\n+          aws: {\n+            resourcesProp: 'value'\n+          },\n+          azure: {},\n+          google: {}\n+        }\n+      };\n+\n+      const serviceInstance = new Service(S, data);\n+\n+      expect(serviceInstance.service).to.be.equal('testService');\n+      expect(serviceInstance.custom).to.deep.equal({ customProp: 'value' });\n+      expect(serviceInstance.plugins).to.deep.equal(['testPlugin']);\n+      expect(serviceInstance.functions).to.deep.equal({ functionA: {} });\n+      expect(serviceInstance.environment).to.deep.equal({});\n+      expect(serviceInstance.resources.aws).to.deep.equal({ resourcesProp: 'value' });\n+      expect(serviceInstance.resources.azure).to.deep.equal({});\n+      expect(serviceInstance.resources.google).to.deep.equal({});\n+    });\n+  });\n+\n+  describe('#load()', () => {\n+    let serviceInstance;\n+    before(() => {\n+      const SUtils = new Utils();\n+      const tmpDirPath = path.join(os.tmpdir(), (new Date).getTime().toString());\n+      const serverlessYaml = {\n+        service: 'testService',\n+        custom: {\n+          customProp: 'value'\n+        },\n+        plugins: ['testPlugin'],\n+        functions: {\n+          functionA: {}\n+        },\n+        resources: {\n+          aws: {\n+            resourcesProp: 'value'\n+          },\n+          azure: {},\n+          google: {}\n+        }\n+      };\n+      const serverlessEnvYaml = {\n+        vars: {\n+          varA: 'varA'\n+        },\n+        stages: {\n+          dev: {\n+            vars: {\n+              varB: 'varB'\n+            },\n+            regions: {\n+              aws_useast1: {\n+                vars: {\n+                  varC: 'varC'\n+                }\n+              }\n+            }\n+          }\n+        }\n+      };\n+\n+      SUtils.writeFileSync(path.join(tmpDirPath, 'serverless.yaml'), YAML.dump(serverlessYaml));","path":"tests/tests/classes/Service.js","position":118,"original_position":118,"commit_id":"3443efc468536a16d3b24f54893e95eed5c44c6e","original_commit_id":"3443efc468536a16d3b24f54893e95eed5c44c6e","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Line is too long.","created_at":"2016-05-18T12:19:57Z","updated_at":"2016-05-18T12:19:57Z","html_url":"https://github.com/serverless/serverless/pull/1127#discussion_r63692247","pull_request_url":"https://api.github.com/repos/serverless/serverless/pulls/1127","_links":{"self":{"href":"https://api.github.com/repos/serverless/serverless/pulls/comments/63692247"},"html":{"href":"https://github.com/serverless/serverless/pull/1127#discussion_r63692247"},"pull_request":{"href":"https://api.github.com/repos/serverless/serverless/pulls/1127"}}},"pull_request":{"url":"https://api.github.com/repos/serverless/serverless/pulls/1127","id":70383373,"html_url":"https://github.com/serverless/serverless/pull/1127","diff_url":"https://github.com/serverless/serverless/pull/1127.diff","patch_url":"https://github.com/serverless/serverless/pull/1127.patch","issue_url":"https://api.github.com/repos/serverless/serverless/issues/1127","number":1127,"state":"open","locked":false,"title":"basic service and config working","user":{"login":"eahefnawy","id":2312463,"avatar_url":"https://avatars.githubusercontent.com/u/2312463?v=3","gravatar_id":"","url":"https://api.github.com/users/eahefnawy","html_url":"https://github.com/eahefnawy","followers_url":"https://api.github.com/users/eahefnawy/followers","following_url":"https://api.github.com/users/eahefnawy/following{/other_user}","gists_url":"https://api.github.com/users/eahefnawy/gists{/gist_id}","starred_url":"https://api.github.com/users/eahefnawy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eahefnawy/subscriptions","organizations_url":"https://api.github.com/users/eahefnawy/orgs","repos_url":"https://api.github.com/users/eahefnawy/repos","events_url":"https://api.github.com/users/eahefnawy/events{/privacy}","received_events_url":"https://api.github.com/users/eahefnawy/received_events","type":"User","site_admin":false},"body":"- [x] loads serverless.yaml with tests\r\n- [x] loads serverless.env.yaml with test\r\n- [x] construct Service from defaults with tests\r\n- [x] construct Service from data with tests\r\n- [x] construct Service from filesystem with tests\r\n- [x] barebone Service methods\r\n- [x] construct Config class\r\n- [x] construct Serverless class and put everything together \r\n- [x] write the rest of the Service methods\r\n- [x] test the rest of the Service methods\r\n","created_at":"2016-05-17T15:58:47Z","updated_at":"2016-05-18T12:19:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0fcebe0f9c0152dfe91885d622d504725abd6451","assignee":{"login":"eahefnawy","id":2312463,"avatar_url":"https://avatars.githubusercontent.com/u/2312463?v=3","gravatar_id":"","url":"https://api.github.com/users/eahefnawy","html_url":"https://github.com/eahefnawy","followers_url":"https://api.github.com/users/eahefnawy/followers","following_url":"https://api.github.com/users/eahefnawy/following{/other_user}","gists_url":"https://api.github.com/users/eahefnawy/gists{/gist_id}","starred_url":"https://api.github.com/users/eahefnawy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eahefnawy/subscriptions","organizations_url":"https://api.github.com/users/eahefnawy/orgs","repos_url":"https://api.github.com/users/eahefnawy/repos","events_url":"https://api.github.com/users/eahefnawy/events{/privacy}","received_events_url":"https://api.github.com/users/eahefnawy/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/serverless/serverless/milestones/8","html_url":"https://github.com/serverless/serverless/milestones/1.0","labels_url":"https://api.github.com/repos/serverless/serverless/milestones/8/labels","id":1761859,"number":8,"title":"1.0","description":"","creator":{"login":"flomotlik","id":132653,"avatar_url":"https://avatars.githubusercontent.com/u/132653?v=3","gravatar_id":"","url":"https://api.github.com/users/flomotlik","html_url":"https://github.com/flomotlik","followers_url":"https://api.github.com/users/flomotlik/followers","following_url":"https://api.github.com/users/flomotlik/following{/other_user}","gists_url":"https://api.github.com/users/flomotlik/gists{/gist_id}","starred_url":"https://api.github.com/users/flomotlik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flomotlik/subscriptions","organizations_url":"https://api.github.com/users/flomotlik/orgs","repos_url":"https://api.github.com/users/flomotlik/repos","events_url":"https://api.github.com/users/flomotlik/events{/privacy}","received_events_url":"https://api.github.com/users/flomotlik/received_events","type":"User","site_admin":false},"open_issues":48,"closed_issues":5,"state":"open","created_at":"2016-05-12T08:39:40Z","updated_at":"2016-05-18T08:16:56Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/serverless/serverless/pulls/1127/commits","review_comments_url":"https://api.github.com/repos/serverless/serverless/pulls/1127/comments","review_comment_url":"https://api.github.com/repos/serverless/serverless/pulls/comments{/number}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/1127/comments","statuses_url":"https://api.github.com/repos/serverless/serverless/statuses/3443efc468536a16d3b24f54893e95eed5c44c6e","head":{"label":"serverless:service-config","ref":"service-config","sha":"3443efc468536a16d3b24f54893e95eed5c44c6e","user":{"login":"serverless","id":13742415,"avatar_url":"https://avatars.githubusercontent.com/u/13742415?v=3","gravatar_id":"","url":"https://api.github.com/users/serverless","html_url":"https://github.com/serverless","followers_url":"https://api.github.com/users/serverless/followers","following_url":"https://api.github.com/users/serverless/following{/other_user}","gists_url":"https://api.github.com/users/serverless/gists{/gist_id}","starred_url":"https://api.github.com/users/serverless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serverless/subscriptions","organizations_url":"https://api.github.com/users/serverless/orgs","repos_url":"https://api.github.com/users/serverless/repos","events_url":"https://api.github.com/users/serverless/events{/privacy}","received_events_url":"https://api.github.com/users/serverless/received_events","type":"Organization","site_admin":false},"repo":{"id":34302698,"name":"serverless","full_name":"serverless/serverless","owner":{"login":"serverless","id":13742415,"avatar_url":"https://avatars.githubusercontent.com/u/13742415?v=3","gravatar_id":"","url":"https://api.github.com/users/serverless","html_url":"https://github.com/serverless","followers_url":"https://api.github.com/users/serverless/followers","following_url":"https://api.github.com/users/serverless/following{/other_user}","gists_url":"https://api.github.com/users/serverless/gists{/gist_id}","starred_url":"https://api.github.com/users/serverless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serverless/subscriptions","organizations_url":"https://api.github.com/users/serverless/orgs","repos_url":"https://api.github.com/users/serverless/repos","events_url":"https://api.github.com/users/serverless/events{/privacy}","received_events_url":"https://api.github.com/users/serverless/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/serverless/serverless","description":"Serverless Framework – Build web, mobile and IoT applications with serverless architectures via AWS Lambda and API Gateway (formerly known as JAWS) – ","fork":false,"url":"https://api.github.com/repos/serverless/serverless","forks_url":"https://api.github.com/repos/serverless/serverless/forks","keys_url":"https://api.github.com/repos/serverless/serverless/keys{/key_id}","collaborators_url":"https://api.github.com/repos/serverless/serverless/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/serverless/serverless/teams","hooks_url":"https://api.github.com/repos/serverless/serverless/hooks","issue_events_url":"https://api.github.com/repos/serverless/serverless/issues/events{/number}","events_url":"https://api.github.com/repos/serverless/serverless/events","assignees_url":"https://api.github.com/repos/serverless/serverless/assignees{/user}","branches_url":"https://api.github.com/repos/serverless/serverless/branches{/branch}","tags_url":"https://api.github.com/repos/serverless/serverless/tags","blobs_url":"https://api.github.com/repos/serverless/serverless/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/serverless/serverless/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/serverless/serverless/git/refs{/sha}","trees_url":"https://api.github.com/repos/serverless/serverless/git/trees{/sha}","statuses_url":"https://api.github.com/repos/serverless/serverless/statuses/{sha}","languages_url":"https://api.github.com/repos/serverless/serverless/languages","stargazers_url":"https://api.github.com/repos/serverless/serverless/stargazers","contributors_url":"https://api.github.com/repos/serverless/serverless/contributors","subscribers_url":"https://api.github.com/repos/serverless/serverless/subscribers","subscription_url":"https://api.github.com/repos/serverless/serverless/subscription","commits_url":"https://api.github.com/repos/serverless/serverless/commits{/sha}","git_commits_url":"https://api.github.com/repos/serverless/serverless/git/commits{/sha}","comments_url":"https://api.github.com/repos/serverless/serverless/comments{/number}","issue_comment_url":"https://api.github.com/repos/serverless/serverless/issues/comments{/number}","contents_url":"https://api.github.com/repos/serverless/serverless/contents/{+path}","compare_url":"https://api.github.com/repos/serverless/serverless/compare/{base}...{head}","merges_url":"https://api.github.com/repos/serverless/serverless/merges","archive_url":"https://api.github.com/repos/serverless/serverless/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/serverless/serverless/downloads","issues_url":"https://api.github.com/repos/serverless/serverless/issues{/number}","pulls_url":"https://api.github.com/repos/serverless/serverless/pulls{/number}","milestones_url":"https://api.github.com/repos/serverless/serverless/milestones{/number}","notifications_url":"https://api.github.com/repos/serverless/serverless/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/serverless/serverless/labels{/name}","releases_url":"https://api.github.com/repos/serverless/serverless/releases{/id}","deployments_url":"https://api.github.com/repos/serverless/serverless/deployments","created_at":"2015-04-21T03:48:40Z","updated_at":"2016-05-18T11:16:23Z","pushed_at":"2016-05-18T12:19:40Z","git_url":"git://github.com/serverless/serverless.git","ssh_url":"git@github.com:serverless/serverless.git","clone_url":"https://github.com/serverless/serverless.git","svn_url":"https://github.com/serverless/serverless","homepage":"http://www.serverless.com","size":29889,"stargazers_count":8254,"watchers_count":8254,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":491,"mirror_url":null,"open_issues_count":106,"forks":491,"open_issues":106,"watchers":8254,"default_branch":"master"}},"base":{"label":"serverless:dev","ref":"dev","sha":"07fbae51c19b75b48091bbac63030ecac1dc4fa4","user":{"login":"serverless","id":13742415,"avatar_url":"https://avatars.githubusercontent.com/u/13742415?v=3","gravatar_id":"","url":"https://api.github.com/users/serverless","html_url":"https://github.com/serverless","followers_url":"https://api.github.com/users/serverless/followers","following_url":"https://api.github.com/users/serverless/following{/other_user}","gists_url":"https://api.github.com/users/serverless/gists{/gist_id}","starred_url":"https://api.github.com/users/serverless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serverless/subscriptions","organizations_url":"https://api.github.com/users/serverless/orgs","repos_url":"https://api.github.com/users/serverless/repos","events_url":"https://api.github.com/users/serverless/events{/privacy}","received_events_url":"https://api.github.com/users/serverless/received_events","type":"Organization","site_admin":false},"repo":{"id":34302698,"name":"serverless","full_name":"serverless/serverless","owner":{"login":"serverless","id":13742415,"avatar_url":"https://avatars.githubusercontent.com/u/13742415?v=3","gravatar_id":"","url":"https://api.github.com/users/serverless","html_url":"https://github.com/serverless","followers_url":"https://api.github.com/users/serverless/followers","following_url":"https://api.github.com/users/serverless/following{/other_user}","gists_url":"https://api.github.com/users/serverless/gists{/gist_id}","starred_url":"https://api.github.com/users/serverless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serverless/subscriptions","organizations_url":"https://api.github.com/users/serverless/orgs","repos_url":"https://api.github.com/users/serverless/repos","events_url":"https://api.github.com/users/serverless/events{/privacy}","received_events_url":"https://api.github.com/users/serverless/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/serverless/serverless","description":"Serverless Framework – Build web, mobile and IoT applications with serverless architectures via AWS Lambda and API Gateway (formerly known as JAWS) – ","fork":false,"url":"https://api.github.com/repos/serverless/serverless","forks_url":"https://api.github.com/repos/serverless/serverless/forks","keys_url":"https://api.github.com/repos/serverless/serverless/keys{/key_id}","collaborators_url":"https://api.github.com/repos/serverless/serverless/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/serverless/serverless/teams","hooks_url":"https://api.github.com/repos/serverless/serverless/hooks","issue_events_url":"https://api.github.com/repos/serverless/serverless/issues/events{/number}","events_url":"https://api.github.com/repos/serverless/serverless/events","assignees_url":"https://api.github.com/repos/serverless/serverless/assignees{/user}","branches_url":"https://api.github.com/repos/serverless/serverless/branches{/branch}","tags_url":"https://api.github.com/repos/serverless/serverless/tags","blobs_url":"https://api.github.com/repos/serverless/serverless/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/serverless/serverless/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/serverless/serverless/git/refs{/sha}","trees_url":"https://api.github.com/repos/serverless/serverless/git/trees{/sha}","statuses_url":"https://api.github.com/repos/serverless/serverless/statuses/{sha}","languages_url":"https://api.github.com/repos/serverless/serverless/languages","stargazers_url":"https://api.github.com/repos/serverless/serverless/stargazers","contributors_url":"https://api.github.com/repos/serverless/serverless/contributors","subscribers_url":"https://api.github.com/repos/serverless/serverless/subscribers","subscription_url":"https://api.github.com/repos/serverless/serverless/subscription","commits_url":"https://api.github.com/repos/serverless/serverless/commits{/sha}","git_commits_url":"https://api.github.com/repos/serverless/serverless/git/commits{/sha}","comments_url":"https://api.github.com/repos/serverless/serverless/comments{/number}","issue_comment_url":"https://api.github.com/repos/serverless/serverless/issues/comments{/number}","contents_url":"https://api.github.com/repos/serverless/serverless/contents/{+path}","compare_url":"https://api.github.com/repos/serverless/serverless/compare/{base}...{head}","merges_url":"https://api.github.com/repos/serverless/serverless/merges","archive_url":"https://api.github.com/repos/serverless/serverless/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/serverless/serverless/downloads","issues_url":"https://api.github.com/repos/serverless/serverless/issues{/number}","pulls_url":"https://api.github.com/repos/serverless/serverless/pulls{/number}","milestones_url":"https://api.github.com/repos/serverless/serverless/milestones{/number}","notifications_url":"https://api.github.com/repos/serverless/serverless/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/serverless/serverless/labels{/name}","releases_url":"https://api.github.com/repos/serverless/serverless/releases{/id}","deployments_url":"https://api.github.com/repos/serverless/serverless/deployments","created_at":"2015-04-21T03:48:40Z","updated_at":"2016-05-18T11:16:23Z","pushed_at":"2016-05-18T12:19:40Z","git_url":"git://github.com/serverless/serverless.git","ssh_url":"git@github.com:serverless/serverless.git","clone_url":"https://github.com/serverless/serverless.git","svn_url":"https://github.com/serverless/serverless","homepage":"http://www.serverless.com","size":29889,"stargazers_count":8254,"watchers_count":8254,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":491,"mirror_url":null,"open_issues_count":106,"forks":491,"open_issues":106,"watchers":8254,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/serverless/serverless/pulls/1127"},"html":{"href":"https://github.com/serverless/serverless/pull/1127"},"issue":{"href":"https://api.github.com/repos/serverless/serverless/issues/1127"},"comments":{"href":"https://api.github.com/repos/serverless/serverless/issues/1127/comments"},"review_comments":{"href":"https://api.github.com/repos/serverless/serverless/pulls/1127/comments"},"review_comment":{"href":"https://api.github.com/repos/serverless/serverless/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/serverless/serverless/pulls/1127/commits"},"statuses":{"href":"https://api.github.com/repos/serverless/serverless/statuses/3443efc468536a16d3b24f54893e95eed5c44c6e"}}}}