No project description provided
Project description
DV360 Mock api
The DV360 mock api is a static api that can be configured to return many reponses like the DV360 and DBM api's. The difference is the calls are not real.
Local
If you want to run locally please use a virtual environment
. This can be done with pipenv
. Next you can run the ./main.py
file. This will start a simple flask server with all endpoints.
To be able to test make sure to add the google-credentials.json
OAuth credentials to the secrets
folder.
If you want to test the application you can use the make run_all_tests
command. To add new tests, create a new test in the tests
folder and add it to the makefile. This will ensure the tests are ran in the pipeline.
Usage
To use the mock api in your testing suite make sure to target the dv360-mock-api
host. If you are using the googleapi
package, you will need to change the discovery url.
This will look like the following:
service = discovery.build(
api_service,
api_version,
http=self.http,
discoveryServiceUrl=f"http://localhost:5050/discover/{api_service}/{api_version}"
)
When running the tests you will need to use the runner
this will start the fake api in a seperate thread on port :5050
. This will look like so:
from django.test import TestCase
from dv_mock_api import runner
class ATestCase(TestCase):
def setUp(self):
runner.create_app()
def test_some_method(self):
pass # do testing here
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
Built Distribution
Hashes for dv_mock_api-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70121f81745684d071fa45c45d76a25c6ae1ff5679600104eb9922b7cf77d3d5 |
|
MD5 | 877c6717d138cf1f2d04b5275bb2e8ec |
|
BLAKE2b-256 | db0a199139da723f9118fa19878804e9c327d34a550bf9bfac60a17316546071 |