File: test_identifiers.py

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (65 lines) | stat: -rw-r--r-- 3,837 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import pytest

from azure.projects.resources import ResourceIdentifiers
from azure.projects.resources._extension.roles import RoleAssignment
from azure.projects.resources.ai._resource import CognitiveServicesAccount, AIServices
from azure.projects.resources.ai.deployment import AIDeployment, AIChat, AIEmbeddings
from azure.projects.resources.appconfig import ConfigStore
from azure.projects.resources.appconfig.setting import ConfigSetting
from azure.projects.resources.foundry._resource import MLWorkspace, AIHub, AIProject
from azure.projects.resources.foundry._connection import AIConnection
from azure.projects.resources.keyvault import KeyVault
from azure.projects.resources.managedidentity import UserAssignedIdentity
from azure.projects.resources.resourcegroup import ResourceGroup
from azure.projects.resources.search import SearchService
from azure.projects.resources.storage import StorageAccount
from azure.projects.resources.storage.blobs import BlobStorage
from azure.projects.resources.storage.blobs.container import BlobContainer
from azure.projects.resources.storage.tables import TableStorage
from azure.projects.resources.storage.tables.table import Table


def test_identifiers():
    with pytest.raises(TypeError):
        ResourceIdentifiers.resource()
    assert ResourceIdentifiers.resource_group.resource() is ResourceGroup
    assert ResourceIdentifiers.user_assigned_identity.resource() is UserAssignedIdentity
    assert ResourceIdentifiers.role_assignment.resource() is RoleAssignment
    assert ResourceIdentifiers.storage_account.resource() is StorageAccount
    assert ResourceIdentifiers.blob_storage.resource() is BlobStorage
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.datalake_storage.resource()
    assert ResourceIdentifiers.blob_container.resource() is BlobContainer
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.file_system.resource()
    assert ResourceIdentifiers.table_storage.resource() is TableStorage
    assert ResourceIdentifiers.table.resource() is Table
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.queue_storage.resource()
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.queue.resource()
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.file_storage.resource()
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.file_share.resource()
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.system_topic.resource()
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.system_topic_subscription.resource()
    assert ResourceIdentifiers.keyvault.resource() is KeyVault
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.keyvault_key.resource()
    with pytest.raises(NotImplementedError):
        assert ResourceIdentifiers.keyvault_secret.resource()
    assert ResourceIdentifiers.search.resource() is SearchService
    assert ResourceIdentifiers.cognitive_services.resource() is CognitiveServicesAccount
    assert ResourceIdentifiers.ml_workspace.resource() is MLWorkspace
    assert ResourceIdentifiers.ai_services.resource() is AIServices
    assert ResourceIdentifiers.ai_project.resource() is AIProject
    assert ResourceIdentifiers.ai_hub.resource() is AIHub
    assert ResourceIdentifiers.ai_deployment.resource() is AIDeployment
    assert ResourceIdentifiers.ai_chat_deployment.resource() is AIChat
    assert ResourceIdentifiers.ai_embeddings_deployment.resource() is AIEmbeddings
    assert ResourceIdentifiers.ai_connection.resource() is AIConnection
    assert ResourceIdentifiers.config_store.resource() is ConfigStore
    assert ResourceIdentifiers.config_setting.resource() is ConfigSetting