Ensure mapping rule has only local and remote properties

As per the API spec, a mapping rule reference should only have a
local and remote properties.
This change ensures that the schema used to validate mappings
fulfills that requirement.

bp mapping-distributed-admin

Change-Id: I00468c56d9b6689789b2123c3797c56cc73517d1
This commit is contained in:
Steve Martinelli 2014-01-30 09:52:05 -06:00
parent 8c3e79495f
commit 15916152d8
3 changed files with 32 additions and 0 deletions

View File

@ -29,6 +29,8 @@ MAPPING_SCHEMA = {
"type": "array",
"items": {
"type": "object",
"required": ['local', 'remote'],
"additionalProperties": False,
"properties": {
"local": {
"type": "array"

View File

@ -306,3 +306,28 @@ MAPPING_EXTRA_REMOTE_PROPS_JUST_TYPE = {
}
]
}
MAPPING_EXTRA_RULES_PROPS = {
"rules": [
{
"local": [
{
"group": {
"id": "0cd5e9"
}
}
],
"invalid_type": {
"id": "xyz",
},
"remote": [
{
"type": "orgPersonType",
"not_any_of": [
"SubContractor"
]
}
]
}
]
}

View File

@ -579,3 +579,8 @@ class MappingCRUDTests(FederationTests):
url = self.MAPPING_URL + uuid.uuid4().hex
self.put(url, expected_status=400,
body={'mapping': {}})
def test_create_mapping_extra_rules_properties(self):
url = self.MAPPING_URL + uuid.uuid4().hex
self.put(url, expected_status=400,
body={'mapping': mapping_fixtures.MAPPING_EXTRA_RULES_PROPS})