Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/milliams/mebula
A framework for mocking out cloud APIs
https://github.com/milliams/mebula
cloud google-cloud mocking oracle-cloud python testing
Last synced: about 1 month ago
JSON representation
A framework for mocking out cloud APIs
- Host: GitHub
- URL: https://github.com/milliams/mebula
- Owner: milliams
- Created: 2020-01-16T16:04:57.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-17T18:52:38.000Z (3 months ago)
- Last Synced: 2024-12-06T21:09:50.442Z (about 2 months ago)
- Topics: cloud, google-cloud, mocking, oracle-cloud, python, testing
- Language: Python
- Size: 120 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSES/CC0-1.0.txt
- Citation: citation.cff
Awesome Lists containing this project
README
.. SPDX-FileCopyrightText: © 2020 Matt Williams
SPDX-License-Identifier: MIT******
Mebula
******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:
.. code:: python
from azure.common.client_factory import get_client_from_json_dict
from azure.mgmt.compute import ComputeManagementClientfrom mebula.azure import mock_azure
def test_azure():
with mock_azure():
credential = DefaultAzureCredential()
client = ComputeManagementClient(credential=credential, subscription_id="foo")assert list(client.virtual_machines.list("group")) == []
------You can use the ``mock_google`` context manager and then use the Google API functions as normal:
.. code:: python
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:
.. code:: python
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.