This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test smtp settings endpoint support (#181)
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import * as chai from 'chai'; | |
import {KeycloakAdminClient} from '../src/client'; | ||
import {credentials} from './constants'; | ||
import faker from 'faker'; | ||
import {fail} from 'assert'; | ||
const expect = chai.expect; | ||
|
||
|
||
|
@@ -257,7 +258,7 @@ describe('Realms', () => { | |
}); | ||
}); | ||
|
||
describe('Realm test ldap settings', () => { | ||
describe('Realm connection settings', () => { | ||
it('should fail with invalid ldap settings', async () => { | ||
try { | ||
await kcAdminClient.realms.testLDAPConnection({realm: 'master'}, { | ||
|
@@ -270,6 +271,23 @@ describe('Realms', () => { | |
startTls: '', | ||
useTruststoreSpi: 'ldapsOnly', | ||
}); | ||
fail('exception should have been thrown'); | ||
} catch (error) { | ||
expect(error).to.be.ok; | ||
} | ||
}); | ||
|
||
it('should fail with invalid smtp settings', async () => { | ||
try { | ||
const user = (await kcAdminClient.users.find({username: credentials.username}))[0]; | ||
user.email = '[email protected]'; | ||
await kcAdminClient.users.update({id: user.id!}, user); | ||
await kcAdminClient.realms.testSMTPConnection({realm: 'master'}, { | ||
from: '[email protected]', | ||
host: 'localhost', | ||
port: 3025, | ||
}); | ||
fail('exception should have been thrown'); | ||
} catch (error) { | ||
expect(error).to.be.ok; | ||
} | ||
|