This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
begin = datetime.time(11, 48) | |
end = datetime.time(12, 15) | |
#timedelta = end - begin | |
#print timedelta | |
timedelta = datetime.timedelta(seconds=26) | |
def time_add(t, delta): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public typealias SWSGI = ( | |
environ: [String: Any], | |
startResponse: ((String, [(String, String)]) -> Void), | |
sendBody: ([UInt8] -> Void) | |
) -> Void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Embassy | |
import EnvoyAmbassador | |
let loop = try! SelectorEventLoop(selector: try! KqueueSelector()) | |
let router = Router() | |
let server = HTTPServer( | |
eventLoop: loop, | |
app: router.app, | |
port: 8080 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MockAPIClient: APIClientProtocol { | |
var returnValueForGetUser: String | |
func getUser(id: String) { | |
return returnValueForGetUser | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = MockAPIClient() | |
client.returnValueForGetUser = "MOCK_DATA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = XCUIApplication() | |
app.launchEnvironment["ENV_VAR"] = "Env value" | |
app.launchArguments = ["-user-id", "12345"] | |
app.launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = XCUIApplication() | |
app.launchEnvironment["MOCK_API_CLIENT"] = "true" | |
app.launchEnvironment["MOCK_GET_USER_ERROR_CODE"] = "402" | |
app.launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DefaultRouter: Router { | |
static let fetchUsersPath = "/api/v2/users" | |
override init() { | |
super.init() | |
self[DefaultRouter.fetchUsersPath] = DelayResponse(JSONResponse(handler: ({ environ -> AnyObject in | |
return [ | |
["id": "01", "name": "john"], | |
["id": "02", "name": "tom"] | |
] | |
}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target 'MyProjectUITests' do | |
pod 'Embassy', '~> 1.0' | |
pod 'EnvoyAmbassador', '~> 0.0.1-alpha-1' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
import Embassy | |
import EnvoyAmbassador | |
class MyUITests: UITestBase { | |
func testUserList() { | |
router[DefaultRouter.fetchUsersPath] = DelayResponse(JSONResponse(handler: { _ in | |
return [ | |
["id": "01", "name": "John"], |