Skip to content

Commit 8b4b08d

Browse files
committed
reorganize
1 parent d789b21 commit 8b4b08d

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

test/integration/auth/mongodb_oidc.prose.test.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,13 @@ describe('OIDC Auth Spec Tests', function () {
576576
// - Assert there were `SaslStart` commands executed.
577577
// - Close the client.
578578
beforeEach(async function () {
579+
utilClient = new MongoClient(uriSingle, {
580+
authMechanismProperties: {
581+
OIDC_CALLBACK: createCallback()
582+
},
583+
retryReads: false
584+
});
585+
579586
client = new MongoClient(uriSingle, {
580587
authMechanismProperties: {
581588
OIDC_CALLBACK: callbackSpy
@@ -588,6 +595,7 @@ describe('OIDC Auth Spec Tests', function () {
588595
saslStarts.push(event);
589596
}
590597
});
598+
591599
const provider = client.s.authProviders.getOrCreateProvider('MONGODB-OIDC', {
592600
OIDC_CALLBACK: callbackSpy
593601
}) as MongoDBOIDC;
@@ -597,18 +605,21 @@ describe('OIDC Auth Spec Tests', function () {
597605

598606
provider.workflow.cache.put({ accessToken: token });
599607
collection = client.db('test').collection('test');
608+
});
600609

610+
afterEach(async function () {
611+
await utilClient.db().admin().command({
612+
configureFailPoint: 'failCommand',
613+
mode: 'off'
614+
});
615+
await utilClient.close();
616+
});
617+
618+
it('successfully authenticates', async function () {
601619
await collection.insertOne({ name: 'test' });
602620
expect(callbackSpy).to.not.have.been.called;
603621
expect(saslStarts).to.be.empty;
604622

605-
utilClient = new MongoClient(uriSingle, {
606-
authMechanismProperties: {
607-
OIDC_CALLBACK: createCallback()
608-
},
609-
retryReads: false
610-
});
611-
612623
await utilClient
613624
.db()
614625
.admin()
@@ -622,17 +633,7 @@ describe('OIDC Auth Spec Tests', function () {
622633
errorCode: 391
623634
}
624635
});
625-
});
626636

627-
afterEach(async function () {
628-
await utilClient.db().admin().command({
629-
configureFailPoint: 'failCommand',
630-
mode: 'off'
631-
});
632-
await utilClient.close();
633-
});
634-
635-
it('successfully authenticates', async function () {
636637
await collection.insertOne({ name: 'test' });
637638
expect(callbackSpy).to.have.been.calledOnce;
638639
expect(saslStarts.length).to.equal(1);

0 commit comments

Comments
 (0)