def test_match_filtered_identities(self): """Test whether filtered identities match""" jsmith = EmailIdentity('1', None, '*****@*****.**') jsmith_alt = EmailIdentity('2', 'jsmith', '*****@*****.**') jsmith_uuid = EmailIdentity('3', 'jsmith', '*****@*****.**') matcher = EmailMatcher() result = matcher.match_filtered_identities(jsmith, jsmith_alt) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith, jsmith_uuid) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith_alt, jsmith) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_alt, jsmith_uuid) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_uuid, jsmith) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith_uuid, jsmith_alt) self.assertEqual(result, True)
def test_match_filtered_identities(self): """Test whether filtered identities match""" jsmith = EmailIdentity('1', None, '*****@*****.**') jsmith_alt = EmailIdentity('2', 'jsmith', '*****@*****.**') jsmith_uuid = EmailIdentity('3', 'jsmith', '*****@*****.**') matcher = EmailMatcher() result = matcher.match_filtered_identities(jsmith, jsmith_alt) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith, jsmith_uuid) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith_alt, jsmith) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_alt, jsmith_uuid) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_uuid, jsmith) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith_uuid, jsmith_alt) self.assertEqual(result, True)
def test_match_filtered_identities_with_blacklist(self): """Test whether filtered identities match when there is a blacklist""" jsmith = EmailIdentity('1', None, '*****@*****.**') jsmith_alt = EmailIdentity('2', 'jsmith', '*****@*****.**') jsmith_uuid = EmailIdentity('3', 'jsmith', '*****@*****.**') john_alt = EmailIdentity('4', None, '*****@*****.**') jsmith_none = EmailIdentity('4', '*****@*****.**', None) jdoe_none = EmailIdentity('4', '*****@*****.**', None) bl = [MatchingBlacklist(excluded='*****@*****.**')] matcher = EmailMatcher(blacklist=bl) result = matcher.match_filtered_identities(jsmith, jsmith_alt) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith, jsmith_uuid) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith_alt, jsmith) self.assertEqual(result, False) # Same UUID result = matcher.match_filtered_identities(jsmith_alt, jsmith_uuid) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_uuid, jsmith) self.assertEqual(result, False) # Same UUID result = matcher.match_filtered_identities(jsmith_uuid, jsmith_alt) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_uuid, john_alt) self.assertEqual(result, True) result = matcher.match_filtered_identities(john_alt, jsmith_uuid) self.assertEqual(result, True) # Although the UUID is equal to None, these two does not match result = matcher.match_filtered_identities(jsmith_none, jdoe_none) self.assertEqual(result, False)
def test_match_filtered_identities_with_blacklist(self): """Test whether filtered identities match when there is a blacklist""" jsmith = EmailIdentity('1', None, '*****@*****.**') jsmith_alt = EmailIdentity('2', 'jsmith', '*****@*****.**') jsmith_uuid = EmailIdentity('3', 'jsmith', '*****@*****.**') john_alt = EmailIdentity('4', None, '*****@*****.**') jsmith_none = EmailIdentity('4', '*****@*****.**', None) jdoe_none = EmailIdentity('4', '*****@*****.**', None) bl = [MatchingBlacklist(excluded='*****@*****.**')] matcher = EmailMatcher(blacklist=bl) result = matcher.match_filtered_identities(jsmith, jsmith_alt) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith, jsmith_uuid) self.assertEqual(result, False) result = matcher.match_filtered_identities(jsmith_alt, jsmith) self.assertEqual(result, False) # Same UUID result = matcher.match_filtered_identities(jsmith_alt, jsmith_uuid) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_uuid, jsmith) self.assertEqual(result, False) # Same UUID result = matcher.match_filtered_identities(jsmith_uuid, jsmith_alt) self.assertEqual(result, True) result = matcher.match_filtered_identities(jsmith_uuid, john_alt) self.assertEqual(result, True) result = matcher.match_filtered_identities(john_alt, jsmith_uuid) self.assertEqual(result, True) # Although the UUID is equal to None, these two does not match result = matcher.match_filtered_identities(jsmith_none, jdoe_none) self.assertEqual(result, False)