# -----------------------------------------------------------------------
def process_contact(self, contact):
- if self._friends_by_contact.has_key(contact):
- return
+ if self._friends_by_contact.has_key(contact) or \
+ self._match_contact_to_friend_by_urls(contact) or \
+ self._match_contact_to_friend_by_identifiers(contact):
+ return self._get_friend_by_contact(contact)
- if self._match_contact_to_friend_by_urls(contact):
- return
-
- self._match_contact_to_friend_by_identifiers(contact)
+ return None
# -----------------------------------------------------------------------
# -----------------------------------------------------------------------
def _get_tweeters(self):
return self._twitter.GetFriends()
+
+
+ # -----------------------------------------------------------------------
+ def _get_friend_by_contact(self, contact):
+ return self._friends_by_contact[contact]
def _match_contact_to_friend_by_urls(self, contact):
def _register_match(self, contact, friend):
+ friend.set_contact(contact)
self._friends_by_contact[contact] = friend
self._friends.remove(friend)
matchers = self.testee.get_contacts_with_match()
assert contact in matchers
assert twitterName == matchers[contact].get_name()
+ assert contact == self.testee._get_friend_by_contact(contact)['contact']
def test_name_collision_avoided_by_previous_matching(self):
assert len(self.testee.get_unmatched_friends()) == 1
matchers = self.testee.get_contacts_with_match()
assert contact in matchers
+ assert contact == self.testee._get_friend_by_contact(contact)['contact']
def test_name_collision_avoided_only_one_person_matched(self):
matchers = self.testee.get_contacts_with_match()
assert contact in matchers
assert screen_name == matchers[contact].get_nickname()
+ assert contact == matchers[contact]['contact']
+ assert contact == self.testee._get_friend_by_contact(contact)['contact']
def _exercise_service(self, contacts):