{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/quark/pulls/comments/67344094","id":67344094,"diff_hunk":"@@ -0,0 +1,220 @@\n+# Copyright 2016 Rackspace Hosting Inc\n+# All Rights Reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+# not use this file except in compliance with the License. You may obtain\n+# a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for# the specific language governing permissions and limitations\n+#  under the License.\n+from oslo_log import log as logging\n+\n+from neutron_lib import exceptions as n_exc\n+\n+from quark import exceptions as q_exc\n+from quark.plugin_modules import jobs as job_api\n+from quark.tests.functional.base import BaseFunctionalTest\n+\n+LOG = logging.getLogger(__name__)\n+\n+\n+class QuarkJobs(BaseFunctionalTest):\n+    def setUp(self):\n+        super(QuarkJobs, self).setUp()\n+        self.action = \"test action\"\n+        self.tenant_id = \"test_tenant\"\n+        self.tenant_id2 = \"test_tenant2\"\n+\n+    def test_create_job(self):\n+        self.context = self.context.elevated()\n+\n+        job_body = dict(tenant_id=self.tenant_id, action=self.action,\n+                        completed=False)\n+        job_body = dict(job=job_body)\n+        job = job_api.create_job(self.context, job_body)\n+        self.assertIsNotNone(job)\n+        self.assertFalse(job['completed'])\n+        self.assertEqual(self.tenant_id, job['tenant_id'])\n+        self.assertEqual(self.action, job['action'])\n+\n+    def test_create_job_fail_non_admin(self):\n+        job_body = dict(tenant_id=self.tenant_id, action=self.action,\n+                        completed=False)\n+        job_body = dict(job=job_body)\n+        with self.assertRaises(n_exc.NotAuthorized):\n+            job_api.create_job(self.context, job_body)","path":"quark/tests/functional/plugin_modules/test_jobs.py","position":50,"original_position":50,"commit_id":"f366a48ddedcff3148e6f4d8b14ae225254f931c","original_commit_id":"f366a48ddedcff3148e6f4d8b14ae225254f931c","user":{"login":"xroot88","id":6250264,"avatar_url":"https://avatars.githubusercontent.com/u/6250264?v=3","gravatar_id":"","url":"https://api.github.com/users/xroot88","html_url":"https://github.com/xroot88","followers_url":"https://api.github.com/users/xroot88/followers","following_url":"https://api.github.com/users/xroot88/following{/other_user}","gists_url":"https://api.github.com/users/xroot88/gists{/gist_id}","starred_url":"https://api.github.com/users/xroot88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xroot88/subscriptions","organizations_url":"https://api.github.com/users/xroot88/orgs","repos_url":"https://api.github.com/users/xroot88/repos","events_url":"https://api.github.com/users/xroot88/events{/privacy}","received_events_url":"https://api.github.com/users/xroot88/received_events","type":"User","site_admin":false},"body":"how do we know whether context is elevated or not here?","created_at":"2016-06-16T13:32:42Z","updated_at":"2016-06-16T13:32:42Z","html_url":"https://github.com/rackerlabs/quark/pull/562#discussion_r67344094","pull_request_url":"https://api.github.com/repos/rackerlabs/quark/pulls/562","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/quark/pulls/comments/67344094"},"html":{"href":"https://github.com/rackerlabs/quark/pull/562#discussion_r67344094"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/quark/pulls/562"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/quark/pulls/562","id":74078503,"html_url":"https://github.com/rackerlabs/quark/pull/562","diff_url":"https://github.com/rackerlabs/quark/pull/562.diff","patch_url":"https://github.com/rackerlabs/quark/pull/562.patch","issue_url":"https://api.github.com/repos/rackerlabs/quark/issues/562","number":562,"state":"open","locked":false,"title":"Initial work on async worker for quark","user":{"login":"roaet","id":312320,"avatar_url":"https://avatars.githubusercontent.com/u/312320?v=3","gravatar_id":"","url":"https://api.github.com/users/roaet","html_url":"https://github.com/roaet","followers_url":"https://api.github.com/users/roaet/followers","following_url":"https://api.github.com/users/roaet/following{/other_user}","gists_url":"https://api.github.com/users/roaet/gists{/gist_id}","starred_url":"https://api.github.com/users/roaet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roaet/subscriptions","organizations_url":"https://api.github.com/users/roaet/orgs","repos_url":"https://api.github.com/users/roaet/repos","events_url":"https://api.github.com/users/roaet/events{/privacy}","received_events_url":"https://api.github.com/users/roaet/received_events","type":"User","site_admin":false},"body":"JIRA:NCP-1172\r\n\r\nCreated basic async service and test client\r\n- this is basically scaffolding and more will be added later\r\n- currently doesn't have tests but will on the next PR\r\n- intention is to add 'plugins' to support different types of async\r\n  operations\r\n\r\nCreated AsyncTransactions model and migration\r\n\r\nCreated jobs endpoint and resource\r\n\r\nCreated plugin_module for jobs\r\n\r\nMade job plugin_module admin-only for writes\r\n\r\nAllowed query by completed\r\n\r\nCreated functional test for job plugin_module","created_at":"2016-06-16T13:15:58Z","updated_at":"2016-06-16T13:32:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c31fab6cef329af197d6b32ec909fcd6c9be10d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/quark/pulls/562/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/quark/pulls/562/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/quark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/quark/issues/562/comments","statuses_url":"https://api.github.com/repos/rackerlabs/quark/statuses/f366a48ddedcff3148e6f4d8b14ae225254f931c","head":{"label":"roaet:async_worker","ref":"async_worker","sha":"f366a48ddedcff3148e6f4d8b14ae225254f931c","user":{"login":"roaet","id":312320,"avatar_url":"https://avatars.githubusercontent.com/u/312320?v=3","gravatar_id":"","url":"https://api.github.com/users/roaet","html_url":"https://github.com/roaet","followers_url":"https://api.github.com/users/roaet/followers","following_url":"https://api.github.com/users/roaet/following{/other_user}","gists_url":"https://api.github.com/users/roaet/gists{/gist_id}","starred_url":"https://api.github.com/users/roaet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roaet/subscriptions","organizations_url":"https://api.github.com/users/roaet/orgs","repos_url":"https://api.github.com/users/roaet/repos","events_url":"https://api.github.com/users/roaet/events{/privacy}","received_events_url":"https://api.github.com/users/roaet/received_events","type":"User","site_admin":false},"repo":{"id":13958489,"name":"quark","full_name":"roaet/quark","owner":{"login":"roaet","id":312320,"avatar_url":"https://avatars.githubusercontent.com/u/312320?v=3","gravatar_id":"","url":"https://api.github.com/users/roaet","html_url":"https://github.com/roaet","followers_url":"https://api.github.com/users/roaet/followers","following_url":"https://api.github.com/users/roaet/following{/other_user}","gists_url":"https://api.github.com/users/roaet/gists{/gist_id}","starred_url":"https://api.github.com/users/roaet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roaet/subscriptions","organizations_url":"https://api.github.com/users/roaet/orgs","repos_url":"https://api.github.com/users/roaet/repos","events_url":"https://api.github.com/users/roaet/events{/privacy}","received_events_url":"https://api.github.com/users/roaet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/roaet/quark","description":"","fork":true,"url":"https://api.github.com/repos/roaet/quark","forks_url":"https://api.github.com/repos/roaet/quark/forks","keys_url":"https://api.github.com/repos/roaet/quark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roaet/quark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roaet/quark/teams","hooks_url":"https://api.github.com/repos/roaet/quark/hooks","issue_events_url":"https://api.github.com/repos/roaet/quark/issues/events{/number}","events_url":"https://api.github.com/repos/roaet/quark/events","assignees_url":"https://api.github.com/repos/roaet/quark/assignees{/user}","branches_url":"https://api.github.com/repos/roaet/quark/branches{/branch}","tags_url":"https://api.github.com/repos/roaet/quark/tags","blobs_url":"https://api.github.com/repos/roaet/quark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roaet/quark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roaet/quark/git/refs{/sha}","trees_url":"https://api.github.com/repos/roaet/quark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roaet/quark/statuses/{sha}","languages_url":"https://api.github.com/repos/roaet/quark/languages","stargazers_url":"https://api.github.com/repos/roaet/quark/stargazers","contributors_url":"https://api.github.com/repos/roaet/quark/contributors","subscribers_url":"https://api.github.com/repos/roaet/quark/subscribers","subscription_url":"https://api.github.com/repos/roaet/quark/subscription","commits_url":"https://api.github.com/repos/roaet/quark/commits{/sha}","git_commits_url":"https://api.github.com/repos/roaet/quark/git/commits{/sha}","comments_url":"https://api.github.com/repos/roaet/quark/comments{/number}","issue_comment_url":"https://api.github.com/repos/roaet/quark/issues/comments{/number}","contents_url":"https://api.github.com/repos/roaet/quark/contents/{+path}","compare_url":"https://api.github.com/repos/roaet/quark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roaet/quark/merges","archive_url":"https://api.github.com/repos/roaet/quark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roaet/quark/downloads","issues_url":"https://api.github.com/repos/roaet/quark/issues{/number}","pulls_url":"https://api.github.com/repos/roaet/quark/pulls{/number}","milestones_url":"https://api.github.com/repos/roaet/quark/milestones{/number}","notifications_url":"https://api.github.com/repos/roaet/quark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roaet/quark/labels{/name}","releases_url":"https://api.github.com/repos/roaet/quark/releases{/id}","deployments_url":"https://api.github.com/repos/roaet/quark/deployments","created_at":"2013-10-29T14:43:06Z","updated_at":"2015-02-20T17:00:10Z","pushed_at":"2016-06-16T13:20:42Z","git_url":"git://github.com/roaet/quark.git","ssh_url":"git@github.com:roaet/quark.git","clone_url":"https://github.com/roaet/quark.git","svn_url":"https://github.com/roaet/quark","homepage":null,"size":3159,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"2db83098d5c81b1dd33d2969324531e12234c233","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":13504140,"name":"quark","full_name":"rackerlabs/quark","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/quark","description":"","fork":false,"url":"https://api.github.com/repos/rackerlabs/quark","forks_url":"https://api.github.com/repos/rackerlabs/quark/forks","keys_url":"https://api.github.com/repos/rackerlabs/quark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/quark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/quark/teams","hooks_url":"https://api.github.com/repos/rackerlabs/quark/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/quark/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/quark/events","assignees_url":"https://api.github.com/repos/rackerlabs/quark/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/quark/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/quark/tags","blobs_url":"https://api.github.com/repos/rackerlabs/quark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/quark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/quark/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/quark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/quark/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/quark/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/quark/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/quark/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/quark/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/quark/subscription","commits_url":"https://api.github.com/repos/rackerlabs/quark/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/quark/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/quark/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/quark/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/quark/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/quark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/quark/merges","archive_url":"https://api.github.com/repos/rackerlabs/quark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/quark/downloads","issues_url":"https://api.github.com/repos/rackerlabs/quark/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/quark/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/quark/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/quark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/quark/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/quark/releases{/id}","deployments_url":"https://api.github.com/repos/rackerlabs/quark/deployments","created_at":"2013-10-11T16:45:26Z","updated_at":"2016-01-11T20:15:02Z","pushed_at":"2016-06-16T13:20:42Z","git_url":"git://github.com/rackerlabs/quark.git","ssh_url":"git@github.com:rackerlabs/quark.git","clone_url":"https://github.com/rackerlabs/quark.git","svn_url":"https://github.com/rackerlabs/quark","homepage":null,"size":3182,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":15,"forks":23,"open_issues":15,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/quark/pulls/562"},"html":{"href":"https://github.com/rackerlabs/quark/pull/562"},"issue":{"href":"https://api.github.com/repos/rackerlabs/quark/issues/562"},"comments":{"href":"https://api.github.com/repos/rackerlabs/quark/issues/562/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/quark/pulls/562/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/quark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/quark/pulls/562/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/quark/statuses/f366a48ddedcff3148e6f4d8b14ae225254f931c"}}}}
{"actor":{"display_login":"xroot88"}}