Exemplo n.º 1
0
 def test_find_content_hierarchy_import_errors_get_raised(self):
     try:
         findcontent('badimport1:Foo')
         assert False
     except HierarchyImportError as e:
         assert 'module "nothere" not found; searched compstack' in str(
             e), e
Exemplo n.º 2
0
 def test_find_content_no_module_app_level(self):
     try:
         findcontent('NotThere')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "NotThere" was not found' == str(
             e), e
Exemplo n.º 3
0
 def test_find_content_no_attribute(self):
     try:
         findcontent('tests:NotThere')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "tests:NotThere" was not found' == str(
             e), e
Exemplo n.º 4
0
 def test_find_content_no_module(self):
     try:
         findcontent('routingtests:Foo')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "routingtests:Foo" was not found' == str(
             e), e
Exemplo n.º 5
0
 def test_find_content_no_component(self):
     try:
         findcontent('notacomponent:Foo')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "notacomponent:Foo" was not found' == str(
             e), e
Exemplo n.º 6
0
 def test_find_content_no_object_app_level(self):
     from appstack.content import iexist
     assert iexist
     try:
         findcontent('NotThere')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "NotThere" was not found' == str(e), e
Exemplo n.º 7
0
 def test_find_content_no_object_app_level(self):
     from appstack.content import iexist
     assert iexist
     try:
         findcontent('NotThere')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "NotThere" was not found' == str(
             e), e
Exemplo n.º 8
0
def getcontent(__endpoint, *args, **kwargs):
    if '.' in __endpoint:
        c = TemplateContent(__endpoint)
    else:
        klass = findcontent(__endpoint)
        c = klass()
    c.process(*args, **kwargs)
    return c
Exemplo n.º 9
0
 def test_find_content_no_module_app_level(self):
     try:
         findcontent('NotThere')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "NotThere" was not found' == str(e), e
Exemplo n.º 10
0
 def test_find_content_hierarchy_import_errors_get_raised(self):
     try:
         findcontent('badimport1:Foo')
         assert False
     except HierarchyImportError as e:
         assert 'module "nothere" not found; searched compstack' in str(e), e
Exemplo n.º 11
0
 def test_find_content_no_attribute(self):
     try:
         findcontent('tests:NotThere')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "tests:NotThere" was not found' == str(e), e
Exemplo n.º 12
0
 def test_find_content_no_module(self):
     try:
         findcontent('routingtests:Foo')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "routingtests:Foo" was not found' == str(e), e
Exemplo n.º 13
0
 def test_find_content_no_component(self):
     try:
         findcontent('notacomponent:Foo')
         assert False
     except HierarchyImportError as e:
         assert 'An object for Content endpoint "notacomponent:Foo" was not found' == str(e), e