Advertisement
Guest User

Untitled

a guest
Sep 9th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.19 KB | None | 0 0
  1. module StepDefs
  2.  
  3. open OAuth2Client
  4. open FSpec
  5.  
  6. type State =
  7.   { secrets : Secrets option
  8.     storage : IStorageAsync
  9.     httpClient : System.Net.Http.HttpClient
  10.     remoteMemberId: string
  11.     createdAttachmentId: string
  12.     }
  13.   static member Default = {
  14.     secrets = None
  15.     storage = Storage.JsonFileStorage.Default
  16.     httpClient = null
  17.     remoteMemberId = null
  18.     createdAttachmentId = null
  19.     }
  20.  
  21. let ``the client has authenticated with OAuth 2.0`` state = async {
  22.   return {state with storage = Storage.JsonFileStorage.Default}
  23.   }
  24.  
  25. let ``the client has negotiated for "rest-1.v1" and "attachment.img" scopes`` state = async {
  26.   return {state with httpClient = System.Net.Http.HttpClient.WithOAuth2("rest-1.v1 attachment.img", state.storage)}
  27.   }
  28.  
  29. let ``and a Member "remote" with Default Role "Customer" (or above)`` state = async {
  30.   return {state with remoteMemberId = "" }
  31.   }
  32.  
  33. let ``I create a new Attachment asset with the following attributes`` state = async {
  34.   return {state with createdAttachmentId = ""}
  35.   }
  36.  
  37. let ``It creates`` (state:State) = async {
  38.   let! result = Async.AwaitTask <| state.httpClient.GetStringAsync("")
  39.   assert (result.Length > 0)
  40.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement