telichkin / py_fake_server Goto Github PK
View Code? Open in Web Editor NEWCreate fake servers with pleasure!
License: MIT License
Create fake servers with pleasure!
License: MIT License
Dear Developer,
Please don't force me to import json on every stub:
Replace
auth_server.on_("post", "/auth"). \
response(status=200, body=json.dumps({"user_id": "34"}), content_type="application/json")
With
auth_server.on_("post", "/auth"). \
response(status=200, json={"user_id": "34"})
server.on_("post", "/hello/").response(status=200)
requests.post(server.base_uri + "/hello/").status_code == 500
Right now, expectation for a json body raises AssertionError, when a data in the body is correct but a order is not right
Hi,
it seems the query parameters are not supported associated to a response. Example :
`
import requests
from py_fake_server import FakeServer
server = FakeServer(host="localhost", port=8081)
server.start()
server.on_("get", "/hello?toto=test").response(status=200, body="Hello, World!", content_type="text/plain")
response = requests.get(server.base_uri + "/hello")
assert server.was_requested("get", "/hello?toto=test").exactly_once().check()
`
The result :
AssertionError: Expect that server was requested with [GET] http://localhost:8081/hello?toto=test. 1 times.
But server was requested 0 times.
Did I miss something in the doc or is this function really missing?
Thanks,
Jean-Christophe
server.on_("get", "/bug").response(status=200)
requests.get(server.base_uri + "/bug", params={"query": "id=in=(1,2)|limit(1,0)"})
assert server.was_requested("get", "/bug"). \
for_the_first_time(). \
with_query_params({"query": "id=in=(1,2)|limit(1,0)"}).check() # --> it raises AssertionError
py_fake_server
is really hard name to write in code. It's long and have special characters. Also, there is no need to remind that this is python. You should consider to change it somehow.
My suggestions:
fake-server
hurry-server
hurry-fake
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.