Giter Site home page Giter Site logo

api-test-for-qa's Introduction

API-test-for-QA

Steps:

  1. Download or clone repository.
  2. pip3 install -r requirements.txt
  3. Run app (python3 api.py). ==> Of course you need python3
  4. QA!

!!!Example!!! usage

$ python api.py

GET the list

$ curl http://localhost:5000/weather

(weather list here)

GET a single city weather

$ curl http://localhost:5000/weather/Kyiv

(Kyiv weather here)

DELETE a city

$ curl http://localhost:5000/weather/<city_name> -X DELETE -v

DELETE /weather/city_name HTTP/1.1 User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 Host: localhost:5000 Accept: /

  • HTTP 1.0, assume close after body < HTTP/1.0 204 NO CONTENT < Content-Type: application/json < Content-Length: 0 < Server: Werkzeug/0.8.3 Python/3.5.5 < Date: Mon, 01 Oct 2012 22:10:32 GMT

Add a new city weather

$ curl http://localhost:5000/weather -d "<city_name>=(new city weather)" -X POST -v

POST /weather HTTP/1.1 User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 Host: localhost:5000 Accept: / Content-Length: 18 Content-Type: application/x-www-form-urlencoded

  • HTTP 1.0, assume close after body < HTTP/1.0 201 CREATED < Content-Type: application/json < Content-Length: 25 < Server: Werkzeug/0.8.3 Python/2.7.2 < Date: Mon, 01 Oct 2012 22:12:58 GMT <
  • Closing connection #0 {<city_name>: "New city weather"}

Update a task

$ curl http://localhost:5000/weather/<city_name> -d "<city_name>=something new" -X PUT -v

PUT /weather/<city_name> HTTP/1.1 Host: localhost:5000 Accept: / Content-Length: 20 Content-Type: application/x-www-form-urlencoded

  • HTTP 1.0, assume close after body < HTTP/1.0 201 CREATED < Content-Type: application/json < Content-Length: 27 < Server: Werkzeug/0.8.3 Python/2.7.3 < Date: Mon, 01 Oct 2012 22:13:00 GMT <
  • Closing connection #0 {"<city_name>=something new"}

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.