[haskell-http-client] update samples (OAS3) (#381)

This commit is contained in:
Jon Schoning
2018-05-08 21:31:28 -05:00
committed by William Cheng
parent 4fd68f0f24
commit 68780afe9d
106 changed files with 6188 additions and 11215 deletions

View File

@@ -1,10 +1,10 @@
# swagger-petstore-tests-integration
# openapi-petstore-tests-integration
This contains integration tests for the haskell http-client swagger-petstore api client library.
This contains integration tests for the haskell http-client openapi-petstore api client library.
This module is not auto-generated.
The integration tests require a swagger petstore server running at
The integration tests require a openapi petstore server running at
`http://0.0.0.0/v2`, or the value of the `HOST` environment variable.
The api client library bindings are expected to live in the parent folder

View File

@@ -2,14 +2,14 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: a8fb57441bffb4430254e2b9719abe616ff450a871e5e89b1736428114723f39
-- hash: db4f232d47abc55dfcc4a39baf3fe99e321edd086340fa500bfeee68ec48e412
name: swagger-petstore-tests-integration
name: openapi-petstore-tests-integration
version: 0.1.0.0
synopsis: integration tests for auto-generated swagger-petstore API Client
description: integration tests for auto-generated swagger-petstore API Client
synopsis: integration tests for auto-generated openapi-petstore API Client
description: integration tests for auto-generated openapi-petstore API Client
category: Web
homepage: https://github.com/swagger-api/swagger-codegen#readme
homepage: https://openapi-generator.tech
author: Author Name Here
maintainer: author.name@email.com
copyright: YEAR - AUTHOR
@@ -44,14 +44,14 @@ test-suite tests
, iso8601-time
, microlens >=0.4.3 && <0.5
, mtl >=2.2.1
, openapi-petstore
, safe-exceptions <0.2
, semigroups
, swagger-petstore
, text
, time
, transformers >=0.4.0.0
, unordered-containers
, vector >=0.10.9 && <0.13
other-modules:
Paths_swagger_petstore_tests_integration
Paths_openapi_petstore_tests_integration
default-language: Haskell2010

View File

@@ -1,15 +1,15 @@
name: swagger-petstore-tests-integration
name: openapi-petstore-tests-integration
version: '0.1.0.0'
synopsis: integration tests for auto-generated swagger-petstore API Client
synopsis: integration tests for auto-generated openapi-petstore API Client
description: ! '
integration tests for auto-generated swagger-petstore API Client
integration tests for auto-generated openapi-petstore API Client
'
category: Web
author: Author Name Here
maintainer: author.name@email.com
copyright: YEAR - AUTHOR
license: UnspecifiedLicense
homepage: https://github.com/swagger-api/swagger-codegen#readme
homepage: https://openapi-generator.tech
extra-source-files:
- README.md
ghc-options: -Wall
@@ -33,7 +33,7 @@ dependencies:
- case-insensitive
- safe-exceptions <0.2
- microlens >= 0.4.3 && <0.5
- swagger-petstore
- openapi-petstore
tests:
tests:
main: Test.hs
@@ -41,7 +41,7 @@ tests:
ghc-options:
- -fno-warn-orphans
dependencies:
- swagger-petstore
- openapi-petstore
- bytestring >=0.10.0 && <0.11
- containers
- hspec >=1.8

View File

@@ -1,10 +1,10 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-petstore-haskell-http-client-tests-integration</artifactId>
<groupId>org.openapitools</groupId>
<artifactId>openapi-petstore-haskell-http-client-tests-integration</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Swagger Petstore - Haskell http-client Client - Integration Tests</name>
<name>OpenAPI Petstore - Haskell http-client Client - Integration Tests</name>
<build>
<plugins>
<plugin>

View File

@@ -23,7 +23,7 @@ import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import System.Environment (getEnvironment)
import qualified SwaggerPetstore as S
import qualified OpenAPIPetstore as S
import Data.Monoid ((<>))
@@ -32,14 +32,6 @@ import Data.Monoid ((<>))
assertSuccess :: Expectation
assertSuccess = Success `shouldBe` Success
-- * INSTANCES
instance S.Consumes S.PlaceOrder S.MimeJSON
instance S.Consumes S.CreateUser S.MimeJSON
instance S.Consumes S.UpdateUser S.MimeJSON
instance S.Consumes S.CreateUsersWithArrayInput S.MimeJSON
instance S.Consumes S.CreateUsersWithListInput S.MimeJSON
-- * MAIN
main :: IO ()
@@ -73,7 +65,7 @@ main = do
-- * PET TESTS
testPetOps :: NH.Manager -> S.SwaggerPetstoreConfig -> Spec
testPetOps :: NH.Manager -> S.OpenAPIPetstoreConfig -> Spec
testPetOps mgr config =
describe "** pet operations" $ do
@@ -173,7 +165,7 @@ testPetOps mgr config =
-- * STORE TESTS
testStoreOps :: NH.Manager -> S.SwaggerPetstoreConfig -> Spec
testStoreOps :: NH.Manager -> S.OpenAPIPetstoreConfig -> Spec
testStoreOps mgr config = do
describe "** store operations" $ do
@@ -191,7 +183,7 @@ testStoreOps mgr config = do
it "placeOrder" $ do
now <- TI.getCurrentTime
let placeOrderRequest = S.placeOrder (S.ContentType S.MimeJSON) (S.Accept S.MimeJSON)
let placeOrderRequest = S.placeOrder (S.Accept S.MimeJSON)
(S.mkOrder
{ S.orderId = Just 21
, S.orderQuantity = Just 210
@@ -229,7 +221,7 @@ testStoreOps mgr config = do
-- * USER TESTS
testUserOps :: NH.Manager -> S.SwaggerPetstoreConfig -> Spec
testUserOps :: NH.Manager -> S.OpenAPIPetstoreConfig -> Spec
testUserOps mgr config = do
describe "** user operations" $ do
@@ -253,19 +245,19 @@ testUserOps mgr config = do
before (pure _user) $
it "createUser" $ \user -> do
let createUserRequest = S.createUser (S.ContentType S.MimeJSON) user
let createUserRequest = S.createUser user
createUserResult <- S.dispatchLbs mgr config createUserRequest
NH.responseStatus createUserResult `shouldBe` NH.status200
before (pure _users) $
it "createUsersWithArrayInput" $ \users -> do
let createUsersWithArrayInputRequest = S.createUsersWithArrayInput (S.ContentType S.MimeJSON) (S.User2 users)
let createUsersWithArrayInputRequest = S.createUsersWithArrayInput (S.User2 users)
createUsersWithArrayInputResult <- S.dispatchLbs mgr config createUsersWithArrayInputRequest
NH.responseStatus createUsersWithArrayInputResult `shouldBe` NH.status200
before (pure _users) $
it "createUsersWithListInput" $ \users -> do
let createUsersWithListInputRequest = S.createUsersWithListInput (S.ContentType S.MimeJSON) (S.User2 users)
let createUsersWithListInputRequest = S.createUsersWithListInput (S.User2 users)
createUsersWithListInputResult <- S.dispatchLbs mgr config createUsersWithListInputRequest
NH.responseStatus createUsersWithListInputResult `shouldBe` NH.status200
@@ -286,7 +278,7 @@ testUserOps mgr config = do
before (pure (_username, _user)) $
it "updateUser" $ \(username, user) -> do
let updateUserRequest = S.updateUser (S.ContentType S.MimeJSON) user (S.Username username)
let updateUserRequest = S.updateUser user (S.Username username)
updateUserResult <- S.dispatchLbs mgr config updateUserRequest
NH.responseStatus updateUserResult `shouldBe` NH.status200