Esempio n. 1
0
def test_api_load_map(patch, magic):
    """
    Ensures Api.load_map can compile stories from a map
    """
    patch.init(Bundle)
    patch.init(Features)
    patch.object(Bundle, "bundle")
    files = {"a.story": "import 'b' as b", "b.story": "x = 0"}
    api_loaded = Api.load_map(files)
    result = api_loaded.result()
    deprecations = api_loaded.deprecations()
    Bundle.__init__.assert_called_with(story_files=files, features=ANY)
    assert isinstance(Bundle.__init__.call_args[1]["features"], Features)
    Bundle.bundle.assert_called()
    assert result == Bundle.bundle().results
    assert deprecations == Bundle.bundle().deprecations
Esempio n. 2
0
def test_api_load_map(patch, magic):
    """
    Ensures Api.load_map can compile stories from a map
    """
    patch.init(Bundle)
    patch.object(Bundle, 'bundle')
    files = {'a.story': "import 'b' as b", 'b.story': 'x = 0'}
    result = Api.load_map(files).result()
    Bundle.__init__.assert_called_with(story_files=files)
    Bundle.bundle.assert_called()
    assert result == Bundle.bundle()