Fixing api test with default missing restriction type

Change-Id: Idf5b6e11342b5832ff6c62a47641e7b9fde97554
This commit is contained in:
tonytan4ever 2015-07-15 18:24:47 -04:00
parent f375f0caa4
commit 303291bf17
2 changed files with 9 additions and 0 deletions

View File

@ -326,6 +326,7 @@ class TestServiceActions(base.TestBase):
self.restrictions_list = [
{
u"name": u"website only",
u"type": u"whitelist",
u"rules": [
{
u"name": domain,

View File

@ -154,6 +154,8 @@ class TestPatchSSLService(base.TestBase):
self.restrictions_list = [
{"name": "website only",
# add whitelist to make restriction type explicit
"type": "whitelist",
"rules": [{"name": "mywebsite.com",
"referrer": "www.mywebsite.com",
"request_url": "/*"
@ -203,6 +205,12 @@ class TestPatchSSLService(base.TestBase):
patch = jsonpatch.JsonPatch(test_data)
expected_service_details = patch.apply(self.original_service_details)
# Default restriction to whitelist
expected_restrictions = expected_service_details['restrictions']
for restriction in expected_restrictions:
if 'type' not in restriction:
restriction['type'] = 'whitelist'
resp = self.client.patch_service(location=self.service_url,
request_body=test_data)
self.assertEqual(resp.status_code, 202)