{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/mimic/pulls/comments/66091766","id":66091766,"diff_hunk":"@@ -0,0 +1,126 @@\n+from __future__ import absolute_import, division, unicode_literals\n+\n+from twisted.trial.unittest import SynchronousTestCase\n+\n+from mimic.catalog import Endpoint, Entry\n+\n+\n+class CatalogEntry(SynchronousTestCase):\n+    \"\"\"\n+    Testing of the :class:`Entry` object\n+    \"\"\"\n+    def setUp(self):\n+        self.tenant = u\"some-tenant\"\n+        self.service_type = u\"some-type\"\n+        self.service_name = u\"some-service\"\n+\n+    def test_basic(self):\n+        \"\"\"\n+        Validate the requirements for creating an :obj:`Entry` object.\n+        At minimum the tenant, service type, and service name are\n+        defined, and no endpoints (regions) are available.\n+        \"\"\"\n+        empty_iterable = []\n+        entry = Entry(\n+            self.tenant,\n+            self.service_type,\n+            self.service_name,\n+            empty_iterable\n+        )\n+\n+        self.assertEqual(entry.tenant_id, self.tenant)\n+        self.assertEqual(entry.name, self.service_name)\n+        self.assertEqual(entry.type, self.service_type)\n+        self.assertEqual(entry.endpoints, empty_iterable)\n+\n+\n+class CatalogEndpoint(SynchronousTestCase):\n+    \"\"\"\n+    Testing of the :class:`Endpoint` object\n+    \"\"\"\n+    def setUp(self):\n+        self.tenant = u\"some-tenant\"\n+        self.region = u\"some-region\"\n+        self.endpointid = u\"some-endpoint-id\"\n+        self.internal_api_prefix = u\"endpoint-api\"\n+        self.request_prefix = u\"http://internal.api/prefix\"\n+        self.external_api_url = u\"http://external.api/endpoint\"\n+\n+    def test_basic(self):\n+        \"\"\"\n+        Validate the requirements for creating an :obj`Endpoint` object.\n+        At minimum, the tenant, region, and endpoint id are defined;\n+        default parameters must also be checked.\n+        \"\"\"\n+        endpoint = Endpoint(\n+            self.tenant,\n+            self.region,\n+            self.endpointid\n+        )\n+        self.assertEqual(self.tenant, endpoint.tenant_id)\n+        self.assertEqual(self.region, endpoint.region)\n+        self.assertEqual(self.endpointid, endpoint.endpoint_id)\n+        self.assertIsNone(endpoint.prefix)\n+        self.assertFalse(endpoint.external)\n+        self.assertIsNone(endpoint.complete_url)\n+\n+    def test_internal_endpoint(self):\n+        \"\"\"\n+        Validate creating an :obj:`Endpoint` for an internal API. In addition\n+        to the tenant, region, and endpoint id the prefix must also be\n+        specified.\n+        \"\"\"\n+        endpoint = Endpoint(\n+            self.tenant,\n+            self.region,\n+            self.endpointid,\n+            prefix=self.internal_api_prefix\n+        )\n+        self.assertEqual(self.tenant, endpoint.tenant_id)\n+        self.assertEqual(self.region, endpoint.region)\n+        self.assertEqual(self.endpointid, endpoint.endpoint_id)\n+        self.assertEqual(self.internal_api_prefix, endpoint.prefix)\n+        self.assertFalse(endpoint.external)\n+        self.assertIsNone(endpoint.complete_url)\n+\n+        uri = endpoint.url_with_prefix(self.request_prefix)\n+        self.assertTrue(uri.startswith(self.request_prefix))\n+\n+    def test_external_endpoint(self):\n+        \"\"\"\n+        Validate creating an :obj:`Endpoint` for an external API. In addition\n+        to the tenant, region, and endpoint id both `external` must be set to\n+        `True` and the `complete_url` must be set.\n+        \"\"\"\n+        endpoint = Endpoint(\n+            self.tenant,\n+            self.region,\n+            self.endpointid,\n+            external=True,\n+            complete_url=self.external_api_url\n+        )\n+        self.assertEqual(self.tenant, endpoint.tenant_id)\n+        self.assertEqual(self.region, endpoint.region)\n+        self.assertEqual(self.endpointid, endpoint.endpoint_id)\n+        self.assertIsNone(endpoint.prefix)\n+        self.assertTrue(endpoint.external)\n+        self.assertIsNotNone(endpoint.complete_url)\n+        self.assertEqual(endpoint.complete_url, self.external_api_url)\n+\n+        uri = endpoint.url_with_prefix(self.request_prefix)\n+        self.assertEqual(uri, self.external_api_url)\n+\n+    def test_external_endpoint_invalid(self):\n+        \"\"\"\n+        Validate that trying to creating an :obj:`Endpoint` for an external API\n+        (setting `external` to `True` while *not* setting the `complete_url`\n+        will raise a `ValueError` exception.","path":"mimic/test/test_catalog.py","position":117,"original_position":117,"commit_id":"94bf6f70455dafae1bd989757ef3d016593fb325","original_commit_id":"94bf6f70455dafae1bd989757ef3d016593fb325","user":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"body":"Reworded, it was correct but I can see how it could be confusing so cleared it up.","created_at":"2016-06-07T15:20:01Z","updated_at":"2016-06-07T15:20:01Z","html_url":"https://github.com/rackerlabs/mimic/pull/614#discussion_r66091766","pull_request_url":"https://api.github.com/repos/rackerlabs/mimic/pulls/614","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/mimic/pulls/comments/66091766"},"html":{"href":"https://github.com/rackerlabs/mimic/pull/614#discussion_r66091766"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/mimic/pulls/614"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/mimic/pulls/614","id":69724011,"html_url":"https://github.com/rackerlabs/mimic/pull/614","diff_url":"https://github.com/rackerlabs/mimic/pull/614.diff","patch_url":"https://github.com/rackerlabs/mimic/pull/614.patch","issue_url":"https://api.github.com/repos/rackerlabs/mimic/issues/614","number":614,"state":"open","locked":false,"title":"Enhancement iexternalapitemplatemock","user":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"body":"Next stage in the infrastructure for supporting external APIs within mimic\r\n\r\nSecond PR in series for addressing #219 ","created_at":"2016-05-11T18:58:33Z","updated_at":"2016-06-07T15:20:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b788d8f152e7ea4c4fff188e2cfa463265902d4","assignee":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/mimic/pulls/614/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/mimic/pulls/614/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/mimic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/mimic/issues/614/comments","statuses_url":"https://api.github.com/repos/rackerlabs/mimic/statuses/94bf6f70455dafae1bd989757ef3d016593fb325","head":{"label":"BenjamenMeyer:enhancement_iexternalapitemplatemock","ref":"enhancement_iexternalapitemplatemock","sha":"94bf6f70455dafae1bd989757ef3d016593fb325","user":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"repo":{"id":57170900,"name":"mimic","full_name":"BenjamenMeyer/mimic","owner":{"login":"BenjamenMeyer","id":1074110,"avatar_url":"https://avatars.githubusercontent.com/u/1074110?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjamenMeyer","html_url":"https://github.com/BenjamenMeyer","followers_url":"https://api.github.com/users/BenjamenMeyer/followers","following_url":"https://api.github.com/users/BenjamenMeyer/following{/other_user}","gists_url":"https://api.github.com/users/BenjamenMeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjamenMeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjamenMeyer/subscriptions","organizations_url":"https://api.github.com/users/BenjamenMeyer/orgs","repos_url":"https://api.github.com/users/BenjamenMeyer/repos","events_url":"https://api.github.com/users/BenjamenMeyer/events{/privacy}","received_events_url":"https://api.github.com/users/BenjamenMeyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BenjamenMeyer/mimic","description":"An API mock service","fork":true,"url":"https://api.github.com/repos/BenjamenMeyer/mimic","forks_url":"https://api.github.com/repos/BenjamenMeyer/mimic/forks","keys_url":"https://api.github.com/repos/BenjamenMeyer/mimic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BenjamenMeyer/mimic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BenjamenMeyer/mimic/teams","hooks_url":"https://api.github.com/repos/BenjamenMeyer/mimic/hooks","issue_events_url":"https://api.github.com/repos/BenjamenMeyer/mimic/issues/events{/number}","events_url":"https://api.github.com/repos/BenjamenMeyer/mimic/events","assignees_url":"https://api.github.com/repos/BenjamenMeyer/mimic/assignees{/user}","branches_url":"https://api.github.com/repos/BenjamenMeyer/mimic/branches{/branch}","tags_url":"https://api.github.com/repos/BenjamenMeyer/mimic/tags","blobs_url":"https://api.github.com/repos/BenjamenMeyer/mimic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BenjamenMeyer/mimic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BenjamenMeyer/mimic/git/refs{/sha}","trees_url":"https://api.github.com/repos/BenjamenMeyer/mimic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BenjamenMeyer/mimic/statuses/{sha}","languages_url":"https://api.github.com/repos/BenjamenMeyer/mimic/languages","stargazers_url":"https://api.github.com/repos/BenjamenMeyer/mimic/stargazers","contributors_url":"https://api.github.com/repos/BenjamenMeyer/mimic/contributors","subscribers_url":"https://api.github.com/repos/BenjamenMeyer/mimic/subscribers","subscription_url":"https://api.github.com/repos/BenjamenMeyer/mimic/subscription","commits_url":"https://api.github.com/repos/BenjamenMeyer/mimic/commits{/sha}","git_commits_url":"https://api.github.com/repos/BenjamenMeyer/mimic/git/commits{/sha}","comments_url":"https://api.github.com/repos/BenjamenMeyer/mimic/comments{/number}","issue_comment_url":"https://api.github.com/repos/BenjamenMeyer/mimic/issues/comments{/number}","contents_url":"https://api.github.com/repos/BenjamenMeyer/mimic/contents/{+path}","compare_url":"https://api.github.com/repos/BenjamenMeyer/mimic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BenjamenMeyer/mimic/merges","archive_url":"https://api.github.com/repos/BenjamenMeyer/mimic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BenjamenMeyer/mimic/downloads","issues_url":"https://api.github.com/repos/BenjamenMeyer/mimic/issues{/number}","pulls_url":"https://api.github.com/repos/BenjamenMeyer/mimic/pulls{/number}","milestones_url":"https://api.github.com/repos/BenjamenMeyer/mimic/milestones{/number}","notifications_url":"https://api.github.com/repos/BenjamenMeyer/mimic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BenjamenMeyer/mimic/labels{/name}","releases_url":"https://api.github.com/repos/BenjamenMeyer/mimic/releases{/id}","deployments_url":"https://api.github.com/repos/BenjamenMeyer/mimic/deployments","created_at":"2016-04-27T00:22:10Z","updated_at":"2016-04-27T00:22:11Z","pushed_at":"2016-06-06T15:22:01Z","git_url":"git://github.com/BenjamenMeyer/mimic.git","ssh_url":"git@github.com:BenjamenMeyer/mimic.git","clone_url":"https://github.com/BenjamenMeyer/mimic.git","svn_url":"https://github.com/BenjamenMeyer/mimic","homepage":"","size":2685,"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":"d01ed05485601cdbc29c28231ed5e319799d2e18","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":13158707,"name":"mimic","full_name":"rackerlabs/mimic","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/mimic","description":"An API mock service","fork":false,"url":"https://api.github.com/repos/rackerlabs/mimic","forks_url":"https://api.github.com/repos/rackerlabs/mimic/forks","keys_url":"https://api.github.com/repos/rackerlabs/mimic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/mimic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/mimic/teams","hooks_url":"https://api.github.com/repos/rackerlabs/mimic/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/mimic/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/mimic/events","assignees_url":"https://api.github.com/repos/rackerlabs/mimic/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/mimic/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/mimic/tags","blobs_url":"https://api.github.com/repos/rackerlabs/mimic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/mimic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/mimic/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/mimic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/mimic/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/mimic/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/mimic/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/mimic/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/mimic/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/mimic/subscription","commits_url":"https://api.github.com/repos/rackerlabs/mimic/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/mimic/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/mimic/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/mimic/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/mimic/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/mimic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/mimic/merges","archive_url":"https://api.github.com/repos/rackerlabs/mimic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/mimic/downloads","issues_url":"https://api.github.com/repos/rackerlabs/mimic/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/mimic/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/mimic/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/mimic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/mimic/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/mimic/releases{/id}","deployments_url":"https://api.github.com/repos/rackerlabs/mimic/deployments","created_at":"2013-09-27T19:01:16Z","updated_at":"2016-05-31T01:52:30Z","pushed_at":"2016-06-06T15:22:00Z","git_url":"git://github.com/rackerlabs/mimic.git","ssh_url":"git@github.com:rackerlabs/mimic.git","clone_url":"https://github.com/rackerlabs/mimic.git","svn_url":"https://github.com/rackerlabs/mimic","homepage":"","size":4091,"stargazers_count":117,"watchers_count":117,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":56,"mirror_url":null,"open_issues_count":100,"forks":56,"open_issues":100,"watchers":117,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/mimic/pulls/614"},"html":{"href":"https://github.com/rackerlabs/mimic/pull/614"},"issue":{"href":"https://api.github.com/repos/rackerlabs/mimic/issues/614"},"comments":{"href":"https://api.github.com/repos/rackerlabs/mimic/issues/614/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/mimic/pulls/614/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/mimic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/mimic/pulls/614/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/mimic/statuses/94bf6f70455dafae1bd989757ef3d016593fb325"}}}}
{"actor":{"display_login":"BenjamenMeyer"}}