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")) == []
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
Release history Release notifications | RSS feed
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
File details
Details for the file mebula-0.2.4.tar.gz
.
File metadata
- Download URL: mebula-0.2.4.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.3 CPython/3.9.0 Linux/5.4.0-1026-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e6f8f5f9749f624df7a11a34b71c37a6de22b1d5d93c15898e55ab29fa915a |
|
MD5 | c2a3d603fc8d93ed488a2e3c63a23bb9 |
|
BLAKE2b-256 | 6619abad53e2c5d1efc5d7cc0d4ec59dd2c45382c1df0ea7ad6f564a495837f8 |
File details
Details for the file mebula-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: mebula-0.2.4-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.3 CPython/3.9.0 Linux/5.4.0-1026-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3701f79f2706baa434424d7cd7e36b361494cb398e4347cf41bd295a1b99cf2 |
|
MD5 | d82135ba19f16d7ce5df2efc802dfc95 |
|
BLAKE2b-256 | 00fe6e8360c8a5c21672891a7fa24ce2f80b30d1c5d4b5fceea2f22d91fbee31 |