Skip to content

Commit

Permalink
Add test for different tenants to nova too
Browse files Browse the repository at this point in the history
  • Loading branch information
cyli committed Sep 29, 2014
1 parent 470a69e commit 26309c0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 0 additions & 1 deletion mimic/test/fixtures.py
Expand Up @@ -25,7 +25,6 @@ def __init__(self, test_case, root, username, password):
}
))


def nth_endpoint_public(self, n):
"""
Return the publicURL for the ``n``th endpoint.
Expand Down
18 changes: 17 additions & 1 deletion mimic/test/test_nova.py
Expand Up @@ -8,7 +8,7 @@
from mimic.canned_responses.nova import server_template
from mimic.test.helpers import json_request, request
from mimic.rest.nova_api import NovaApi
from mimic.test.fixtures import APIMockHelper
from mimic.test.fixtures import APIMockHelper, TenantAuthentication


class ResponseGenerationTests(SynchronousTestCase):
Expand Down Expand Up @@ -360,6 +360,22 @@ def test_different_region_same_server(self):
)["servers"]
self.assertEqual(other_region_servers, [])

def test_different_tenants_same_region(self):
"""
Creating a server for one tenant in a particular region should not
create it for other tenants in the same region.
"""
other_tenant = TenantAuthentication(self, self.root, "other", "other")

response, response_body = self.successResultOf(
json_request(
self, self.root, "GET",
other_tenant.nth_endpoint_public(0) + '/servers'))

self.assertEqual(response.code, 200)
self.assertEqual(response_body, {'servers': []})



class NovaAPINegativeTests(SynchronousTestCase):

Expand Down

0 comments on commit 26309c0

Please sign in to comment.