Skip to content

Instantly share code, notes, and snippets.

View fangpenlin's full-sized avatar
🚀

Fang-Pen Lin fangpenlin

🚀
View GitHub Profile
import os
import subprocess
from flask import Flask
from flask import request
from flask import abort
app = Flask(__name__)
API_KEY = os.environ["API_KEY"]

Keybase proof

I hereby claim:

  • I am fangpenlin on github.
  • I am fangpenlin (https://keybase.io/fangpenlin) on keybase.
  • I have a public key whose fingerprint is A576 16E6 2A49 9B51 2EDA 662E 0FC8 D700 8588 874B

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am fangpenlin on github.
  • I am fangpenlin (https://keybase.io/fangpenlin) on keybase.
  • I have a public key whose fingerprint is 1B7C ED10 1EB7 AC0A 7FFD C71D 8CB0 4455 CD16 EB73

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am victorlin on github.
  • I am fangpenlin (https://keybase.io/fangpenlin) on keybase.
  • I have a public key whose fingerprint is 1B7C ED10 1EB7 AC0A 7FFD C71D 8CB0 4455 CD16 EB73

To claim this, I am signing this object:

import Foundation
import XCTest
import Embassy
import EnvoyAmbassador
class UITestBase: XCTestCase {
let port = 8080
var router: Router!
var eventLoop: EventLoopType!
[
{
"id": "01",
"name": "john"
},
{
"id": "02",
"name": "tom"
}
]
import XCTest
import Embassy
import EnvoyAmbassador
class MyUITests: UITestBase {
func testUserList() {
router[DefaultRouter.fetchUsersPath] = DelayResponse(JSONResponse(handler: { _ in
return [
["id": "01", "name": "John"],
target 'MyProjectUITests' do
pod 'Embassy', '~> 1.0'
pod 'EnvoyAmbassador', '~> 0.0.1-alpha-1'
end
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"]
]
})))
app = XCUIApplication()
app.launchEnvironment["MOCK_API_CLIENT"] = "true"
app.launchEnvironment["MOCK_GET_USER_ERROR_CODE"] = "402"
app.launch()