Advertisement
Guest User

Untitled

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