Exemple #1
0
 def test_comment_directive(self):
     # pylint: disable=protected-access
     block = nginxparser.UnspacedList([["\n", "a", " ", "b", "\n"],
                                       ["c", " ", "d"],
                                       ["\n", "e", " ", "f"]])
     from certbot_nginx.parser import comment_directive, COMMENT_BLOCK
     comment_directive(block, 1)
     comment_directive(block, 0)
     self.assertEqual(
         block.spaced,
         [["\n", "a", " ", "b", "\n"], COMMENT_BLOCK, "\n", ["c", " ", "d"],
          COMMENT_BLOCK, ["\n", "e", " ", "f"]])
Exemple #2
0
 def test_comment_directive(self):
     # pylint: disable=protected-access
     block = nginxparser.UnspacedList([
         ["\n", "a", " ", "b", "\n"],
         ["c", " ", "d"],
         ["\n", "e", " ", "f"]])
     from certbot_nginx.parser import comment_directive, COMMENT_BLOCK
     comment_directive(block, 1)
     comment_directive(block, 0)
     self.assertEqual(block.spaced, [
         ["\n", "a", " ", "b", "\n"],
         COMMENT_BLOCK,
         "\n",
         ["c", " ", "d"],
         COMMENT_BLOCK,
         ["\n", "e", " ", "f"]])
Exemple #3
0
def _test_block_from_block(block):
    test_block = nginxparser.UnspacedList(block)
    parser.comment_directive(test_block, 0)
    return test_block[:-1]
def _test_block_from_block(block):
    test_block = nginxparser.UnspacedList(block)
    parser.comment_directive(test_block, 0)
    return test_block[:-1]