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 time | |
import threading | |
import pytest | |
import psycopg2 | |
def acquire(conn, poll_period=0.1): | |
cur = conn.cursor() | |
while True: |
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
import Foundation | |
import XCTest | |
import Embassy | |
import EnvoyAmbassador | |
class UITestBase: XCTestCase { | |
let port = 8080 | |
var router: Router! | |
var eventLoop: EventLoopType! |
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 |