예제 #1
0
def test_app_compile(patch):
    patch.object(json, 'dumps')
    patch.many(App, ['get_stories', 'parse', 'services'])
    result = App.compile('path')
    App.get_stories.assert_called_with('path')
    App.parse.assert_called_with(App.get_stories(), ebnf_file=None)
    App.services.assert_called_with(App.parse())
    dictionary = {'stories': App.parse(), 'services': App.services()}
    json.dumps.assert_called_with(dictionary, indent=2)
    assert result == json.dumps()
예제 #2
0
def test_app_services_no_duplicates():
    compiled_stories = {'a': {'services': ['one']}, 'b': {'services': ['one']}}
    result = App.services(compiled_stories)
    assert result == ['one']