Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2020-11-13 01:33:02 +0300
committerGitHub <noreply@github.com>2020-11-13 01:33:02 +0300
commitb742b60c4d9422e00871555a6db29e9ba27dbf78 (patch)
tree6c95c48f3abee9006a494acf5dedebfdc6e7876b /certbot-apache
parentf15f4f9838c46e015fb4a183aeb415c794418ea9 (diff)
Use better asserts. Added notes to style guide. (#8451)
Diffstat (limited to 'certbot-apache')
-rw-r--r--certbot-apache/tests/configurator_test.py8
-rw-r--r--certbot-apache/tests/dualnode_test.py6
-rw-r--r--certbot-apache/tests/obj_test.py20
3 files changed, 17 insertions, 17 deletions
diff --git a/certbot-apache/tests/configurator_test.py b/certbot-apache/tests/configurator_test.py
index 091a6a828..433229727 100644
--- a/certbot-apache/tests/configurator_test.py
+++ b/certbot-apache/tests/configurator_test.py
@@ -1357,10 +1357,10 @@ class MultipleVhostsTest(util.ApacheTest):
# And the actual returned values
self.assertEqual(len(vhs), 1)
- self.assertTrue(vhs[0].name == "certbot.demo")
+ self.assertEqual(vhs[0].name, "certbot.demo")
self.assertTrue(vhs[0].ssl)
- self.assertFalse(vhs[0] == self.vh_truth[3])
+ self.assertNotEqual(vhs[0], self.vh_truth[3])
@mock.patch("certbot_apache._internal.configurator.ApacheConfigurator.make_vhost_ssl")
def test_choose_vhosts_wildcard_no_ssl(self, mock_makessl):
@@ -1471,10 +1471,10 @@ class MultipleVhostsTest(util.ApacheTest):
self.config.parser.aug.match = mock_match
vhs = self.config.get_virtual_hosts()
self.assertEqual(len(vhs), 2)
- self.assertTrue(vhs[0] == self.vh_truth[1])
+ self.assertEqual(vhs[0], self.vh_truth[1])
# mock_vhost should have replaced the vh_truth[0], because its filepath
# isn't a symlink
- self.assertTrue(vhs[1] == mock_vhost)
+ self.assertEqual(vhs[1], mock_vhost)
class AugeasVhostsTest(util.ApacheTest):
diff --git a/certbot-apache/tests/dualnode_test.py b/certbot-apache/tests/dualnode_test.py
index 44cc69ff4..ef7f8b2d8 100644
--- a/certbot-apache/tests/dualnode_test.py
+++ b/certbot-apache/tests/dualnode_test.py
@@ -412,9 +412,9 @@ class DualParserNodeTest(unittest.TestCase): # pylint: disable=too-many-public-
ancestor=self.block,
filepath="/path/to/whatever",
metadata=self.metadata)
- self.assertFalse(self.block == ne_block)
- self.assertFalse(self.directive == ne_directive)
- self.assertFalse(self.comment == ne_comment)
+ self.assertNotEqual(self.block, ne_block)
+ self.assertNotEqual(self.directive, ne_directive)
+ self.assertNotEqual(self.comment, ne_comment)
def test_parsed_paths(self):
mock_p = mock.MagicMock(return_value=['/path/file.conf',
diff --git a/certbot-apache/tests/obj_test.py b/certbot-apache/tests/obj_test.py
index eac6a64ef..8aae3ad45 100644
--- a/certbot-apache/tests/obj_test.py
+++ b/certbot-apache/tests/obj_test.py
@@ -27,14 +27,14 @@ class VirtualHostTest(unittest.TestCase):
"certbot_apache._internal.obj.Addr(('127.0.0.1', '443'))")
def test_eq(self):
- self.assertTrue(self.vhost1b == self.vhost1)
- self.assertFalse(self.vhost1 == self.vhost2)
+ self.assertEqual(self.vhost1b, self.vhost1)
+ self.assertNotEqual(self.vhost1, self.vhost2)
self.assertEqual(str(self.vhost1b), str(self.vhost1))
- self.assertFalse(self.vhost1b == 1234)
+ self.assertNotEqual(self.vhost1b, 1234)
def test_ne(self):
- self.assertTrue(self.vhost1 != self.vhost2)
- self.assertFalse(self.vhost1 != self.vhost1b)
+ self.assertNotEqual(self.vhost1, self.vhost2)
+ self.assertEqual(self.vhost1, self.vhost1b)
def test_conflicts(self):
from certbot_apache._internal.obj import Addr
@@ -128,13 +128,13 @@ class AddrTest(unittest.TestCase):
self.assertTrue(self.addr1.conflicts(self.addr2))
def test_equal(self):
- self.assertTrue(self.addr1 == self.addr2)
- self.assertFalse(self.addr == self.addr1)
- self.assertFalse(self.addr == 123)
+ self.assertEqual(self.addr1, self.addr2)
+ self.assertNotEqual(self.addr, self.addr1)
+ self.assertNotEqual(self.addr, 123)
def test_not_equal(self):
- self.assertFalse(self.addr1 != self.addr2)
- self.assertTrue(self.addr != self.addr1)
+ self.assertEqual(self.addr1, self.addr2)
+ self.assertNotEqual(self.addr, self.addr1)
if __name__ == "__main__":