Fix up COMMENT constants

This commit is contained in:
Brad Warren
2016-08-16 17:45:43 -07:00
parent 3d4f822be0
commit 671d7ee194
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -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):