From 3a90865fd0c59d32a9a12ced62150f4fe99f6b76 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 23 Oct 2016 00:43:18 +0300 Subject: [PATCH] tests.py fix --- tests/tests.py | 4 +--- toxygen/basecontact.py | 7 ++++--- toxygen/friend.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index a7300d8..36906a0 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -57,12 +57,10 @@ class TestFriend: ProfileHelper('', 'test') def create_friend(self, name, status_message, number, tox_id): - message_getter = None - friend = Friend(message_getter, number, name, status_message, ContactItem(), tox_id) + friend = Friend(None, number, name, status_message, None, tox_id) return friend def test_friend_creation(self): - app = QtGui.QApplication(sys.argv) self.create_singletons() name, status_message, number = 'Friend', 'I am friend!', 0 tox_id = '76518406F6A9F2217E8DC487CC783C25CC16A15EB36FF32E335A235342C48A39218F515C39A6' diff --git a/toxygen/basecontact.py b/toxygen/basecontact.py index 82f95b6..2bd407f 100644 --- a/toxygen/basecontact.py +++ b/toxygen/basecontact.py @@ -22,10 +22,11 @@ class BaseContact: """ self._name, self._status_message = name, status_message self._status, self._widget = None, widget - self._widget.name.setText(name) - self._widget.status_message.setText(status_message) self._tox_id = tox_id - self.load_avatar() + if self._widget is not None: + self._widget.name.setText(name) + self._widget.status_message.setText(status_message) + self.load_avatar() # ----------------------------------------------------------------------------------------------------------------- # name - current name or alias of user diff --git a/toxygen/friend.py b/toxygen/friend.py index a237ef3..5991b36 100644 --- a/toxygen/friend.py +++ b/toxygen/friend.py @@ -25,7 +25,7 @@ class Friend(contact.Contact): """ try: tr = list(filter(lambda x: x.get_type() == MESSAGE_TYPE['FILE_TRANSFER'] and x.is_active(file_number), - self._corr))[0] + self._corr))[0] tr.set_status(status) i = self._corr.index(tr) if inline: # inline was loaded