Skip to main content

Simple mock server for REST API

Project description

## Mock Server
Simple mock server for REST and XML-RPC API

It can mock GET, POST, PUT, PATCH, DELETE and some more rarely used HTTP methods.

Build status at [Travis CI](http://travis-ci.org/): [![Build Status](https://travis-ci.org/tomashanacek/mock-server.png?branch=master)](https://travis-ci.org/tomashanacek/mock-server)

## DEMO

http://psyduck.cz:9999/__manage

## Installation

Install with pip:

$ pip install mock-server

Or install with easy_install

$ easy_install mock-server

And after run

$ mock-server --dir=/path/to/api

It will be listening on port 8888 and wait for your HTTP requests.

## Overview

Mocking service is as simple as creating directory and few files within it just like that:

response content format: %METHOD%_%STATUS%.%FORMAT%
response headers format: %METHOD%_H_%STATUS%.%FORMAT%

root_dir/
GET_200.json # response content for GET /
GET_H_200.json # headers for GET /
user/
DELETE_404.xml # response content for DELETE /user.xml?__statusCode=404
POST_200.json # response content for POST /user
POST_H_200.json # headers for POST /user


Or you can use web interface

http://localhost:8888/__manage/create


Mocked GET /user/tom

$ curl -v -X GET http://psyduck:9999/user/tom

> GET /user/tom HTTP/1.1
> Host: psyduck:9999
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Content-Length: 64
< Server: TornadoServer/2.4.1
<
{
"name": "Tom",
"surname": "Smith",
"age": 22
}


## Bug report
If you have any trouble, report bug at GitHub Issue https://github.com/tomashanacek/mock-server/issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mock-server-0.2.0.tar.gz (749.2 kB view details)

Uploaded Source

File details

Details for the file mock-server-0.2.0.tar.gz.

File metadata

  • Download URL: mock-server-0.2.0.tar.gz
  • Upload date:
  • Size: 749.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mock-server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5ab9d8081caadd3b6395e4eeb3868c02b2515c855dbfe0f26e3605057debbdfb
MD5 70f427c407092d86d514931ba750db86
BLAKE2b-256 248ce0861aadb62f3f94f2b5d1a2c79abc4466a15917694268645c4bdd2e2077

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page