tests.py fix

This commit is contained in:
ingvar1995 2016-10-23 00:43:18 +03:00
parent b807daa3ff
commit 3a90865fd0
3 changed files with 6 additions and 7 deletions

View File

@ -57,12 +57,10 @@ class TestFriend:
ProfileHelper('', 'test') ProfileHelper('', 'test')
def create_friend(self, name, status_message, number, tox_id): def create_friend(self, name, status_message, number, tox_id):
message_getter = None friend = Friend(None, number, name, status_message, None, tox_id)
friend = Friend(message_getter, number, name, status_message, ContactItem(), tox_id)
return friend return friend
def test_friend_creation(self): def test_friend_creation(self):
app = QtGui.QApplication(sys.argv)
self.create_singletons() self.create_singletons()
name, status_message, number = 'Friend', 'I am friend!', 0 name, status_message, number = 'Friend', 'I am friend!', 0
tox_id = '76518406F6A9F2217E8DC487CC783C25CC16A15EB36FF32E335A235342C48A39218F515C39A6' tox_id = '76518406F6A9F2217E8DC487CC783C25CC16A15EB36FF32E335A235342C48A39218F515C39A6'

View File

@ -22,10 +22,11 @@ class BaseContact:
""" """
self._name, self._status_message = name, status_message self._name, self._status_message = name, status_message
self._status, self._widget = None, widget self._status, self._widget = None, widget
self._widget.name.setText(name)
self._widget.status_message.setText(status_message)
self._tox_id = tox_id 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 # name - current name or alias of user

View File

@ -25,7 +25,7 @@ class Friend(contact.Contact):
""" """
try: try:
tr = list(filter(lambda x: x.get_type() == MESSAGE_TYPE['FILE_TRANSFER'] and x.is_active(file_number), 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) tr.set_status(status)
i = self._corr.index(tr) i = self._corr.index(tr)
if inline: # inline was loaded if inline: # inline was loaded