Skip to content

Conversation

@imcaizheng
Copy link
Contributor

Verification

npx cross-env NODE_ENV=test istanbul cover node_modules/mocha/bin/_mocha -- --timeout 10000 --require babel-core/register --require ./src/tests  --exit src/routes/billingAccounts/get.spec.js

outputs:

{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"level":30,"msg":"Registering models ...  true","time":"2021-03-10T04:05:07.895Z","v":0}


  Project Billing Accounts list
    Get /projects/{id}/billingAccounts
Deleting "projects_test" index...
Creating "projects_test" index...
Deleting "timelines_test" index...
Creating "timelines_test" index...
Deleting "metadata_test" index...
Creating "metadata_test" index...
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"52c700dc-f651-432d-a4a9-8ff4a1ee2915","level":30,"msg":"start request { method: 'GET', url: '/v5/projects/1/billingAccount' }","time":"2021-03-10T04:05:08.605Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"52c700dc-f651-432d-a4a9-8ff4a1ee2915","level":30,"msg":"end request {\n  method: 'GET',\n  url: '/v5/projects/1/billingAccount',\n  statusCode: 403,\n  statusMessage: 'Forbidden',\n  duration: 2.182916\n}","time":"2021-03-10T04:05:08.608Z","v":0}
      ✓ should return 403 for anonymous user
Deleting "projects_test" index...
Creating "projects_test" index...
Deleting "timelines_test" index...
Creating "timelines_test" index...
Deleting "metadata_test" index...
Creating "metadata_test" index...
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"b6bbca4e-dddf-4998-942e-727cc2b52226","level":30,"msg":"start request { method: 'GET', url: '/v5/projects/1/billingAccount' }","time":"2021-03-10T04:05:08.943Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"b6bbca4e-dddf-4998-942e-727cc2b52226","level":50,"err":{"message":"You do not have permissions to perform this action","name":"Error","stack":"Error: You do not have permissions to perform this action\n    at /home/caizheng/my_projects/topcoder-tc-project-service-throw-404-if-billing-account-id-not-found/tc-project-service/src/permissions/generalPermission.js:1:7422"},"msg":"You do not have permissions to perform this action","time":"2021-03-10T04:05:08.954Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"b6bbca4e-dddf-4998-942e-727cc2b52226","level":30,"msg":"end request {\n  method: 'GET',\n  url: '/v5/projects/1/billingAccount',\n  statusCode: 403,\n  statusMessage: 'Forbidden',\n  duration: 12.334105\n}","time":"2021-03-10T04:05:08.955Z","v":0}
      ✓ should return 403 for admin
Deleting "projects_test" index...
Creating "projects_test" index...
Deleting "timelines_test" index...
Creating "timelines_test" index...
Deleting "metadata_test" index...
Creating "metadata_test" index...
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"60d27176-acc0-4064-86a5-8d340b013953","level":30,"msg":"start request { method: 'GET', url: '/v5/projects/11223344/billingAccount' }","time":"2021-03-10T04:05:09.264Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"60d27176-acc0-4064-86a5-8d340b013953","level":50,"err":{"message":"Project with id \"11223344\" not found","name":"Error","stack":"Error: Project with id \"11223344\" not found\n    at module.exports (/home/caizheng/my_projects/topcoder-tc-project-service-throw-404-if-billing-account-id-not-found/tc-project-service/src/routes/billingAccounts/get.js:1:5850)"},"msg":"Project with id \"11223344\" not found","time":"2021-03-10T04:05:09.269Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"60d27176-acc0-4064-86a5-8d340b013953","level":50,"err":{"message":"Project with id \"11223344\" not found","name":"Error","stack":"Error: Project with id \"11223344\" not found\n    at module.exports (/home/caizheng/my_projects/topcoder-tc-project-service-throw-404-if-billing-account-id-not-found/tc-project-service/src/routes/billingAccounts/get.js:1:5850)"},"msg":"Project with id \"11223344\" not found","time":"2021-03-10T04:05:09.269Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"60d27176-acc0-4064-86a5-8d340b013953","level":30,"msg":"end request {\n  method: 'GET',\n  url: '/v5/projects/11223344/billingAccount',\n  statusCode: 404,\n  statusMessage: 'Not Found',\n  duration: 5.157681999999999\n}","time":"2021-03-10T04:05:09.270Z","v":0}
      ✓ should return 404 if the project is not found
