packages feed

google-oauth2-for-cli-0.1.0.0: test/Network/Google/OAuth2Spec.hs

{-# LANGUAGE OverloadedStrings #-}
module Network.Google.OAuth2Spec where

import Test.Hspec
import Network.Google.OAuth2

spec :: Spec
spec =
    describe "getToken" $
        it "returns the access token" $ do
            let tokenFile = "token.info"
                token = "TokenInfo {accessToken = \"access_token\", refreshToken = \"refresh_token\", expiresIn = 3600}"
                c = OAuth2Client "client_id" "client_secret"
            writeFile tokenFile token
            getToken c tokenFile [] `shouldReturn` "access_token"