Skip to content

Instantly share code, notes, and snippets.

@maininformer
maininformer / pyproject.toml
Last active November 23, 2023 01:14
For poetry Issue
[tool.poetry]
name = "testing"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.12"
setuptools = "^69.0.2"
@maininformer
maininformer / flask-ngrok.md
Last active April 9, 2018 20:29
Flask local webhook tester
import json
from flask import Flask, request
app = Flask(__name__)

@app.route("/", methods=["GET", "POST"])
def hello():
    return "Hello World!"

@app.route("/payload", methods=['POST'])

Python Mock

Mock the method what not, where it is imported and not where it exists. If the test runs a method in a file called foo. and inside foo, you want to patch bar, then the patch should be foo.bar, even if bar is imported from baz originally.

Also gotchas: http://alexmarandon.com/articles/python_mock_gotchas/

If you are stacking up decorator patches, the order is down to up, the lowest one goes to the first agument.

GPG

Search someone by email: gpg --keyserver hkp://keyserver.ubuntu.com --search-key 'email@email.com'

Keybase proof

I hereby claim:

  • I am plumsempy on github.
  • I am plumsempy (https://keybase.io/plumsempy) on keybase.
  • I have a public key ASAj7d5n7xvoS-wCPYwNXx6ywnJT8Id9Xudcj5MX_35Wlwo

To claim this, I am signing this object: