Skip to content

Commit 92a9232

Browse files
Chan Chak ShingHainish
authored andcommitted
Add Test for duplicated test URLs, Fix EFForg#14659 (EFForg#14660)
1 parent a2c0fe9 commit 92a9232

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/rules/src/https_everywhere_checker/rules.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ def __init__(self, url):
8080
"""
8181
self.url = url
8282

83+
def __eq__(test1, test2):
84+
return test1.url == test2.url
85+
86+
def __hash__(self):
87+
return self.url.__hash__()
8388

8489
class Ruleset(object):
8590
"""Represents one XML ruleset file."""
@@ -176,6 +181,14 @@ def _determineTestApplication(self):
176181
off that rule or exclusion. Return any coverage problems."""
177182
if not self.determine_test_application_run:
178183
self.test_application_problems = []
184+
185+
# check for duplicated test urls
186+
if len(self.tests) != len(set(self.tests)):
187+
for test in set(self.tests):
188+
if self.tests.count(test) > 1:
189+
self.test_application_problems.append("%s: Duplicated test URL found %s" % (
190+
self.filename, test.url))
191+
179192
for test in self.tests:
180193
applies = self.whatApplies(test.url)
181194
if applies:

utils/ruleset-whitelist.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
hash,auto-pass coverage test,auto-pass fetch test,filename
2+
5785b7928af742599dbf3692f62c264e402cab98cca3700d411fb2f2993c03b3,1,0,Samsung.xml
23
fbb2d56d33f886b53c314eac3446eed8bad7916660ad0709367936fe8335d987,0,1,112_Cafe.com.xml
34
43a7a917b89600c8dd3495359879ad1dfe468d9a478e63d5bbc6430a31cc41c2,1,1,123-reg.xml
45
5b650e2b6084539440a1b66b5b45f5825a2d61db7812c7521e1a1e0860c4b6a3,1,1,16163.com.xml

0 commit comments

Comments
 (0)