Beispiel #1
0
def test_providing_extra_segments_fails():
    "application_from_segments does not allow extra segments after the application."
    app = basic_mamayo_app_directory()
    root = ff.Directory(dict(app=app))
    e = Explorer(root)
    e.explore()
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(["app", "more"])
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(["app", "more", "stuff"])
Beispiel #2
0
def test_fetching_nonextant_applications():
    "application_from_segments raises NoSuchApplicationError on failure."
    app = basic_mamayo_app_directory()
    root = ff.Directory(dict(app=app))
    e = Explorer(root)
    e.explore()
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments([])
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(["not-app"])
Beispiel #3
0
def test_providing_extra_segments_fails():
    "application_from_segments does not allow extra segments after the application."
    app = basic_mamayo_app_directory()
    root = ff.Directory(dict(app=app))
    e = Explorer(root)
    e.explore()
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(['app', 'more'])
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(['app', 'more', 'stuff'])
Beispiel #4
0
def test_fetching_nonextant_applications():
    "application_from_segments raises NoSuchApplicationError on failure."
    app = basic_mamayo_app_directory()
    root = ff.Directory(dict(app=app))
    e = Explorer(root)
    e.explore()
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments([])
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(['not-app'])
Beispiel #5
0
def test_reexploration():
    "An explorer can re-explore to find new applications."
    app1 = basic_mamayo_app_directory()
    app2 = basic_mamayo_app_directory()
    root = ff.Directory(dict(foo=app1, bar=app2))
    e = Explorer(root)
    e.explore()
    assert {app.path for app in e.applications} == {app1, app2}
    assert_application_characteristics(e, "foo", path=app1, name="root.foo")
    assert_application_characteristics(e, "bar", path=app2, name="root.bar")

    app3 = basic_mamayo_app_directory()
    del root.contents["foo"]
    root.contents["baz"] = app3
    e.explore()
    assert {app.path for app in e.applications} == {app2, app3}
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(["foo"])
    assert_application_characteristics(e, "bar", path=app2, name="root.bar")
    assert_application_characteristics(e, "baz", path=app3, name="root.baz")
Beispiel #6
0
def test_reexploration():
    "An explorer can re-explore to find new applications."
    app1 = basic_mamayo_app_directory()
    app2 = basic_mamayo_app_directory()
    root = ff.Directory(dict(foo=app1, bar=app2))
    e = Explorer(root)
    e.explore()
    assert {app.path for app in e.applications} == {app1, app2}
    assert_application_characteristics(e, 'foo', path=app1, name='root.foo')
    assert_application_characteristics(e, 'bar', path=app2, name='root.bar')

    app3 = basic_mamayo_app_directory()
    del root.contents['foo']
    root.contents['baz'] = app3
    e.explore()
    assert {app.path for app in e.applications} == {app2, app3}
    with pytest.raises(NoSuchApplicationError):
        e.application_from_segments(['foo'])
    assert_application_characteristics(e, 'bar', path=app2, name='root.bar')
    assert_application_characteristics(e, 'baz', path=app3, name='root.baz')