Giter Club home page Giter Club logo

hypothesis_poc's Introduction

Hypothesis_PoC

Description

This is a python script that uses Hypothesis and Unittest that includes 2 simple tests. Tests will call google api reverse geocoding by providing lat and lng values. The first test will use Hypothesis to generate valid sets of coordinates and the second test will generate invalid sets of coordinates. Tests will make http API call and verify that the response for valid coordinates is OK or ZERO_RESULTS and for invalid coordinates is INVALID_REQUEST. Hypothesis will randomly generate values for the given conditions in @given and will generate no more than max_examples values given in @settings. Hypothesis will also execute my custom examples provided in each @example. For positive scenarios script uses Hypothesis to generate coordinates in decimals between -90 and 90 for lat and -180 and 180 for lng. For negative scenarios it generates values outside of that range and will generate one of 3 scenarios - lat only invalid, lng only invalid, or both lat and lng invalid.

Setup

  1. Install Python 2.7.14
  2. Install additional libraries from the Command window with the following commands:
  3. pip install unittest
  4. pip install hypothesis
  5. Get google api key to use for Reverse Geocoding (Address Lookup) https://developers.google.com/maps/documentation/javascript/get-api-key
  6. Download and edit python script by inserting your API key instead of API_KEY_GOES_HERE

Execution

To run the script, open command window and navigate to the location of the python script. Then run the following command: python ./test.py

hypothesis_poc's People

Contributors

kchuykov avatar palakdesai avatar

Watchers

James Cloos avatar  avatar  avatar Naman avatar

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.