mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 18:56:55 +02:00
Fix up COMMENT constants
This commit is contained in:
@@ -525,8 +525,8 @@ def _add_directives(block, directives, replace):
|
||||
|
||||
|
||||
REPEATABLE_DIRECTIVES = set(['server_name', 'listen', 'include'])
|
||||
COMMENT_STR = ' managed by Certbot'
|
||||
COMMENT = [' ', '#', ' managed by Certbot']
|
||||
COMMENT = ' managed by Certbot'
|
||||
COMMENT_BLOCK = [' ', '#', COMMENT]
|
||||
|
||||
|
||||
def _comment_directive(block, location):
|
||||
@@ -541,7 +541,7 @@ def _comment_directive(block, location):
|
||||
if "Certbot" in next_entry[-1]:
|
||||
return
|
||||
next_entry = next_entry.spaced[0] # pylint: disable=no-member
|
||||
block.insert(location + 1, COMMENT[:])
|
||||
block.insert(location + 1, COMMENT_BLOCK[:])
|
||||
if "\n" not in next_entry:
|
||||
block.insert(location + 2, '\n')
|
||||
|
||||
|
||||
@@ -225,15 +225,15 @@ class NginxParserTest(util.NginxTest):
|
||||
["\n", "a", " ", "b", "\n"],
|
||||
["c", " ", "d"],
|
||||
["\n", "e", " ", "f"]])
|
||||
from certbot_nginx.parser import _comment_directive, COMMENT
|
||||
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,
|
||||
COMMENT_BLOCK,
|
||||
"\n",
|
||||
["c", " ", "d"],
|
||||
COMMENT,
|
||||
COMMENT_BLOCK,
|
||||
["\n", "e", " ", "f"]])
|
||||
|
||||
def test_get_all_certs_keys(self):
|
||||
|
||||
Reference in New Issue
Block a user