@@ -4,9 +4,16 @@ defmodule IntegrationTest do
44 @ moduletag :integration
55
66 describe "pet store spec integration test" do
7- test "generated Tesla client is able to call service" do
8- on_exit ( fn -> File . rm_rf! ( "tmp" ) end )
7+ setup do
8+ Code . put_compiler_option ( :ignore_module_conflict , true )
9+
10+ on_exit ( fn ->
11+ Code . put_compiler_option ( :ignore_module_conflict , false )
12+ File . rm_rf! ( "tmp" )
13+ end )
14+ end
915
16+ test "generated Tesla client is able to call service" do
1017 % { client: client , schemas: schemas } =
1118 OpenApiCodeGen.CLI . main ( [
1219 "--tesla" ,
@@ -15,13 +22,12 @@ defmodule IntegrationTest do
1522 "test/support/fixtures/openapi_petstore.json"
1623 ] )
1724
18- Enum . map ( schemas ++ [ client ] , & Code . compile_file / 1 )
25+ Enum . each ( schemas ++ [ client ] , & Code . compile_file / 1 )
26+
1927 assert_functions ( Tesla.Env )
2028 end
2129
2230 test "generated Req client is able to call service" do
23- on_exit ( fn -> File . rm_rf! ( "tmp" ) end )
24-
2531 % { client: client , schemas: schemas } =
2632 OpenApiCodeGen.CLI . main ( [
2733 "--req" ,
@@ -30,19 +36,22 @@ defmodule IntegrationTest do
3036 "test/support/fixtures/openapi_petstore.json"
3137 ] )
3238
33- Enum . map ( schemas ++ [ client ] , & Code . compile_file / 1 )
39+ Enum . each ( schemas ++ [ client ] , & Code . compile_file / 1 )
3440
3541 assert_functions ( Req.Response )
3642 end
3743 end
3844
45+ # credo:disable-for-lines Credo.Check.Refactor.Apply
3946 defp assert_functions ( expected_struct ) do
4047 pet = struct ( PetstoreClient.Pet , name: "test" , id: 1 )
4148 user = struct ( PetstoreClient.User , username: "test" , id: 1 )
4249 order = struct ( PetstoreClient.Order , id: 1 )
4350
4451 assert is_struct ( apply ( PetstoreClient , :find_pets_by_status , [ "status" ] ) , expected_struct )
52+ # FIXME: find pets by tags is returning 500 due to issues from the server
4553 assert is_struct ( apply ( PetstoreClient , :find_pets_by_tags , [ "tag" ] ) , expected_struct )
54+ # FIXME: get inventory is returning 500 due to issues from the server
4655 assert is_struct ( apply ( PetstoreClient , :get_inventory , [ ] ) , expected_struct )
4756 assert is_struct ( apply ( PetstoreClient , :get_order_by_id , [ 1 ] ) , expected_struct )
4857 assert is_struct ( apply ( PetstoreClient , :get_user_by_name , [ "username" ] ) , expected_struct )
0 commit comments