Giter VIP home page Giter VIP logo

py_fake_server's Issues

Support json as response's attributes

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"})

Query parameters support

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

Unexpected split of expected query params

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

Project name sucks

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.