Deleting "projects_test" index...
Creating "projects_test" index...
Deleting "timelines_test" index...
Creating "timelines_test" index...
Deleting "metadata_test" index...
Creating "metadata_test" index...
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"64f2eb72-9da3-480e-8fb1-5c0374484b0e","level":30,"msg":"start request { method: 'GET', url: '/v5/projects/2/billingAccount' }","time":"2021-03-10T04:05:09.573Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"64f2eb72-9da3-480e-8fb1-5c0374484b0e","level":50,"err":{"message":"Billing Account not found","name":"Error","stack":"Error: Billing Account not found\n    at module.exports (/home/caizheng/my_projects/topcoder-tc-project-service-throw-404-if-billing-account-id-not-found/tc-project-service/src/routes/billingAccounts/get.js:1:6176)"},"msg":"Billing Account not found","time":"2021-03-10T04:05:09.576Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"64f2eb72-9da3-480e-8fb1-5c0374484b0e","level":50,"err":{"message":"Billing Account not found","name":"Error","stack":"Error: Billing Account not found\n    at module.exports (/home/caizheng/my_projects/topcoder-tc-project-service-throw-404-if-billing-account-id-not-found/tc-project-service/src/routes/billingAccounts/get.js:1:6176)"},"msg":"Billing Account not found","time":"2021-03-10T04:05:09.576Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"64f2eb72-9da3-480e-8fb1-5c0374484b0e","level":30,"msg":"end request {\n  method: 'GET',\n  url: '/v5/projects/2/billingAccount',\n  statusCode: 404,\n  statusMessage: 'Not Found',\n  duration: 3.266934\n}","time":"2021-03-10T04:05:09.576Z","v":0}
      ✓ should return 404 if billing account is not defined in the project
Deleting "projects_test" index...
Creating "projects_test" index...
Deleting "timelines_test" index...
Creating "timelines_test" index...
Deleting "metadata_test" index...
Creating "metadata_test" index...
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"3176cf95-0397-4894-875d-fe504311b209","level":30,"msg":"start request { method: 'GET', url: '/v5/projects/1/billingAccount' }","time":"2021-03-10T04:05:09.868Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"3176cf95-0397-4894-875d-fe504311b209","level":20,"msg":"SELECT  TopCoder_Billing_Account_Id__c, Mark_Up__c from Topcoder_Billing_Account__c tba where TopCoder_Billing_Account_Id__c='1'","time":"2021-03-10T04:05:09.871Z","v":0}
{"name":"tc-projects-service-prod","hostname":"caizheng-nuc10i7fnk","pid":2308147,"requestId":"3176cf95-0397-4894-875d-fe504311b209","level":30,"msg":"end request {\n  method: 'GET',\n  url: '/v5/projects/1/billingAccount',\n  statusCode: 200,\n  statusMessage: 'OK',\n  duration: 3.462307\n}","time":"2021-03-10T04:05:09.872Z","v":0}
      ✓ should return billing account details using M2M token with "read:project-billing-account-details" scope


  5 passing (2s)


=============================== Coverage summary ===============================
Statements   : 31.04% ( 2263/7290 )
Branches     : 2.64% ( 64/2427 )
Functions    : 5.62% ( 76/1352 )
Lines        : 32.2% ( 2255/7003 )
================================================================================

Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick PR @imcaizheng. Works good.

@maxceem maxceem merged commit 244f0d6 into topcoder-platform:feature/get-markup-from-billing-account Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants