.. SPDX-FileCopyrightText: © 2020 Matt Williams <matt@milliams.com>
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 ComputeManagementClient
from 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")) == []
Google
------
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/milliams/mebula",
"name": "mebula",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0,<4.0.0",
"maintainer_email": "",
"keywords": "",
"author": "Matt Williams",
"author_email": "matt@milliams.com",
"download_url": "https://files.pythonhosted.org/packages/3b/e6/79ea949c2f8232c553965540f1a310c8189ba4c169a20c3f325c1d992a18/mebula-0.2.10.tar.gz",
"platform": null,
"description": ".. SPDX-FileCopyrightText: \u00a9 2020 Matt Williams <matt@milliams.com>\n SPDX-License-Identifier: MIT\n\n******\nMebula\n******\n\nMebula is a framework which you can use in your testing code to mock your calls to cloud providers' APIs.\nAt the moment, Oracle's OCI, Google Cloud and Microsoft Azure are supported.\n\nInstallation\n============\n\n- For Microsoft Azure, install the ``mebula[azure]`` package.\n- For Google Cloud, install the ``mebula[google]`` package.\n- For Oracle's OCI, install the ``mebula[oracle]`` package.\n\nUsage\n=====\n\nAzure\n-----\n\nYou can use the ``mock_azure`` context manager and then use the Azure functions as normal:\n\n.. code:: python\n\n from azure.common.client_factory import get_client_from_json_dict\n from azure.mgmt.compute import ComputeManagementClient\n\n from mebula.azure import mock_azure\n\n\n def test_azure():\n with mock_azure():\n credential = DefaultAzureCredential()\n client = ComputeManagementClient(credential=credential, subscription_id=\"foo\")\n\n assert list(client.virtual_machines.list(\"group\")) == []\n\nGoogle\n------\n\nYou can use the ``mock_google`` context manager and then use the Google API functions as normal:\n\n.. code:: python\n\n import googleapiclient.discovery\n\n from mebula import mock_google\n\n\n def test_google(client):\n with mock_google():\n client = googleapiclient.discovery.build(\"compute\", \"v1\")\n\n assert client.instances().list(project=\"foo\", zone=\"bar\").execute() == {}\n\nOracle\n------\n\nYou can use the ``mock_oracle`` context manager and then use the Oracle ``oci`` functions as normal:\n\n.. code:: python\n\n import oci\n\n from mebula.oracle import mock_oracle\n\n\n def test_oracle():\n with mock_oracle():\n compute = oci.core.ComputeClient(config={})\n\n assert compute.list_instances(\"foo\").data == []\n\nCoverage\n========\n\nCoverage is very minimal at the moment. Only launching and listing instances is supported.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "",
"version": "0.2.10",
"project_urls": {
"Homepage": "https://github.com/milliams/mebula",
"Repository": "https://github.com/milliams/mebula"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4a6bb6d2644d4570c03173ff29558e98c2f5fc01876d67ad2479c1267d8e7e12",
"md5": "a66144f8f7c2704932c2f58e6df631f3",
"sha256": "af3b08aa1629df574538252aeba0a54c6fdade14a72ae25d9e42e7ae1a6bb74f"
},
"downloads": -1,
"filename": "mebula-0.2.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a66144f8f7c2704932c2f58e6df631f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.0,<4.0.0",
"size": 14439,
"upload_time": "2024-02-25T22:09:35",
"upload_time_iso_8601": "2024-02-25T22:09:35.502057Z",
"url": "https://files.pythonhosted.org/packages/4a/6b/b6d2644d4570c03173ff29558e98c2f5fc01876d67ad2479c1267d8e7e12/mebula-0.2.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3be679ea949c2f8232c553965540f1a310c8189ba4c169a20c3f325c1d992a18",
"md5": "299f2b1a5ad1322e0d29959f5c9cdc74",
"sha256": "7c98ef4e8039ab909f84d3ea91f35d6b37fe647ff6269ff881871338957898ff"
},
"downloads": -1,
"filename": "mebula-0.2.10.tar.gz",
"has_sig": false,
"md5_digest": "299f2b1a5ad1322e0d29959f5c9cdc74",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0,<4.0.0",
"size": 12142,
"upload_time": "2024-02-25T22:09:36",
"upload_time_iso_8601": "2024-02-25T22:09:36.565342Z",
"url": "https://files.pythonhosted.org/packages/3b/e6/79ea949c2f8232c553965540f1a310c8189ba4c169a20c3f325c1d992a18/mebula-0.2.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-25 22:09:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "milliams",
"github_project": "mebula",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mebula"
}