angular-fullstack/generator-angular-fullstack

Question: API Testing with Passport

オープン

#494 opened on 2014/08/27

 (26 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (1,268 件のフォーク)batch import
Help Wantedquestion

Repository metrics

Stars
 (6,134 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Hi, I'm not sure if this is the right place to post this question but I'm not having any luck elsewhere. I'm new to testing and I'm not having any luck on SO etc. as they lack the context of whats already provided by this generator.

Most of my routes on the API are protected. What I'm trying to do is write test specs that:

  • Test endpoints without authorization (that fail)
  • Test endpoints with auth (pass)
  • Then test specifics/contents on the data returned by each endpoint while authorized.

What I'm having trouble with, is how to write the tests such that:

  • The test users are created (user.model.spec.js clears all users)
  • Authenticating the user with passport.js (local strategy is used)
  • Test endpoints with auth and without auth and the particulars of the endpoint whilst authorized.

Please help, i'm pulling my hair out!

コントリビューターガイド