Ejemplo n.º 1
0
def test_excess_static_path():
    a = Application()
    def add_roots(doc):
        doc.add_root(AnotherModelInTestApplication())
        doc.add_root(SomeModelInTestApplication())
    def add_one_root(doc):
        doc.add_root(AnotherModelInTestApplication())
    handler = FunctionHandler(add_roots)
    handler._static = "foo"
    a.add(handler)
    handler2 = FunctionHandler(add_one_root)
    handler2._static = "bar"
    with pytest.raises(RuntimeError):
        a.add(handler2)
Ejemplo n.º 2
0
 def test_excess_static_path(self) -> None:
     a = baa.Application()
     def add_roots(doc):
         doc.add_root(AnotherModelInTestApplication())
         doc.add_root(SomeModelInTestApplication())
     def add_one_root(doc):
         doc.add_root(AnotherModelInTestApplication())
     handler = FunctionHandler(add_roots)
     handler._static = "foo"
     a.add(handler)
     handler2 = FunctionHandler(add_one_root)
     handler2._static = "bar"
     with pytest.raises(RuntimeError) as e:
         a.add(handler2)
     assert "More than one static path" in str(e.value)
Ejemplo n.º 3
0
 def test_excess_static_path(self):
     a = baa.Application()
     def add_roots(doc):
         doc.add_root(AnotherModelInTestApplication())
         doc.add_root(SomeModelInTestApplication())
     def add_one_root(doc):
         doc.add_root(AnotherModelInTestApplication())
     handler = FunctionHandler(add_roots)
     handler._static = "foo"
     a.add(handler)
     handler2 = FunctionHandler(add_one_root)
     handler2._static = "bar"
     with pytest.raises(RuntimeError) as e:
         a.add(handler2)
     assert "More than one static path" in str(e)
Ejemplo n.º 4
0
def test_excess_static_path():
    a = Application()

    def add_roots(doc):
        doc.add_root(AnotherModelInTestApplication())
        doc.add_root(SomeModelInTestApplication())

    def add_one_root(doc):
        doc.add_root(AnotherModelInTestApplication())

    handler = FunctionHandler(add_roots)
    handler._static = "foo"
    a.add(handler)
    handler2 = FunctionHandler(add_one_root)
    handler2._static = "bar"
    with pytest.raises(RuntimeError):
        a.add(handler2)
Ejemplo n.º 5
0
 def test_static_path(self) -> None:
     a = baa.Application()
     def add_roots(doc):
         doc.add_root(AnotherModelInTestApplication())
         doc.add_root(SomeModelInTestApplication())
     def add_one_root(doc):
         doc.add_root(AnotherModelInTestApplication())
     handler = FunctionHandler(add_roots)
     handler._static = "foo"
     a.add(handler)
     handler2 = FunctionHandler(add_one_root)
     a.add(handler2)
     assert a.static_path == "foo"
Ejemplo n.º 6
0
def test_static_path():
    a = Application()
    def add_roots(doc):
        doc.add_root(AnotherModelInTestApplication())
        doc.add_root(SomeModelInTestApplication())
    def add_one_root(doc):
        doc.add_root(AnotherModelInTestApplication())
    handler = FunctionHandler(add_roots)
    handler._static = "foo"
    a.add(handler)
    handler2 = FunctionHandler(add_one_root)
    a.add(handler2)
    assert a.static_path == "foo"