mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:32:13 +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'])
|
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):
|
def _comment_directive(block, location):
|
||||||
@@ -541,7 +541,7 @@ def _comment_directive(block, location):
|
|||||||
if "Certbot" in next_entry[-1]:
|
if "Certbot" in next_entry[-1]:
|
||||||
return
|
return
|
||||||
next_entry = next_entry.spaced[0] # pylint: disable=no-member
|
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:
|
if "\n" not in next_entry:
|
||||||
block.insert(location + 2, '\n')
|
block.insert(location + 2, '\n')
|
||||||
|
|
||||||
|
|||||||
@@ -225,15 +225,15 @@ class NginxParserTest(util.NginxTest):
|
|||||||
["\n", "a", " ", "b", "\n"],
|
["\n", "a", " ", "b", "\n"],
|
||||||
["c", " ", "d"],
|
["c", " ", "d"],
|
||||||
["\n", "e", " ", "f"]])
|
["\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, 1)
|
||||||
_comment_directive(block, 0)
|
_comment_directive(block, 0)
|
||||||
self.assertEqual(block.spaced, [
|
self.assertEqual(block.spaced, [
|
||||||
["\n", "a", " ", "b", "\n"],
|
["\n", "a", " ", "b", "\n"],
|
||||||
COMMENT,
|
COMMENT_BLOCK,
|
||||||
"\n",
|
"\n",
|
||||||
["c", " ", "d"],
|
["c", " ", "d"],
|
||||||
COMMENT,
|
COMMENT_BLOCK,
|
||||||
["\n", "e", " ", "f"]])
|
["\n", "e", " ", "f"]])
|
||||||
|
|
||||||
def test_get_all_certs_keys(self):
|
def test_get_all_certs_keys(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user