diff --git a/letsencrypt/client/apache/configurator.py b/letsencrypt/client/apache/configurator.py index b4b5e4d20..20d568dba 100644 --- a/letsencrypt/client/apache/configurator.py +++ b/letsencrypt/client/apache/configurator.py @@ -480,8 +480,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): ssl_addrs.add(ssl_addr) # Add directives - vh_p = self.aug.match(("/files%s//* [label()=~regexp('%s')]" % - (ssl_fp, parser.case_i('VirtualHost')))) + vh_p = self.aug.match("/files%s//* [label()=~regexp('%s')]" % + (ssl_fp, parser.case_i('VirtualHost'))) if len(vh_p) != 1: logging.error("Error: should only be one vhost in %s", avail_fp) sys.exit(1) diff --git a/letsencrypt/client/apache/obj.py b/letsencrypt/client/apache/obj.py index aeddee443..c4a481acd 100644 --- a/letsencrypt/client/apache/obj.py +++ b/letsencrypt/client/apache/obj.py @@ -23,8 +23,8 @@ class Addr(object): return self.tup[0] def __eq__(self, other): - if type(other) is type(self): - return self.__dict__ == other.__dict__ + if isinstance(other, self.__class__): + return self.tup == other.tup return False def __hash__(self): diff --git a/letsencrypt/client/apache/parser.py b/letsencrypt/client/apache/parser.py index 7a4691416..9d92e9271 100644 --- a/letsencrypt/client/apache/parser.py +++ b/letsencrypt/client/apache/parser.py @@ -349,7 +349,7 @@ class ApacheParser(object): # Basic check to see if httpd.conf exists and # in heirarchy via direct include # httpd.conf was very common as a user file in Apache 2.2 - if (os.path.isfile(self.root + 'httpd.conf') and + if (os.path.isfile(os.path.join(self.root, 'httpd.conf')) and self.find_dir( case_i("Include"), case_i("httpd.conf"), root)): return os.path.join(self.root, 'httpd.conf') diff --git a/letsencrypt/client/tests/apache_configurator_test.py b/letsencrypt/client/tests/apache_configurator_test.py index 7084d10c6..20eb6e0c9 100644 --- a/letsencrypt/client/tests/apache_configurator_test.py +++ b/letsencrypt/client/tests/apache_configurator_test.py @@ -116,7 +116,7 @@ class TwoVhost80Test(unittest.TestCase): self.assertEqual(ssl_vhost.path, "/files" + ssl_vhost.filep + "/IfModule/VirtualHost") self.assertEqual(len(ssl_vhost.addrs), 1) - self.assertTrue(set([obj.Addr.fromstring("*:443")]) == ssl_vhost.addrs) + self.assertEqual(set([obj.Addr.fromstring("*:443")]), ssl_vhost.addrs) self.assertEqual(ssl_vhost.names, set(["encryption-example.demo"])) self.assertTrue(ssl_vhost.ssl) self.assertFalse(ssl_vhost.enabled) diff --git a/letsencrypt/client/tests/apache_obj_test.py b/letsencrypt/client/tests/apache_obj_test.py index fb13b051a..46e76d4bd 100644 --- a/letsencrypt/client/tests/apache_obj_test.py +++ b/letsencrypt/client/tests/apache_obj_test.py @@ -41,7 +41,6 @@ class AddrTest(unittest.TestCase): addr2b = obj.Addr.fromstring("192.168.1.1:*") set_b = set([addr1b, addr2b]) - self.assertTrue(addr1b in set_a) self.assertEqual(set_a, set_b) @@ -59,4 +58,4 @@ class VirtualHostTest(unittest.TestCase): self.assertEqual(vhost1b, self.vhost1) self.assertEqual(str(vhost1b), str(self.vhost1)) - self.assertTrue(vhost1b != 1234) + self.assertNotEqual(vhost1b, 1234) diff --git a/letsencrypt/client/tests/apache_parser_test.py b/letsencrypt/client/tests/apache_parser_test.py index 259d974e1..baf5c746e 100644 --- a/letsencrypt/client/tests/apache_parser_test.py +++ b/letsencrypt/client/tests/apache_parser_test.py @@ -12,7 +12,7 @@ from letsencrypt.client.apache import parser from letsencrypt.client.tests import config_util -class BasicParseTests(unittest.TestCase): +class ApacheParserTest(unittest.TestCase): def setUp(self): display.set_display(display.FileDisplay(sys.stdout)) @@ -55,8 +55,7 @@ class BasicParseTests(unittest.TestCase): self.assertTrue(matches) def test_find_dir(self): - test = self.parser.find_dir( - parser.case_i("Listen"), "443") + test = self.parser.find_dir(parser.case_i("Listen"), "443") # This will only look in enabled hosts test2 = self.parser.find_dir( parser.case_i("documentroot")) @@ -65,8 +64,7 @@ class BasicParseTests(unittest.TestCase): def test_add_dir(self): aug_default = "/files" + self.parser.loc["default"] - self.parser.add_dir( - aug_default, "AddDirective", "test") + self.parser.add_dir(aug_default, "AddDirective", "test") self.assertTrue( self.parser.find_dir("AddDirective", "test", aug_default)) diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py index aa18541ee..1bc77bfa7 100755 --- a/letsencrypt/scripts/main.py +++ b/letsencrypt/scripts/main.py @@ -184,7 +184,6 @@ def determine_authenticator(): def determine_installer(): """Returns a valid installer if one exists.""" try: - print "shouldn't ha;ppppen!!!!!!!!!!!!!!!!!!!" return configurator.ApacheConfigurator() except errors.LetsEncryptConfiguratorError: logging.info("Unable to find a way to install the certificate.")