Ejemplo n.º 1
0
 def test_include_file_cant_find_file(self):
     expected = "[[include can't find file %s in revision %s]]"
     assert_equal(
         macro.include_file('src-git', 'a.txt'),
         expected % ('a.txt', '1e146e67985dcd71c74de79613719bef7bddca4a'))
     assert_equal(
         macro.include_file('src-git', 'a.txt',
                            '6a45885ae7347f1cac5103b0050cc1be6a1496c8'),
         expected % ('a.txt', '6a45885ae7347f1cac5103b0050cc1be6a1496c8'))
Ejemplo n.º 2
0
 def test_include_file_permissions(self):
     h.set_context('test', 'src-git', neighborhood='Projects')
     role = M.ProjectRole.by_name('*anonymous')._id
     read_perm = M.ACE.allow(role, 'read')
     acl = c.app.config.acl
     if read_perm in acl:
         acl.remove(read_perm)
     c.user = M.User.anonymous()
     expected = "[[include: you don't have a read permission for repo src-git]]"
     assert_equal(macro.include_file('src-git'), expected)
Ejemplo n.º 3
0
 def test_include_file_permissions(self):
     h.set_context('test', 'src-git', neighborhood='Projects')
     role = M.ProjectRole.by_name('*anonymous')._id
     read_perm = M.ACE.allow(role, 'read')
     acl = c.app.config.acl
     if read_perm in acl:
         acl.remove(read_perm)
     c.user = M.User.anonymous()
     expected = "[[include: you don't have a read permission for repo src-git]]"
     assert_equal(macro.include_file('src-git'), expected)
Ejemplo n.º 4
0
 def test_include_file_display(self):
     result = macro.include_file('src-git', 'README')
     assert_in('This is readme', result)
     assert_in('Another Line', result)
Ejemplo n.º 5
0
 def test_include_file_cant_display(self, has_html_view, has_pypeline_view):
     has_html_view.return_value = False
     has_pypeline_view.return_value = False
     expected = "[[include can't display file README in revision 1e146e67985dcd71c74de79613719bef7bddca4a]]"
     assert_equal(macro.include_file('src-git', 'README'), expected)
Ejemplo n.º 6
0
 def test_include_file_no_repo(self):
     expected = '[[include repo %s (not found)]]'
     assert_equal(macro.include_file(None), expected % None)
     assert_equal(macro.include_file('a:b'), expected % 'a:b')
     assert_equal(macro.include_file('repo'), expected % 'repo')
Ejemplo n.º 7
0
 def test_include_file_display(self):
     result = macro.include_file('src-git', 'README')
     assert_in('This is readme', result)
     assert_in('Another Line', result)
Ejemplo n.º 8
0
 def test_include_file_cant_display(self, has_html_view, has_pypeline_view):
     has_html_view.return_value = False
     has_pypeline_view.return_value = False
     expected = "[[include can't display file README in revision 1e146e67985dcd71c74de79613719bef7bddca4a]]"
     assert_equal(macro.include_file('src-git', 'README'), expected)
Ejemplo n.º 9
0
 def test_include_file_cant_find_file(self):
     expected = "[[include can't find file %s in revision %s]]"
     assert_equal(macro.include_file('src-git', 'a.txt'),
                  expected % ('a.txt', '1e146e67985dcd71c74de79613719bef7bddca4a'))
     assert_equal(macro.include_file('src-git', 'a.txt', '6a45885ae7347f1cac5103b0050cc1be6a1496c8'),
                  expected % ('a.txt', '6a45885ae7347f1cac5103b0050cc1be6a1496c8'))
Ejemplo n.º 10
0
 def test_include_file_no_repo(self):
     expected = '[[include repo %s (not found)]]'
     assert_equal(macro.include_file(None), expected % None)
     assert_equal(macro.include_file('a:b'), expected % 'a:b')
     assert_equal(macro.include_file('repo'), expected % 'repo')