-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let dovecot api behave like current checkpasswd
- Loading branch information
Showing
3 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ public function testPassdbUser(): void | |
$client = static::createClient([], [ | ||
'HTTP_Authorization' => 'Bearer insecure', | ||
]); | ||
$client->request('POST', '/api/dovecot/passdb/[email protected]', ['password' => 'password']); | ||
$client->request('POST', '/api/dovecot/1/passdb/[email protected]', ['password' => 'password']); | ||
|
||
self::assertResponseStatusCodeSame(200); | ||
} | ||
|
@@ -31,7 +31,7 @@ public function testPassdbUserWrongPassword(): void | |
$client = static::createClient([], [ | ||
'HTTP_Authorization' => 'Bearer insecure', | ||
]); | ||
$client->request('POST', '/api/dovecot/passdb/[email protected]', ['password' => 'wrong']); | ||
$client->request('POST', '/api/dovecot/1/passdb/[email protected]', ['password' => 'wrong']); | ||
|
||
self::assertResponseStatusCodeSame(403); | ||
} | ||
|
@@ -41,7 +41,7 @@ public function testPassdbNonexistentUser(): void | |
$client = static::createClient([], [ | ||
'HTTP_Authorization' => 'Bearer insecure', | ||
]); | ||
$client->request('POST', '/api/dovecot/passdb/[email protected]'); | ||
$client->request('POST', '/api/dovecot/1/passdb/[email protected]', ['password' => 'password']); | ||
|
||
self::assertResponseStatusCodeSame(404); | ||
} | ||
|
@@ -51,11 +51,23 @@ public function testPassdbSpamUser(): void | |
$client = static::createClient([], [ | ||
'HTTP_Authorization' => 'Bearer insecure', | ||
]); | ||
$client->request('POST', '/api/dovecot/[email protected]'); | ||
$client->request('POST', '/api/dovecot/1/passdb/[email protected]', ['password' => 'password']); | ||
|
||
self::assertResponseStatusCodeSame(404); | ||
} | ||
|
||
public function testPassdbMailCrypt(): void | ||
{ | ||
$client = static::createClient([], [ | ||
'HTTP_Authorization' => 'Bearer insecure', | ||
]); | ||
$client->request('POST', '/api/dovecot/3/passdb/[email protected]', ['password' => 'password']); | ||
|
||
self::assertResponseStatusCodeSame(200); | ||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR); | ||
self::assertNotEquals($data['body']['privateKey'], ''); | ||
} | ||
|
||
public function testUserdbUser(): void | ||
{ | ||
$client = static::createClient([], [ | ||
|
@@ -69,7 +81,7 @@ public function testUserdbUser(): void | |
self::assertEquals($data['message'], 'success'); | ||
self::assertEquals($data['body']['email'], '[email protected]'); | ||
self::assertEquals($data['body']['domain'], 'example.org'); | ||
self::assertEquals($data['body']['pubkey'], ''); | ||
self::assertEquals($data['body']['publicKey'], ''); | ||
} | ||
|
||
public function testUserdbMailcrypt(): void | ||
|
@@ -83,7 +95,7 @@ public function testUserdbMailcrypt(): void | |
|
||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR); | ||
self::assertEquals($data['message'], 'success'); | ||
self::assertNotEquals($data['body']['pubkey'], ''); | ||
self::assertNotEquals($data['body']['publicKey'], ''); | ||
} | ||
|
||
public function testUserdbNonexistentUser(): void | ||
|