From 0622874187c1d1608c94cfe1e31770a90c508bd8 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Thu, 4 Dec 2025 14:40:17 +0530 Subject: [PATCH] Update OAuth and User tests to store authtoken after successful login --- test/sanity-check/api/oauth-test.js | 3 ++- test/sanity-check/api/user-test.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/sanity-check/api/oauth-test.js b/test/sanity-check/api/oauth-test.js index c06dc556..53712229 100644 --- a/test/sanity-check/api/oauth-test.js +++ b/test/sanity-check/api/oauth-test.js @@ -24,6 +24,7 @@ const oauthClient = client.oauth({ describe('OAuth Authentication API Test', () => { it('should login with credentials', done => { client.login({ email: process.env.EMAIL, password: process.env.PASSWORD }, { include_orgs: true, include_orgs_roles: true, include_stack_roles: true, include_user_settings: true }).then((response) => { + authtoken = response.user.authtoken expect(response.notice).to.be.equal('Login Successful.', 'Login success messsage does not match.') done() }) @@ -32,7 +33,7 @@ describe('OAuth Authentication API Test', () => { it('should get Current user info test', done => { client.getUser().then((user) => { - authtoken = user.authtoken + expect(user.uid).not.to.be(undefined) done() }) .catch(done) diff --git a/test/sanity-check/api/user-test.js b/test/sanity-check/api/user-test.js index 8010834d..ff1a3574 100644 --- a/test/sanity-check/api/user-test.js +++ b/test/sanity-check/api/user-test.js @@ -50,6 +50,7 @@ describe('Contentstack User Session api Test', () => { client.login({ email: process.env.EMAIL, password: process.env.PASSWORD }, { include_orgs: true, include_orgs_roles: true, include_stack_roles: true, include_user_settings: true }).then((response) => { loggedinUserID = response.user.uid jsonWrite(response.user, 'loggedinuser.json') + authtoken = response.user.authtoken expect(response.notice).to.be.equal('Login Successful.', 'Login success messsage does not match.') done() }) @@ -58,7 +59,6 @@ describe('Contentstack User Session api Test', () => { it('should get Current user info test', done => { client.getUser().then((user) => { - authtoken = user.authtoken expect(user.uid).to.be.equal(loggedinUserID) done() })