Skip to main content

No project description provided

Project description

Mebula is a framework which you can use in your testing code to mock your calls to cloud providers’ APIs. At the moment, Oracle’s OCI, Google Cloud and Microsoft Azure are supported.

Installation

  • For Microsoft Azure, install the mebula[azure] package.

  • For Google Cloud, install the mebula[google] package.

  • For Oracle’s OCI, install the mebula[oracle] package.

Usage

Azure

You can use the mock_azure context manager and then use the Azure functions as normal:

from azure.common.client_factory import get_client_from_json_dict
from azure.mgmt.compute import ComputeManagementClient

from mebula.azure import mock_azure


def test_azure():
    with mock_azure():
        config_dict = {
            "clientId": "ad735158-65ca-11e7-ba4d-ecb1d756380e",
            "clientSecret": "b70bb224-65ca-11e7-810c-ecb1d756380e",
            "subscriptionId": "bfc42d3a-65ca-11e7-95cf-ecb1d756380e",
            "tenantId": "c81da1d8-65ca-11e7-b1d1-ecb1d756380e",
            "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
            "resourceManagerEndpointUrl": "https://management.azure.com/",
            "activeDirectoryGraphResourceId": "https://graph.windows.net/",
            "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
            "galleryEndpointUrl": "https://gallery.azure.com/",
            "managementEndpointUrl": "https://management.core.windows.net/",
        }
        client = get_client_from_json_dict(ComputeManagementClient, config_dict)

        assert list(client.virtual_machines.list("group")) == []

Google

You can use the mock_google context manager and then use the Google API functions as normal:

import googleapiclient.discovery

from mebula import mock_google


def test_google(client):
    with mock_google():
        client = googleapiclient.discovery.build("compute", "v1")

        assert client.instances().list(project="foo", zone="bar").execute() == {}

Oracle

You can use the mock_oracle context manager and then use the Oracle oci functions as normal:

import oci

from mebula.oracle import mock_oracle


def test_oracle():
    with mock_oracle():
        compute = oci.core.ComputeClient(config={})

        assert compute.list_instances("foo").data == []

Coverage

Coverage is very minimal at the moment. Only launching and listing instances is supported.

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

mebula-0.2.2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

mebula-0.2.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file mebula-0.2.2.tar.gz.

File metadata

  • Download URL: mebula-0.2.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.8.1 Linux/5.0.0-1028-azure

File hashes

Hashes for mebula-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b0a60e48ad766216a94f9f51c3d5dc5b4b44de7fe4114159be1fd0bb17451919
MD5 15fb75da2792cc0643e7d301cd14f1d3
BLAKE2b-256 b33807e0b8de39a0cce978020c686e1ea0367da981a8a46e29c8dcb6cfda5639

See more details on using hashes here.

File details

Details for the file mebula-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: mebula-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.8.1 Linux/5.0.0-1028-azure

File hashes

Hashes for mebula-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 debeadfb9eef08028a4c6b1fe50d5df4ade7906f0635230facab04f5ce4ac3f3
MD5 fb666b7b43712139adee7b7ebd7e5ec9
BLAKE2b-256 1c62fbabfb547cb8b0081e1e0318613f22f1dcc0b987f49ae24b996ed1e7b452

See more details on using hashes here.

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