{"action":"created","comment":{"url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/comments/83622975","pull_request_review_id":4451986,"id":83622975,"diff_hunk":"@@ -0,0 +1,162 @@\n+import com.getbase.Client\n+import com.getbase.Configuration\n+import com.getbase.models.Contact\n+import com.getbase.models.Deal\n+import com.getbase.models.Stage\n+import com.getbase.models.User\n+import com.getbase.services.ContactsService\n+import com.getbase.services.DealsService\n+import com.getbase.services.StagesService\n+import groovy.util.logging.Slf4j\n+import org.joda.time.format.DateTimeFormat\n+import org.joda.time.format.DateTimeFormatter\n+import spock.lang.Requires\n+import spock.lang.Shared\n+import spock.lang.Specification\n+\n+import static org.awaitility.Awaitility.await\n+\n+/**\n+ * Created by przemek on 06.10.2016.\n+ */\n+\n+@Slf4j\n+@Requires({ System.getProperty(\"integrationTests\").equals(\"true\") })\n+class BusinessScenariosTests extends Specification {\n+\n+    @Shared\n+    def client\n+\n+    @Shared\n+    User userSalesRep, userAccManager\n+\n+    @Shared\n+    Contact createdContact\n+\n+    @Shared\n+    String personContactName = 'person assigned to a manager'\n+\n+    def setupSpec() {\n+        client = new Client(new Configuration.Builder()\n+                .accessToken(System.getProperty(\"BASECRM_ACCESS_TOKEN\"))\n+                .build())\n+\n+        userSalesRep = client\n+                .users()\n+                .get(convertUserId(System.getProperty(\"userSalesRep\")))\n+\n+        userAccManager = client\n+                .users()\n+                .get(convertUserId(System.getProperty(\"userAccManager\")))\n+\n+        def testContactName = 'Foo Contact'\n+\n+        assert client\n+                .contacts()\n+                .list(new ContactsService.SearchCriteria().name(testContactName))\n+                .size() == 0\n+\n+        createdContact = client.contacts().create(new Contact(name: testContactName, ownerId: userSalesRep.id, isOrganization: true))\n+        await().until {\n+            client\n+                    .contacts()\n+                    .list(new ContactsService.SearchCriteria().name(createdContact.name))\n+                    .size() == 1\n+        }\n+    }\n+\n+    def convertUserId(String userId) {\n+        assert userId\n+        return new Long(userId)\n+    }\n+\n+    def cleanupSpec() {\n+        client\n+                .deals()\n+                .list(new DealsService.SearchCriteria().contactId((Long) createdContact.id))*.id\n+                .each {\n+            id ->\n+                println(id)\n+                client.deals().delete(id)\n+        }\n+\n+        await().until {\n+            client\n+                    .deals()\n+                    .list(new DealsService.SearchCriteria().contactId((Long) createdContact.id))\n+                    .size() == 0\n+        }\n+\n+        client\n+                .contacts()\n+                .delete(createdContact.id)\n+\n+\n+        Contact tempContact = client\n+                .contacts()\n+                .list(new ContactsService.SearchCriteria().name((String) personContactName))[0]\n+\n+        if (null != tempContact) {\n+            client\n+                    .contacts()\n+                    .delete(tempContact.id)\n+        }\n+    }\n+\n+    def getDealsStageCategory(long dealStageId, boolean active) {\n+        Optional<Stage> result = client.stages()\n+                .list(new StagesService.SearchCriteria().active(active))\n+                .stream()\n+                .filter { stage -> stage.getId().equals(dealStageId) }\n+                .findAny();\n+\n+        assert result.present\n+        result.get().category\n+    }\n+\n+    def \"new deal in incoming stage should be created automatically when new contact organization is assigned to a sales rep\"() {","path":"src/test/groovy/BusinessScenariosTests.groovy","position":117,"original_position":117,"commit_id":"c76ef17db6f9c76c56d77b96dbe850b165a9e2eb","original_commit_id":"c76ef17db6f9c76c56d77b96dbe850b165a9e2eb","user":{"login":"villeu-solidbrain","id":18442831,"avatar_url":"https://avatars.githubusercontent.com/u/18442831?v=3","gravatar_id":"","url":"https://api.github.com/users/villeu-solidbrain","html_url":"https://github.com/villeu-solidbrain","followers_url":"https://api.github.com/users/villeu-solidbrain/followers","following_url":"https://api.github.com/users/villeu-solidbrain/following{/other_user}","gists_url":"https://api.github.com/users/villeu-solidbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/villeu-solidbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/villeu-solidbrain/subscriptions","organizations_url":"https://api.github.com/users/villeu-solidbrain/orgs","repos_url":"https://api.github.com/users/villeu-solidbrain/repos","events_url":"https://api.github.com/users/villeu-solidbrain/events{/privacy}","received_events_url":"https://api.github.com/users/villeu-solidbrain/received_events","type":"User","site_admin":false},"body":"you don't seem to have any action triggering workflow to run -> it should be here in test case, not in setupSpec ","created_at":"2016-10-17T11:20:30Z","updated_at":"2016-10-17T11:20:30Z","html_url":"https://github.com/PrzemekWisniewski/baseapp/pull/1#discussion_r83622975","pull_request_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/comments/83622975"},"html":{"href":"https://github.com/PrzemekWisniewski/baseapp/pull/1#discussion_r83622975"},"pull_request":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1","id":89591131,"html_url":"https://github.com/PrzemekWisniewski/baseapp/pull/1","diff_url":"https://github.com/PrzemekWisniewski/baseapp/pull/1.diff","patch_url":"https://github.com/PrzemekWisniewski/baseapp/pull/1.patch","issue_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/1","number":1,"state":"open","locked":false,"title":"tests","user":{"login":"PrzemekWisniewski","id":22611428,"avatar_url":"https://avatars.githubusercontent.com/u/22611428?v=3","gravatar_id":"","url":"https://api.github.com/users/PrzemekWisniewski","html_url":"https://github.com/PrzemekWisniewski","followers_url":"https://api.github.com/users/PrzemekWisniewski/followers","following_url":"https://api.github.com/users/PrzemekWisniewski/following{/other_user}","gists_url":"https://api.github.com/users/PrzemekWisniewski/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemekWisniewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemekWisniewski/subscriptions","organizations_url":"https://api.github.com/users/PrzemekWisniewski/orgs","repos_url":"https://api.github.com/users/PrzemekWisniewski/repos","events_url":"https://api.github.com/users/PrzemekWisniewski/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemekWisniewski/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-17T09:45:50Z","updated_at":"2016-10-17T11:22:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be49a3619a221c8c66e0a4e8797361e99c540fe3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1/commits","review_comments_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1/comments","review_comment_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/1/comments","statuses_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/statuses/c76ef17db6f9c76c56d77b96dbe850b165a9e2eb","head":{"label":"PrzemekWisniewski:tests","ref":"tests","sha":"c76ef17db6f9c76c56d77b96dbe850b165a9e2eb","user":{"login":"PrzemekWisniewski","id":22611428,"avatar_url":"https://avatars.githubusercontent.com/u/22611428?v=3","gravatar_id":"","url":"https://api.github.com/users/PrzemekWisniewski","html_url":"https://github.com/PrzemekWisniewski","followers_url":"https://api.github.com/users/PrzemekWisniewski/followers","following_url":"https://api.github.com/users/PrzemekWisniewski/following{/other_user}","gists_url":"https://api.github.com/users/PrzemekWisniewski/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemekWisniewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemekWisniewski/subscriptions","organizations_url":"https://api.github.com/users/PrzemekWisniewski/orgs","repos_url":"https://api.github.com/users/PrzemekWisniewski/repos","events_url":"https://api.github.com/users/PrzemekWisniewski/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemekWisniewski/received_events","type":"User","site_admin":false},"repo":{"id":71119291,"name":"baseapp","full_name":"PrzemekWisniewski/baseapp","owner":{"login":"PrzemekWisniewski","id":22611428,"avatar_url":"https://avatars.githubusercontent.com/u/22611428?v=3","gravatar_id":"","url":"https://api.github.com/users/PrzemekWisniewski","html_url":"https://github.com/PrzemekWisniewski","followers_url":"https://api.github.com/users/PrzemekWisniewski/followers","following_url":"https://api.github.com/users/PrzemekWisniewski/following{/other_user}","gists_url":"https://api.github.com/users/PrzemekWisniewski/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemekWisniewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemekWisniewski/subscriptions","organizations_url":"https://api.github.com/users/PrzemekWisniewski/orgs","repos_url":"https://api.github.com/users/PrzemekWisniewski/repos","events_url":"https://api.github.com/users/PrzemekWisniewski/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemekWisniewski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PrzemekWisniewski/baseapp","description":null,"fork":false,"url":"https://api.github.com/repos/PrzemekWisniewski/baseapp","forks_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/forks","keys_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/teams","hooks_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/hooks","issue_events_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/events{/number}","events_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/events","assignees_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/assignees{/user}","branches_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/branches{/branch}","tags_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/tags","blobs_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/statuses/{sha}","languages_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/languages","stargazers_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/stargazers","contributors_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/contributors","subscribers_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/subscribers","subscription_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/subscription","commits_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/contents/{+path}","compare_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/merges","archive_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/downloads","issues_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues{/number}","pulls_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls{/number}","milestones_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/milestones{/number}","notifications_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/labels{/name}","releases_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/releases{/id}","deployments_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/deployments","created_at":"2016-10-17T09:01:52Z","updated_at":"2016-10-17T09:43:08Z","pushed_at":"2016-10-17T09:45:50Z","git_url":"git://github.com/PrzemekWisniewski/baseapp.git","ssh_url":"git@github.com:PrzemekWisniewski/baseapp.git","clone_url":"https://github.com/PrzemekWisniewski/baseapp.git","svn_url":"https://github.com/PrzemekWisniewski/baseapp","homepage":null,"size":53,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"PrzemekWisniewski:master","ref":"master","sha":"83689a1465581f23e4d05a1614421d238ea66fec","user":{"login":"PrzemekWisniewski","id":22611428,"avatar_url":"https://avatars.githubusercontent.com/u/22611428?v=3","gravatar_id":"","url":"https://api.github.com/users/PrzemekWisniewski","html_url":"https://github.com/PrzemekWisniewski","followers_url":"https://api.github.com/users/PrzemekWisniewski/followers","following_url":"https://api.github.com/users/PrzemekWisniewski/following{/other_user}","gists_url":"https://api.github.com/users/PrzemekWisniewski/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemekWisniewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemekWisniewski/subscriptions","organizations_url":"https://api.github.com/users/PrzemekWisniewski/orgs","repos_url":"https://api.github.com/users/PrzemekWisniewski/repos","events_url":"https://api.github.com/users/PrzemekWisniewski/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemekWisniewski/received_events","type":"User","site_admin":false},"repo":{"id":71119291,"name":"baseapp","full_name":"PrzemekWisniewski/baseapp","owner":{"login":"PrzemekWisniewski","id":22611428,"avatar_url":"https://avatars.githubusercontent.com/u/22611428?v=3","gravatar_id":"","url":"https://api.github.com/users/PrzemekWisniewski","html_url":"https://github.com/PrzemekWisniewski","followers_url":"https://api.github.com/users/PrzemekWisniewski/followers","following_url":"https://api.github.com/users/PrzemekWisniewski/following{/other_user}","gists_url":"https://api.github.com/users/PrzemekWisniewski/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemekWisniewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemekWisniewski/subscriptions","organizations_url":"https://api.github.com/users/PrzemekWisniewski/orgs","repos_url":"https://api.github.com/users/PrzemekWisniewski/repos","events_url":"https://api.github.com/users/PrzemekWisniewski/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemekWisniewski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PrzemekWisniewski/baseapp","description":null,"fork":false,"url":"https://api.github.com/repos/PrzemekWisniewski/baseapp","forks_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/forks","keys_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/teams","hooks_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/hooks","issue_events_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/events{/number}","events_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/events","assignees_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/assignees{/user}","branches_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/branches{/branch}","tags_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/tags","blobs_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/refs{/sha}","trees_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/statuses/{sha}","languages_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/languages","stargazers_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/stargazers","contributors_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/contributors","subscribers_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/subscribers","subscription_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/subscription","commits_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/commits{/sha}","git_commits_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/git/commits{/sha}","comments_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/comments{/number}","issue_comment_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/comments{/number}","contents_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/contents/{+path}","compare_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/merges","archive_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/downloads","issues_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues{/number}","pulls_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls{/number}","milestones_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/milestones{/number}","notifications_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/labels{/name}","releases_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/releases{/id}","deployments_url":"https://api.github.com/repos/PrzemekWisniewski/baseapp/deployments","created_at":"2016-10-17T09:01:52Z","updated_at":"2016-10-17T09:43:08Z","pushed_at":"2016-10-17T09:45:50Z","git_url":"git://github.com/PrzemekWisniewski/baseapp.git","ssh_url":"git@github.com:PrzemekWisniewski/baseapp.git","clone_url":"https://github.com/PrzemekWisniewski/baseapp.git","svn_url":"https://github.com/PrzemekWisniewski/baseapp","homepage":null,"size":53,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1"},"html":{"href":"https://github.com/PrzemekWisniewski/baseapp/pull/1"},"issue":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/1"},"comments":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/PrzemekWisniewski/baseapp/statuses/c76ef17db6f9c76c56d77b96dbe850b165a9e2eb"}}}}
{"actor":{"display_login":"villeu-solidbrain"}}