Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mbp-aliaksei-2:culture banifaciy$ npm run test
- > culture-front@2.0.41 test /Users/banifaciy/Work/fit/culture
- > nrun _test test/ --bail --timeout 10000 --recursive --reporter spec
- > nrun _test
- > test -z $NODE_ENV && export NODE_ENV=developmentTest; lib/node/scripts/run.js lib/node/scripts/test.js "test/" "--bail" "--timeout" "10000" "--recursive" "--reporter" "spec"
- [info] Run tests "test/"
- [info] Starting related service from "/Users/banifaciy/Work/2do2go/social_posting"
- [log] Related service params: {"path":"/Users/banifaciy/Work/2do2go/social_posting","rev":"default","db":true,"env":"developmentTest"}
- [log] Drop database
- [log] Migrate database
- [log] Run server
- [info] Related service ready
- [info] Starting related service from "/Users/banifaciy/Work/fit/culture"
- [log] Related service params: {"path":"/Users/banifaciy/Work/fit/culture","rev":"default","db":true,"env":"developmentTest","dataSocket":"/tmp/related-service-data-developmentTest-1-1476797754493-98"}
- [log] Drop database
- [log] Migrate database
- [log] Run server
- [info] Related service ready
- [log] Start executing tests
- [Tue, 18 Oct 2016 13:36:08 GMT] [http request] http://127.0.0.1:6061/api/users: start requesting
- [Tue, 18 Oct 2016 13:36:08 GMT] [http request] http://127.0.0.1:6061/api/users: start requesting
- [Tue, 18 Oct 2016 13:36:08 GMT] [http request] http://127.0.0.1:6061/api/users: start requesting
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: response time: 108ms
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: done requesting
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: get data time: 114ms
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: response time: 123ms
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: done requesting
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: get data time: 124ms
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: response time: 127ms
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: done requesting
- [Tue, 18 Oct 2016 13:36:09 GMT] [http request] http://127.0.0.1:6061/api/users: get data time: 127ms
- Security checks
- Helpers
- hasSomeRights
- ✓ should throw error if rightsObj is empty
- ✓ should return false if organization is undefined
- ✓ should return false if roles is undefined in organization
- ✓ should return false if roles in organization is empty
- ✓ should return false if role locales in organization is empty
- ✓ should return false if all entityTypes are wrong
- ✓ should return true if some entityType is correct
- ✓ should return false if all rights are wrong
- ✓ should return true if some right is correct
- ✓ should return false if no available locales in roles
- ✓ should return false if not all locales in roles are available
- ✓ should return true if all locales in roles are available
- getOrganizationRightRoles
- ✓ should return [] if organization is undefined
- ✓ should return [] if roles is undefined in organization
- ✓ should return [] if roles in organization is empty
- ✓ should return [] if some entityType is wrong
- ✓ should return [] if some right is wrong
- ✓ should return ["moderator"] if organization has some role with rightsObj
- getOrganizationRightLocales
- ✓ should return [] if organization is undefined
- ✓ should return [] if roles is undefined in organization
- ✓ should return [] if roles in organization is empty
- ✓ should return [] if some entityType is wrong
- ✓ should return [] if some right is wrong
- ✓ should return [1,2,3] if organization has some role with rightsObj
- Middlwares
- ensureOrganization
- ✓ should redirect to url "?returnTo=%2Ftest" if organization _id is not set
- ✓ should redirect to url "?returnTo=%2Ftest" if organization is empty in session
- ✓ should redirect to url "?returnTo=%2Ftest" if organization does not exist with _id from session
- ✓ should be ok if organization exists with _id from session
- ✓ should throw error if organization does not exist with _id from headers
- ✓ should be ok if organization exists with _id from headers
- processUsersMeUrls
- ✓ should not replace url if it does not match
- ✓ should throw error if url is matched but req.user is not set
- ✓ should replace url if url is matched and req.user is set
- hasEntityRights
- ✓ should throw error if entityType is not set
- ✓ should throw error if entityType is unknown
- ✓ should be ok if entity _id is not set
- ✓ should be ok if entity does not exist
- ✓ should throw error if organization is not set in req
- ✓ should throw error if entity rights is empty
- ✓ should throw error if organization does not have passed rights
- ✓ should throw error if entity subordination is not in organization role locales
- ✓ should be ok if entity exists with _id from params and organization has rights
- ✓ should be ok if entity exists with _id from body and organization has rights
- ✓ should be ok if rights is array and organization has this rights
- isEntityOwner
- ✓ should throw error if entityType is not set
- ✓ should throw error if entityType is unknown
- ✓ should throw error if entity does not have organization field
- ✓ add fake organization field to moderation
- ✓ should be ok if entity _id is not set
- ✓ should be ok if entity does not exist
- ✓ should throw error if organization is not set in req
- ✓ should throw error if organization is not owner
- ✓ should be ok if entity exists with _id from params and organization is owner
- ✓ should be ok if entity exists with _id from body and organization is owner
- Excel module
- ✓ Transform stream (821ms)
- Articles api
- Article creating
- ✓ Create article with unexisting category (156ms)
- 1) Create article with unexisting locale
- 56 passing (2s)
- 1 failing
- 1) Articles api Article creating Create article with unexisting locale:
- Error: expected 'Internal server error' to equal 'Locale with id 102 not found'
- at Assertion.assert (node_modules/expect.js/index.js:96:13)
- at Assertion.be.Assertion.equal [as be] (node_modules/expect.js/index.js:216:10)
- at Assertion.(anonymous function) [as be] (node_modules/expect.js/index.js:69:24)
- at Group.<anonymous> (test/3_api/articles.js:110:31)
- at Group.<anonymous> (node_modules/twostep/lib/twoStep.js:165:15)
- at next (node_modules/twostep/lib/twoStep.js:153:9)
- at Group.done (node_modules/twostep/lib/twoStep.js:30:16)
- at Group._fillSlot (node_modules/twostep/lib/twoStep.js:52:8)
- at node_modules/twostep/lib/twoStep.js:71:9
- [log] Shuting down related services
- [log] Last related service data:
- [Tue, 18 Oct 2016 13:36:07 GMT] [cron job daemon] start
- [Tue, 18 Oct 2016 13:36:10 GMT] [start req #1476797770090-52] POST /api/2.2/articles | req.headers: {"content-type":"application/json","organization":"3","host":"127.0.0.1:4001","authorization":"Basic dGVzdEBtYWlsLmNvbToxMjM="} | user-agent: - | req.query: {} | req.body: {"category":"_intervyu","name":"testArticle","tags":[1],"locale":2,"image":{"name":"image.jpg","realName":"realName.jpg"},"content":[{"type":"text","text":"test text"},{"type":"images","images":[{"name":"image1.jpg","realName":"realName1.jpg"}]}]} | worker: -
- !!!!!!!!!!! { email: 'test@mail.com',
- password: 'beda020e7b7052f3bbce8445250be291' }
- [Tue, 18 Oct 2016 13:36:10 GMT] [auth] req.user: {"_id":2,"email":"test@mail.com","group":"admin"}
- [Tue, 18 Oct 2016 13:36:10 GMT] [app] There was an error at url "/api/2.2/articles":
- ValidatorError: Attribute `enum` of property `category` hasn`t pass check, expected value: `intervyu,reportazhi,fotootchety,scientificArticle` actual value: `_intervyu` error message: `must be present in given enumerator`
- at Error.ValidatorError (/Users/banifaciy/Work/fit/culture/node_modules/conform/lib/revalidator.js:531:13)
- at error (/Users/banifaciy/Work/fit/culture/node_modules/conform/lib/revalidator.js:493:17)
- at validateProperty (/Users/banifaciy/Work/fit/culture/node_modules/conform/lib/revalidator.js:336:7)
- at validateObject (/Users/banifaciy/Work/fit/culture/node_modules/conform/lib/revalidator.js:199:11)
- at Object.validate (/Users/banifaciy/Work/fit/culture/node_modules/conform/lib/revalidator.js:37:7)
- at module.exports (/Users/banifaciy/Work/fit/culture/lib/node/connect/validateParams.js:15:10)
- at IncomingMessage.req.validateParams (/Users/banifaciy/Work/fit/culture/lib/node/connect/reqValidateParams.js:11:13)
- at Group.<anonymous> (/Users/banifaciy/Work/fit/culture/routes/api/articles.js:375:23)
- at Group.<anonymous> (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:165:15)
- at next (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:153:9)
- at iterateSteps (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:158:7)
- at /Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:123:3
- at /Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:181:32
- at ApiResource.<anonymous> (/Users/banifaciy/Work/fit/culture/routes/api/articles.js:373:4)
- at /Users/banifaciy/Work/fit/culture/lib/node/connect/apiResource.js:166:16
- at callbacks (/Users/banifaciy/Work/fit/culture/node_modules/express/lib/router/index.js:161:37)
- [Tue, 18 Oct 2016 13:36:10 GMT] [finish req #1476797770090-52] POST /api/2.2/articles | status: 500 | res.headers: {"vary":"Accept-Encoding"} | isBadBrowser: - | isAuthenticated: true | uid: - | response-time: 86 ms
- [Tue, 18 Oct 2016 13:36:10 GMT] [start req #1476797770241-5] POST /api/2.2/articles | req.headers: {"content-type":"application/json","organization":"3","host":"127.0.0.1:4001","authorization":"Basic dGVzdEBtYWlsLmNvbToxMjM="} | user-agent: - | req.query: {} | req.body: {"locale":102,"name":"testArticle","category":"intervyu","tags":[1],"image":{"name":"image.jpg","realName":"realName.jpg"},"content":[{"type":"text","text":"test text"},{"type":"images","images":[{"name":"image1.jpg","realName":"realName1.jpg"}]}]} | worker: -
- !!!!!!!!!!! { email: 'test@mail.com',
- password: 'beda020e7b7052f3bbce8445250be291' }
- [Tue, 18 Oct 2016 13:36:10 GMT] [auth] req.user: {"_id":2,"email":"test@mail.com","group":"admin"}
- [Tue, 18 Oct 2016 13:36:10 GMT] [app] There was an error at url "/api/2.2/articles":
- ServerError: Locale with id 102 not found
- at Group.<anonymous> (/Users/banifaciy/Work/fit/culture/db/helpers.js:22:11)
- at Group.<anonymous> (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:165:15)
- at next (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:153:9)
- at Group.done (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:30:16)
- at Group._fillSlot (/Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:52:8)
- at /Users/banifaciy/Work/fit/culture/node_modules/twostep/lib/twoStep.js:71:9
- at nextTickCallbackWith0Args (node.js:420:9)
- at process._tickCallback (node.js:349:13)
- [Tue, 18 Oct 2016 13:36:10 GMT] [finish req #1476797770241-5] POST /api/2.2/articles | status: 500 | res.headers: {"vary":"Accept-Encoding"} | isBadBrowser: - | isAuthenticated: true | uid: - | response-time: 30 ms
- [error] Error while spawn "node ./node_modules/.bin/_mocha --reporter spec --bail --timeout 10000 --colors --recursive test/": Non-zero exit code: 1
- [error] Error while spawn "lib/node/scripts/test.js test/ --related-services [{"path":"../../2do2go/social_posting","syncDeps":false,"db":true},{"path":"./","db":true}] --bail --timeout 10000 --recursive --reporter spec": Non-zero exit code: 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement