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

DPG-1171-filestore-metadata-tag-automation-script #143

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions api-automation/envYaml/common/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ endPoints:
fileStore:
create: filestore/v1/files
getFileId: filestore/v1/files/url
getMetadataId: filestore/v1/files/metadata
getFileTag: filestore/v1/files/tag

citizen:
create: user/users/_createnovalidate
Expand Down Expand Up @@ -76,6 +78,7 @@ endPoints:
pdfService:
create: pdf-service/v1/_create?
createNoSave: pdf-service/v1/_createnosave?
bulk: pdf-service/v1/_getBulkPdfRecordsDetails

user:
updateProfile: user/profile/_update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ parameters:
# to upload file on fire-noc module
module:
- fire-noc
# tag for filestore
tag:
- 00041-2017-QR
# type for userOtp
type:
- register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
errorMessages:
noTenantid: Required String parameter 'tenantId' is not present
noFilestoreId: Required List parameter 'fileStoreIds' is not present
noTag: Required String parameter 'tag' is not present
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: FileStore create API call
* def fileContentType = 'application/pdf'
* def commonConstants = read('../../common-services/constants/genericConstants.yaml')
* def module = commonConstants.parameters.module[0]
* def tag = commonConstants.parameters.tag[0]
* def invalidTenantId = commonConstants.invalidParameters.invalidTenantId
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')
* def testData = '../../common-services/testData/dummyTestData.rtf'
Expand All @@ -24,6 +25,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData3)' , filename: '#(filetestData3)', contentType: '#(fileContentType)'}
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 201
Expand All @@ -38,6 +40,7 @@ Feature: FileStore create API call
And multipart file file = { read: '#(testData2)', filename: '#(filetestData2)', contentType: '#(fileContentType)' }
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 201
Expand All @@ -62,6 +65,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData)', filename: '#(filetestData)', contentType: '#(fileContentType)'}
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 400
Expand All @@ -74,6 +78,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData1)', filename: '#(filetestData1)', contentType: '#(fileContentType)'}
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 413
Expand All @@ -88,6 +93,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData3)', filename: '#(filetestData3)', contentType: '#(fileContentType)'}
And multipart field tenantId = invalidTenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 201
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Feature: Filestore Metadata API call
Background:
* def jsUtils = read('classpath:com/egov/utils/jsUtils.js')
* def fileContentTypeHeader = 'multipart/form-data;boundary=----WebKitFormBoundaryBDVBPRx02pZ7ePhq'
* def fileContentType = 'application/pdf'
* def commonConstants = read('../../common-services/constants/genericConstants.yaml')
* def module = commonConstants.parameters.module[0]
* def invalidTenantId = commonConstants.invalidParameters.invalidTenantId
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')

# calling upload single document file pretest
* call read('../../core-services/pretests/fileStoreCreate.feature@uploadDocumentsSuccessfully')

* def getFileId = filecreateResponseBody.files[0].fileStoreId

@getFilestoreMetadataSuccessfully
Scenario: get the filestore metadata successfully
* def getFileIdParam =
"""
{
tenantId: '#(tenantId)',
fileStoreIds: '#(fileStoreId)'
}

"""
Given url fileStoreMetadata
And params getFileIdParam
When method get
Then status 200
And def fileStoreMetadataResponseHeader = responseHeaders
And def fileStoreMetadataResponseBody = response

@getFilestoreMetadataInvalidTenantId
Scenario: get the filestore metadata error
* def getFileIdParam =
"""
{
tenantId: '#(tenantId)',
fileStoreIds: '#(getFileIds)'
}
"""
Given url fileStoreMetadata
And params getFileIdParam
When method get
Then status 400
And def fileStoreMetadataResponseHeader = responseHeaders
And def fileStoreMetadataResponseBody = response
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Feature: Filestore Tag API call
Background:
* def jsUtils = read('classpath:com/egov/utils/jsUtils.js')
* def commonConstants = read('../../common-services/constants/genericConstants.yaml')
* def module = commonConstants.parameters.module[0]
* def tag = commonConstants.parameters.tag[0]
* def invalidTenantId = commonConstants.invalidParameters.invalidTenantId
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')

# calling upload single document file pretest
* call read('../../core-services/pretests/fileStoreCreate.feature@uploadDocumentsSuccessfully')


@getFilestoreTagSuccessfully
Scenario: get the filestore tag successfull
* def getFileTagParam =
"""
{
tenantId: '#(tenantId)',
tag: '#(tag)'
}
"""
Given url fileStoreTag
And params getFileTagParam
When method get
Then status 200
And def fileStoreTagResponseHeader = responseHeaders
And def fileStoreTagResponseBody = response

@getFilestoreIncorrectTag
Scenario: get the filestore incorrect tenantId
* def getFileTagParam =
"""
{
tag: '#(tag)'
}
"""
Given url fileStoreTag
And params getFileTagParam
When method get
Then status 400
And def fileStoreTagResponseHeader = responseHeaders
And def fileStoreTagResponseBody = response

@getFilestoreIncorrectTagError
Scenario: get the filestore incorrect tag
* def getFileTagParam =
"""
{
tenantId: '#(tenantId)'
}
"""
Given url fileStoreTag
And params getFileTagParam
When method get
Then status 400
And def fileStoreTagResponseHeader = responseHeaders
And def fileStoreTagResponseBody = response
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: File store Metadata
Background:
* def jsUtils = read('classpath:com/egov/utils/jsUtils.js')
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')

@Filestore_Metadata_01 @coreServices @regression @positive @fileStore
Scenario: Filestore metadata successfull
#Calling filestore metadata preset
* call read('../../core-services/pretests/fileStoreMetadataPretest.feature@getFilestoreMetadataSuccessfully')

