Skip to content

Commit

Permalink
Add Test for Recursive Include Support
Browse files Browse the repository at this point in the history
To guard against regression, and prove functionality, added a test and
associated example data to make sure nested `!include` directives work.
  • Loading branch information
Ben Hamill committed May 13, 2015
1 parent 5a98895 commit 5db373c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/data/examples/includes/all-the-properties.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#%RAML 0.8

external: !include properties.raml
foo: !include foo-properties.raml
4 changes: 4 additions & 0 deletions tests/data/examples/nested-includes.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#%RAML 0.8
title: GitHub API Demo - Includes
version: v3
include_one: !include includes/all-the-properties.raml
20 changes: 20 additions & 0 deletions tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ def test_load_file():

assert dict_equal(raml, expected_data)

def test_load_file_with_nested_includes():
raml_file = os.path.join(EXAMPLES + "nested-includes.raml")
with open(raml_file) as f:
raml = loader.RAMLLoader().load(f)

expected_data = {
'include_one': {
'external': {
'propertyA': 'valueA',
'propertyB': 'valueB'
},
'foo': {
'foo': 'FooBar',
'bar': 'BarBaz'
},
},
'title': 'GitHub API Demo - Includes',
'version': 'v3'
}


def test_load_string():
raml_str = ("""
Expand Down

0 comments on commit 5db373c

Please sign in to comment.