mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
add in some real tests
This commit is contained in:
parent
288acdb2d4
commit
fff0951771
@ -13,7 +13,9 @@
|
||||
6D4EFB9A1C692C6300B96B06 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D4EFB981C692C6300B96B06 /* Main.storyboard */; };
|
||||
6D4EFB9C1C692C6300B96B06 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D4EFB9B1C692C6300B96B06 /* Assets.xcassets */; };
|
||||
6D4EFB9F1C692C6300B96B06 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D4EFB9D1C692C6300B96B06 /* LaunchScreen.storyboard */; };
|
||||
6D4EFBAA1C692C6300B96B06 /* SwaggerClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D4EFBA91C692C6300B96B06 /* SwaggerClientTests.swift */; };
|
||||
6D4EFBB51C693BE200B96B06 /* PetAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D4EFBB41C693BE200B96B06 /* PetAPITests.swift */; };
|
||||
6D4EFBB71C693BED00B96B06 /* StoreAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D4EFBB61C693BED00B96B06 /* StoreAPITests.swift */; };
|
||||
6D4EFBB91C693BFC00B96B06 /* UserAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D4EFBB81C693BFC00B96B06 /* UserAPITests.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -35,8 +37,10 @@
|
||||
6D4EFB9E1C692C6300B96B06 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
6D4EFBA01C692C6300B96B06 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
6D4EFBA51C692C6300B96B06 /* SwaggerClientTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClientTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6D4EFBA91C692C6300B96B06 /* SwaggerClientTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwaggerClientTests.swift; sourceTree = "<group>"; };
|
||||
6D4EFBAB1C692C6300B96B06 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
6D4EFBB41C693BE200B96B06 /* PetAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PetAPITests.swift; sourceTree = "<group>"; };
|
||||
6D4EFBB61C693BED00B96B06 /* StoreAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreAPITests.swift; sourceTree = "<group>"; };
|
||||
6D4EFBB81C693BFC00B96B06 /* UserAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserAPITests.swift; sourceTree = "<group>"; };
|
||||
8A9666BD47569881BB2CE936 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
C07EC0A94AA0F86D60668B32 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DB0055390ED4A7AE7901DEDD /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
|
||||
@ -114,8 +118,10 @@
|
||||
6D4EFBA81C692C6300B96B06 /* SwaggerClientTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6D4EFBA91C692C6300B96B06 /* SwaggerClientTests.swift */,
|
||||
6D4EFBAB1C692C6300B96B06 /* Info.plist */,
|
||||
6D4EFBB41C693BE200B96B06 /* PetAPITests.swift */,
|
||||
6D4EFBB61C693BED00B96B06 /* StoreAPITests.swift */,
|
||||
6D4EFBB81C693BFC00B96B06 /* UserAPITests.swift */,
|
||||
);
|
||||
path = SwaggerClientTests;
|
||||
sourceTree = "<group>";
|
||||
@ -281,7 +287,9 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6D4EFBAA1C692C6300B96B06 /* SwaggerClientTests.swift in Sources */,
|
||||
6D4EFBB71C693BED00B96B06 /* StoreAPITests.swift in Sources */,
|
||||
6D4EFBB91C693BFC00B96B06 /* UserAPITests.swift in Sources */,
|
||||
6D4EFBB51C693BE200B96B06 /* PetAPITests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -43,5 +43,17 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>petstore.swagger.io</key>
|
||||
<dict>
|
||||
<!--Include to allow HTTP requests-->
|
||||
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -20,5 +20,17 @@
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>petstore.swagger.io</key>
|
||||
<dict>
|
||||
<!--Include to allow HTTP requests-->
|
||||
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -0,0 +1,49 @@
|
||||
//
|
||||
// PetAPITests.swift
|
||||
// SwaggerClient
|
||||
//
|
||||
// Created by Joseph Zuromski on 2/8/16.
|
||||
// Copyright © 2016 Swagger. All rights reserved.
|
||||
//
|
||||
|
||||
import PetstoreClient
|
||||
import PromiseKit
|
||||
import XCTest
|
||||
@testable import SwaggerClient
|
||||
|
||||
class PetAPITests: XCTestCase {
|
||||
|
||||
let testTimeout = 10.0
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testxxx() {
|
||||
let expectation = self.expectationWithDescription("testLogin")
|
||||
PetstoreClientAPI.UserAPI.loginUser(username: "swiftTester", password: "swift").execute().then { response -> Void in
|
||||
expectation.fulfill()
|
||||
}.always {
|
||||
// Noop for now
|
||||
}.error { errorType -> Void in
|
||||
// The server isn't returning JSON - and currently the alamofire implementation
|
||||
// always parses responses as JSON, so making an exception for this here
|
||||
// Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0."
|
||||
// UserInfo={NSDebugDescription=Invalid value around character 0.}
|
||||
let error = errorType as NSError
|
||||
if error.code == 3840 {
|
||||
expectation.fulfill()
|
||||
} else {
|
||||
XCTFail("error logging in")
|
||||
}
|
||||
}
|
||||
self.waitForExpectationsWithTimeout(testTimeout, handler: nil)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
//
|
||||
// StoreAPITests.swift
|
||||
// SwaggerClient
|
||||
//
|
||||
// Created by Joseph Zuromski on 2/8/16.
|
||||
// Copyright © 2016 Swagger. All rights reserved.
|
||||
//
|
||||
|
||||
import PetstoreClient
|
||||
import PromiseKit
|
||||
import XCTest
|
||||
@testable import SwaggerClient
|
||||
|
||||
class StoreAPITests: XCTestCase {
|
||||
|
||||
let testTimeout = 10.0
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testxxx() {
|
||||
let expectation = self.expectationWithDescription("testLogin")
|
||||
PetstoreClientAPI.UserAPI.loginUser(username: "swiftTester", password: "swift").execute().then { response -> Void in
|
||||
expectation.fulfill()
|
||||
}.always {
|
||||
// Noop for now
|
||||
}.error { errorType -> Void in
|
||||
// The server isn't returning JSON - and currently the alamofire implementation
|
||||
// always parses responses as JSON, so making an exception for this here
|
||||
// Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0."
|
||||
// UserInfo={NSDebugDescription=Invalid value around character 0.}
|
||||
let error = errorType as NSError
|
||||
if error.code == 3840 {
|
||||
expectation.fulfill()
|
||||
} else {
|
||||
XCTFail("error logging in")
|
||||
}
|
||||
}
|
||||
self.waitForExpectationsWithTimeout(testTimeout, handler: nil)
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
//
|
||||
// SwaggerClientTests.swift
|
||||
// SwaggerClientTests
|
||||
//
|
||||
// Created by Joseph Zuromski on 2/8/16.
|
||||
// Copyright © 2016 Swagger. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SwaggerClient
|
||||
|
||||
class SwaggerClientTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measureBlock {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
//
|
||||
// UserAPITests.swift
|
||||
// SwaggerClient
|
||||
//
|
||||
// Created by Joseph Zuromski on 2/8/16.
|
||||
// Copyright © 2016 Swagger. All rights reserved.
|
||||
//
|
||||
|
||||
import PetstoreClient
|
||||
import PromiseKit
|
||||
import XCTest
|
||||
@testable import SwaggerClient
|
||||
|
||||
class UserAPITests: XCTestCase {
|
||||
|
||||
let testTimeout = 10.0
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testLogin() {
|
||||
let expectation = self.expectationWithDescription("testLogin")
|
||||
PetstoreClientAPI.UserAPI.loginUser(username: "swiftTester", password: "swift").execute().then { response -> Void in
|
||||
expectation.fulfill()
|
||||
}.always {
|
||||
// Noop for now
|
||||
}.error { errorType -> Void in
|
||||
// The server isn't returning JSON - and currently the alamofire implementation
|
||||
// always parses responses as JSON, so making an exception for this here
|
||||
// Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0."
|
||||
// UserInfo={NSDebugDescription=Invalid value around character 0.}
|
||||
let error = errorType as NSError
|
||||
if error.code == 3840 {
|
||||
expectation.fulfill()
|
||||
} else {
|
||||
XCTFail("error logging in")
|
||||
}
|
||||
}
|
||||
self.waitForExpectationsWithTimeout(testTimeout, handler: nil)
|
||||
}
|
||||
|
||||
func testLogout() {
|
||||
let expectation = self.expectationWithDescription("testLogout")
|
||||
PetstoreClientAPI.UserAPI.logoutUser().execute().then { response -> Void in
|
||||
expectation.fulfill()
|
||||
}.always {
|
||||
// Noop for now
|
||||
}.error { errorType -> Void in
|
||||
// The server gives us no data back so alamofire parsing fails - at least
|
||||
// verify that is the error we get here
|
||||
// Error Domain=com.alamofire.error Code=-6006 "JSON could not be serialized. Input data was nil or zero
|
||||
// length." UserInfo={NSLocalizedFailureReason=JSON could not be serialized. Input data was nil or zero
|
||||
// length.}
|
||||
let error = errorType as NSError
|
||||
if error.code == -6006 {
|
||||
expectation.fulfill()
|
||||
} else {
|
||||
XCTFail("error logging out")
|
||||
}
|
||||
}
|
||||
self.waitForExpectationsWithTimeout(testTimeout, handler: nil)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user