Esempio n. 1
0
def test_get_default_tenant_slug_not_as_user(patch_post):
    response = {"data": {"tenant": [{"slug": "tslug"}]}}

    patch_post(response)

    with set_temporary_config({
            "cloud.api": "http://my-cloud.foo",
            "cloud.auth_token": "secret_token"
    }):
        client = Client()
        slug = client.get_default_tenant_slug(as_user=False)

        assert slug == "tslug"
Esempio n. 2
0
def test_get_default_tenant_slug_as_user(patch_post):
    response = {
        "data": {"user": [{"default_membership": {"tenant": {"slug": "tslug"}}}]}
    }

    patch_post(response)

    with set_temporary_config(
        {
            "cloud.api": "http://my-cloud.foo",
            "cloud.auth_token": "secret_token",
            "backend": "cloud",
        }
    ):
        client = Client()
        slug = client.get_default_tenant_slug()

        assert slug == "tslug"