Add tests for invalid address book operations
This commit is contained in:
parent
9ef2ea64be
commit
bbbcfb49f0
1 changed files with 35 additions and 0 deletions
|
@ -43,6 +43,24 @@
|
||||||
$this->assertTrue($aliceClient->addressBookContactExists($johnClient->getIdentifiedAs()));
|
$this->assertTrue($aliceClient->addressBookContactExists($johnClient->getIdentifiedAs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws RpcException
|
||||||
|
* @throws ResolutionException
|
||||||
|
* @throws CryptographyException
|
||||||
|
* @throws DatabaseOperationException
|
||||||
|
*/
|
||||||
|
public function testAddressBookAddInvalidAddress(): void
|
||||||
|
{
|
||||||
|
$johnClient = Helper::generateRandomClient(TEAPOT_DOMAIN, prefix: 'johnAddressBookTest');
|
||||||
|
$johnClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe');
|
||||||
|
$johnClient->settingsSetPassword('SecretTestingPassword123');
|
||||||
|
$this->assertTrue($johnClient->getSessionState()->isAuthenticated());
|
||||||
|
|
||||||
|
$this->expectException(RpcException::class);
|
||||||
|
$this->expectExceptionCode(StandardError::RPC_INVALID_ARGUMENTS->value);
|
||||||
|
$johnClient->addressBookAddContact('invalid invalid invalid');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ResolutionException
|
* @throws ResolutionException
|
||||||
* @throws RpcException
|
* @throws RpcException
|
||||||
|
@ -617,6 +635,23 @@
|
||||||
$this->assertFalse($johnClient->addressBookDeleteContact(Helper::generateRandomPeer($johnClient->getIdentifiedAs()->getDomain())));
|
$this->assertFalse($johnClient->addressBookDeleteContact(Helper::generateRandomPeer($johnClient->getIdentifiedAs()->getDomain())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws RpcException
|
||||||
|
* @throws ResolutionException
|
||||||
|
* @throws CryptographyException
|
||||||
|
* @throws DatabaseOperationException
|
||||||
|
*/
|
||||||
|
public function testDeleteInvalidContact(): void
|
||||||
|
{
|
||||||
|
$johnClient = Helper::generateRandomClient(TEAPOT_DOMAIN, prefix: 'johnAddressBookTest');
|
||||||
|
$this->assertTrue($johnClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe', PrivacyState::PUBLIC));
|
||||||
|
$this->assertTrue($johnClient->settingsSetPassword('SecretTestingPassword123'));
|
||||||
|
|
||||||
|
$this->expectException(RpcException::class);
|
||||||
|
$this->expectExceptionCode(StandardError::RPC_INVALID_ARGUMENTS->value);
|
||||||
|
$this->assertFalse($johnClient->addressBookDeleteContact('invalid invalid invalid'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws DatabaseOperationException
|
* @throws DatabaseOperationException
|
||||||
* @throws ResolutionException
|
* @throws ResolutionException
|
||||||
|
|
Loading…
Add table
Reference in a new issue