Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration TestCases #430

Open
wants to merge 31 commits into
base: release_3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e19a924
Integrations TestCases
sumanvpacewisdom Feb 26, 2024
db9d6b1
Merge remote-tracking branch 'upstream/develop' into dev-develop
sumanvpacewisdom Feb 26, 2024
9c89e62
organizations testcases
sumanvpacewisdom Mar 13, 2024
3ebb56e
Merge remote-tracking branch 'upstream/develop' into dev-develop
sumanvpacewisdom Mar 19, 2024
be6f151
Audit Bugs - 1148 , 1152 , 1153
sumanvpacewisdom Mar 19, 2024
5c82e3d
Merge branch 'dev-develop' of https://github.com/sumanvpacewisdom/use…
sumanvpacewisdom Mar 19, 2024
cf1f1e6
Merge pull request #446 from ELEVATE-Project/develop
rakeshSgr Mar 19, 2024
e1191b9
Merge remote-tracking branch 'upstream/develop' into dev-develop
sumanvpacewisdom Mar 22, 2024
59a2072
envVariable changes
sumanvpacewisdom Mar 22, 2024
36a8513
Merge pull request #457 from ELEVATE-Project/develop
rakeshSgr Mar 22, 2024
a7c0a76
Merge pull request #462 from ELEVATE-Project/develop
rakeshSgr Mar 26, 2024
89e6939
Updated 2.5 Docs
joffinjoy Mar 27, 2024
fb2767c
Merge pull request #466 from ELEVATE-Project/master-doc
joffinjoy Mar 27, 2024
508834b
Merge pull request #468 from ELEVATE-Project/develop
rakeshSgr Mar 28, 2024
ec6523e
Merge pull request #472 from ELEVATE-Project/develop
rakeshSgr Mar 28, 2024
68e5e4f
Merge pull request #478 from ELEVATE-Project/develop
rakeshSgr Apr 1, 2024
d5c7d88
Merge to Integration Changes
sumanvpacewisdom Apr 3, 2024
09bccab
Removing unwanted changes
sumanvpacewisdom Apr 3, 2024
dd56b52
Postgres setup
sumanvpacewisdom Apr 3, 2024
79f4986
Merge pull request #483 from ELEVATE-Project/develop
joffinjoy Apr 4, 2024
aace795
Merge pull request #485 from ELEVATE-Project/develop
rakeshSgr Apr 5, 2024
8583588
bulkuser
sumanvpacewisdom Apr 5, 2024
a373b3d
Merge remote-tracking branch 'upstream/develop' into dev-develop
sumanvpacewisdom Apr 5, 2024
7b7a070
Merge branch 'master' into staging
rakeshSgr Apr 8, 2024
a2f5cf2
Merge pull request #486 from ELEVATE-Project/staging
rakeshSgr Apr 8, 2024
2e4d0a8
Comment chnages 10/04/2024
sumanvpacewisdom Apr 10, 2024
f45d240
package json updated
Apr 15, 2024
c0f3cd1
Merge pull request #487 from ELEVATE-Project/package_update_2.6.1
rakeshSgr Apr 15, 2024
71b7b94
Merge pull request #488 from ELEVATE-Project/staging
rakeshSgr Apr 16, 2024
ea19291
Bulk session creations internal api
sumanvpacewisdom Apr 18, 2024
55b3308
Merge branch 'ELEVATE-Project:master' into dev-develop
sumanvpacewisdom Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ Refer to [Kafka Ubuntu 22.04 setup guide](https://www.fosstechnix.com/install-ap

4. Reload systemd:


```bash
$ sudo systemctl daemon-reload
```
Expand Down Expand Up @@ -275,7 +274,6 @@ Refer to [Kafka Ubuntu 22.04 setup guide](https://www.fosstechnix.com/install-ap

### Install Redis


Refer to [Redis Ubuntu 22.04 setup guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-22-04)

1. Update the package list:
Expand Down
1 change: 1 addition & 0 deletions src/controllers/v1/cloud-services/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = class File {
*/
async getSignedUrl(req) {
try {
//console.log("req signed url",req)
sumanvpacewisdom marked this conversation as resolved.
Show resolved Hide resolved
const signedUrlResponse = await filesService.getSignedUrl(
req.query.fileName,
req.decodedToken.id,
Expand Down
2 changes: 1 addition & 1 deletion src/database/models/user-role.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
const common = require('@constants/common')
const common = require('../../constants/common')
sumanvpacewisdom marked this conversation as resolved.
Show resolved Hide resolved
module.exports = (sequelize, DataTypes) => {
const defaultOrgId = sequelize.options.defaultOrgId
const UserRole = sequelize.define(
Expand Down
2 changes: 1 addition & 1 deletion src/generics/form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const formsQueries = require('@database/queries/form')
const formsQueries = require('../database/queries/form')
sumanvpacewisdom marked this conversation as resolved.
Show resolved Hide resolved

//const utils = require('@generics/utils')
async function getAllFormsVersion() {
Expand Down
2 changes: 1 addition & 1 deletion src/generics/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const getDownloadableUrl = async (imgPath) => {
gcpJsonFilePath: path.join(__dirname, '../', process.env.GCP_PATH),
expiry: Date.now() + parseFloat(process.env.DOWNLOAD_URL_EXPIRATION_DURATION),
}
imgPath = await GcpFileHelper.getSignedDownloadableUrl(options)
imgPath = await GcpFileHelper.getDownloadableUrl(options)
sumanvpacewisdom marked this conversation as resolved.
Show resolved Hide resolved
} else if (process.env.CLOUD_STORAGE === 'AWS') {
const options = {
destFilePath: imgPath,
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description : Response constants used in this service
*/

const form = require('@generics/form')
const form = require('../generics/form')
const { elevateLog, correlationId } = require('elevate-logger')
const logger = elevateLog.init()
const successResponse = async ({ statusCode = 500, responseCode = 'OK', message, result = [], meta = {} }) => {
Expand Down
92 changes: 54 additions & 38 deletions src/integration-test/account/account.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,81 +27,97 @@ describe('/user/v1/account', function () {
password: password,
isAMentor: false,
})

logError(res)
expect(res.statusCode).toBe(201)
expect(res.body).toMatchSchema(responseSchema.createProfileSchema)
})

it('/login', async () => {
let insertedUserDetails = await insertUser()
let res = await request.post('/user/v1/account/login').send({
email: insertedUserDetails.email,
password: insertedUserDetails.password,
email: userEmail,
password: password,
})

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.loginSchema)
})

it('/verifyMentor', async () => {
let res = await request.get('/user/v1/account/verifyMentor').query({ userId: userDetails.userId })

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.verifyMentor)
})

it('/verifyUser', async () => {
let res = await request.get('/user/v1/account/verifyUser').query({ userId: userDetails.userId })

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.verifyUser)
})

it('/acceptTermsAndCondition', async () => {
let res = await request.patch('/user/v1/account/acceptTermsAndCondition')

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.acceptTermsAndConditionSchema)
})
it('/list', async () => {
let res = await request.patch('/user/v1/account/list').query({ type: 'mentee', page: 1, limit: 2 })

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.listSchema)
})
it('/generateToken', async () => {
let res = await request
.post('/user/v1/account/generateToken')
.query({ type: 'mentee', page: 1, limit: 2 })
.send({
refreshToken: userDetails.refreshToken,
refresh_token: userDetails.refreshToken,
})

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.generateTokenSchema)
})
it('/changeRole', async () => {
sumanvpacewisdom marked this conversation as resolved.
Show resolved Hide resolved
let res = await request.post('/user/v1/account/changeRole').send({
email: userDetails.email,
})
userDetails = await logIn()

logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.changeRoleSchema)
})
it('/logout', async () => {
let res = await request.post('/user/v1/account/logout').send({
refreshToken: userDetails.refreshToken,
refresh_token: userDetails.refreshToken,
})
logError(res)
expect(res.statusCode).toBe(200)
expect(res.body).toMatchSchema(responseSchema.logoutSchema)
})

// search , changerole , verifyMentor , verifyuser doesn't have permissions and it is used in rolevalidation

// it('/search', async () => {
// console.log(userDetails.userId)
// let res = await request.post('/user/v1/account/search')
// .set({
// 'internal_access_token': 'internal_access_token',
// Connection: 'keep-alive',
// 'Content-Type': 'application/json',
// })
// .send({
// userIds : [456]
// })

// logError(res)
// expect(res.statusCode).toBe(200)
// console.log("listr ======",res.body)
// expect(res.body).toMatchSchema(responseSchema.listSchema)
// })

// it('/changeRole', async () => {
// let res = await request.post('/user/v1/account/changeRole').send({
// email: userDetails.email,
// role : 'mentor'
// })
// userDetails = await logIn()

// logError(res)
// expect(res.statusCode).toBe(200)
// expect(res.body).toMatchSchema(responseSchema.changeRoleSchema)
// })

// it('/verifyMentor', async () => {
// console.log(userDetails)
// let res = await request.get('/user/v1/account/verifyMentor').query({ userId: userDetails.userId })

// logError(res)
// expect(res.statusCode).toBe(200)
// expect(res.body).toMatchSchema(responseSchema.verifyMentor)
// })

// it('/verifyUser', async () => {
// let res = await request.get('/user/v1/account/verifyUser').query({ userId: userDetails.userId })

// logError(res)
// expect(res.statusCode).toBe(200)
// expect(res.body).toMatchSchema(responseSchema.verifyUser)
// })
})
16 changes: 14 additions & 2 deletions src/integration-test/account/accountData.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const usersData = require('@database/queries/users')
const UserCredentialQueries = require('@database/queries/userCredential')
const { faker } = require('@faker-js/faker')
const utilsHelper = require('@generics/utils')
const crypto = require('crypto')
Expand All @@ -10,12 +11,23 @@ const insertUser = async () => {
let password = faker.internet.password()
bodyData = {
name: 'Nevil',
email: { address: email, verified: false },
email: email,
password: password,
isAMentor: false,
organization_id: 1,
roles: [3],
otp: process.env.ENABLE_EMAIL_OTP_VERIFICATION,
}
bodyData.password = utilsHelper.hashPassword(bodyData.password)
await usersData.createUser(bodyData)
const res = await usersData.create(bodyData)
const userCredentialsBody = {
email: email,
password: password,
organization_id: bodyData.organization_id,
user_id: res.user_id,
}
await UserCredentialQueries.create(userCredentialsBody)

return {
email: email,
password: password,
Expand Down
Loading