Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 2.06 KB | None | 0 0
  1.  static expired_token = User.getToken("integrator", "integrator", 0)
  2.  
  3.     @Unroll
  4.      "Should return #code when token is #token and account is #account" (token, token_value, account, account_id, code, content, error) {
  5.         expect: "Should return #code, correct data and content type"
  6.  
  7.         def resp = restClient.get([path: apiPath, query: [token: token_value, 'account_id': account_id]])
  8.  
  9.         with(resp) {
  10.             status == code
  11.             contentType == Constants.CT_APPLICATION_JSON;
  12.             data.content == content
  13.             data.error == error
  14.         }
  15.  
  16.         where: "Token is #token and account #account"
  17.         token       | token_value                               | account     | account_id               | code | content | error
  18.         "correct"   | User.getToken("integrator", "integrator") | "exists"    | "3p7g-nqPTI6Vt_CGRPW_zA" | 200  | []      | null
  19.         "incorrect" | "incorrect_token"                         | "exists"    | "3p7g-nqPTI6Vt_CGRPW_zA" | 401  | null    | [code: 1401, "message": "user unauthorized: Invalid auth token = incorrect_token"]
  20.         "null"      | null                                      | "exists"    | "3p7g-nqPTI6Vt_CGRPW_zA" | 401  | null    | [code: 1401, "message": "user unauthorized: Invalid auth token = "]
  21.         "expired"   | expired_token                             | "exists"    | "3p7g-nqPTI6Vt_CGRPW_zA" | 401  | null    | [code: 1401, "message": "user unauthorized: Invalid auth token = " + expired_token]
  22.         "correct"   | User.getToken("integrator", "integrator") | "null"      | null                     | 200  | []      | null
  23.         "correct"   | User.getToken("integrator", "integrator") | "empty"     | ""                       | 200  | []      | null
  24.         "correct"   | User.getToken("integrator", "integrator") | "incorrect" | "qwerty"                 | 200  | []      | null
  25.         "null"      | null                                      | "null"      | null                     | 401  | null    | [code: 1401, "message": "user unauthorized: Invalid auth token = "]
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement