Reproduce the bug described in #1898 using test_addressbook()

This commit is contained in:
Dmitri Bogomolov 2021-12-11 15:44:56 +02:00
parent 154ecc410c
commit bfe7dd16e9
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -58,7 +58,8 @@ class TestAPI(TestAPIProto):
_seed = base64.encodestring(sample_seed) _seed = base64.encodestring(sample_seed)
def _add_random_address(self, label): def _add_random_address(self, label):
return self.api.createRandomAddress(base64.encodestring(label)) addr = self.api.createRandomAddress(base64.encodestring(label))
return addr
def test_user_password(self): def test_user_password(self):
"""Trying to connect with wrong username/password""" """Trying to connect with wrong username/password"""
@ -243,6 +244,15 @@ class TestAPI(TestAPIProto):
entries['address'], sample_deterministic_addr4) entries['address'], sample_deterministic_addr4)
self.assertEqual( self.assertEqual(
base64.decodestring(entries['label']), 'tiger_4') base64.decodestring(entries['label']), 'tiger_4')
# Try sending to this address (#1898)
addr = self._add_random_address('random_2')
# TODO: it was never deleted
msg = base64.encodestring('test message')
msg_subject = base64.encodestring('test_subject')
result = self.api.sendMessage(
sample_deterministic_addr4, addr, msg_subject, msg)
self.assertNotRegexpMatches(result, r'^API Error')
self.api.deleteAddress(addr)
# Remove known address # Remove known address
self.api.deleteAddressBookEntry(sample_deterministic_addr4) self.api.deleteAddressBookEntry(sample_deterministic_addr4)
# Addressbook should be empty again # Addressbook should be empty again