* match fileStoreMetadataResponseBody == '#present'

@Filestore_Metadata_02 @coreServices @regression @negative @fileStore
Scenario: Filestore metadata invalid TenantId
#Calling filestore metadata preset
* call read('../../core-services/pretests/fileStoreMetadataPretest.feature@getFilestoreMetadataInvalidTenantId')

* assert.fileStoreMetadataResponseBody.Errors[0].message == fileStoreConst.errorMessages.noTenantid
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Feature: File store Tag
Background:
* def jsUtils = read('classpath:com/egov/utils/jsUtils.js')
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')

@FileStore_Tag_01 @coreServices @regression @positive @filestore
Scenario: Filestore tag successfull
#Calling tag preset
* call read('../../core-services/pretests/fileStoreTagPretest.feature@getFilestoreTagSuccessfully')

* match fileStoreTagResponseBody == '#present'

@FileStore_Tag_02 @coreServices @regression @negative @filestore
Scenario: Filestore incorrect tenantId
#Calling tag preset
* call read('../../core-services/pretests/fileStoreTagPretest.feature@getFilestoreIncorrectTag')

* assert fileStoreTagResponseBody.Errors[0].message == fileStoreConst.errorMessages.noTenantid

@FileStore_Tag_03 @coreServices @regression @negative @filestore
Scenario: Filestore incorrect tag
#Calling tag preset
* call read('../../core-services/pretests/fileStoreTagPretest.feature@getFilestoreIncorrectTagError')

* assert fileStoreTagResponseBody.Errors[0].message == fileStoreConst.errorMessages.noTag
6 changes: 6 additions & 0 deletions api-automation/src/test/java/karate-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ function fn() {
//Get file id
config.fileStoreGet = envProps.host + path.endPoints.fileStore.getFileId;

//Get file metadata
config.fileStoreMetadata = envProps.host + path.endPoints.fileStore.getMetadataId;

//Get file tag
config.fileStoreTag = envProps.host + path.endPoints.fileStore.getFileTag;

//Search location
config.searchloc = envProps.host + path.endPoints.location.search;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ parameters:
# to upload file on fire-noc module
module:
- fire-noc
# tag for filestore
tag:
- 00041-2017-QR
# type for userOtp
type:
- register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
errorMessages:
noTenantid: Required String parameter 'tenantId' is not present
noFilestoreId: Required List parameter 'fileStoreIds' is not present
noTag: Required String parameter 'tag' is not present
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: FileStore create API call
* def fileContentType = 'application/pdf'
* def commonConstants = read('../../common-services/constants/genericConstants.yaml')
* def module = commonConstants.parameters.module[0]
* def tag = commonConstants.parameters.tag[0]
* def invalidTenantId = commonConstants.invalidParameters.invalidTenantId
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')
* def testData = '../../common-services/testData/dummyTestData.rtf'
Expand All @@ -24,6 +25,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData3)' , filename: '#(filetestData3)', contentType: '#(fileContentType)'}
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 201
Expand All @@ -38,6 +40,7 @@ Feature: FileStore create API call
And multipart file file = { read: '#(testData2)', filename: '#(filetestData2)', contentType: '#(fileContentType)' }
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 201
Expand All @@ -62,6 +65,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData)', filename: '#(filetestData)', contentType: '#(fileContentType)'}
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 400
Expand All @@ -74,6 +78,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData1)', filename: '#(filetestData1)', contentType: '#(fileContentType)'}
And multipart field tenantId = tenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 413
Expand All @@ -88,6 +93,7 @@ Feature: FileStore create API call
And multipart file file = {read: '#(testData3)', filename: '#(filetestData3)', contentType: '#(fileContentType)'}
And multipart field tenantId = invalidTenantId
And multipart field module = module
And multipart field tag = tag
And header Content-Type = fileContentTypeHeader
When method post
Then status 201
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Feature: Filestore Metadata API call
Background:
* def jsUtils = read('classpath:com/egov/utils/jsUtils.js')
* def fileContentTypeHeader = 'multipart/form-data;boundary=----WebKitFormBoundaryBDVBPRx02pZ7ePhq'
* def fileContentType = 'application/pdf'
* def commonConstants = read('../../common-services/constants/genericConstants.yaml')
* def module = commonConstants.parameters.module[0]
* def invalidTenantId = commonConstants.invalidParameters.invalidTenantId
* def fileStoreConst = read('../../core-services/constants/fileStore.yaml')

# calling upload single document file pretest
* call read('../../core-services/pretests/fileStoreCreate.feature@uploadDocumentsSuccessfully')

* def getFileId = filecreateResponseBody.files[0].fileStoreId

@getFilestoreMetadataSuccessfully
Scenario: get the filestore metadata successfully
* def getFileIdParam =
"""
{
tenantId: '#(tenantId)',
fileStoreIds: '#(fileStoreId)'
}

"""
Given url fileStoreMetadata
And params getFileIdParam
When method get
Then status 200
And def fileStoreMetadataResponseHeader = responseHeaders
And def fileStoreMetadataResponseBody = response

@getFilestoreMetadataInvalidTenantId
Scenario: get the filestore metadata error
* def getFileIdParam =
"""
{
tenantId: '#(tenantId)',
fileStoreIds: '#(getFileIds)'
}
"""
Given url fileStoreMetadata
And params getFileIdParam
When method get
Then status 400
And def fileStoreMetadataResponseHeader = responseHeaders
And def fileStoreMetadataResponseBody = response
Loading