Skip to main content

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

dv-mock-api-0.1.2.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

dv_mock_api-0.1.2-py3-none-any.whl (13.8 kB view hashes)

Uploaded Python 3

Supported by

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