|
7 | 7 |
|
8 | 8 | import prefect
|
9 | 9 | from prefect.exceptions import InvalidRepositoryURLError
|
10 |
| -from prefect.filesystems import GitHub, LocalFileSystem, RemoteFileSystem |
11 |
| -from prefect.testing.utilities import AsyncMock |
| 10 | +from prefect.filesystems import Azure, GitHub, LocalFileSystem, RemoteFileSystem |
| 11 | +from prefect.testing.utilities import AsyncMock, MagicMock |
12 | 12 | from prefect.utilities.filesystem import tmpchdir
|
13 | 13 |
|
14 | 14 | TEST_PROJECTS_DIR = prefect.__root_path__ / "tests" / "test-projects"
|
@@ -622,3 +622,52 @@ class p:
|
622 | 622 | await g.get_directory(local_path=tmp_dst)
|
623 | 623 |
|
624 | 624 | assert any(".git" in f for f in os.listdir(tmp_dst)) == expect_git_objects
|
| 625 | + |
| 626 | + |
| 627 | +class TestAzure: |
| 628 | + def test_init(self, monkeypatch): |
| 629 | + remote_storage_mock = MagicMock() |
| 630 | + monkeypatch.setattr("prefect.filesystems.RemoteFileSystem", remote_storage_mock) |
| 631 | + Azure( |
| 632 | + azure_storage_tenant_id="tenant", |
| 633 | + azure_storage_account_name="account", |
| 634 | + azure_storage_client_id="client_id", |
| 635 | + azure_storage_account_key="key", |
| 636 | + azure_storage_client_secret="secret", |
| 637 | + bucket_path="bucket", |
| 638 | + ).filesystem |
| 639 | + remote_storage_mock.assert_called_once_with( |
| 640 | + basepath="az://bucket", |
| 641 | + settings={ |
| 642 | + "account_name": "account", |
| 643 | + "account_key": "key", |
| 644 | + "tenant_id": "tenant", |
| 645 | + "client_id": "client_id", |
| 646 | + "client_secret": "secret", |
| 647 | + "anon": True, |
| 648 | + }, |
| 649 | + ) |
| 650 | + |
| 651 | + def test_init_with_anon(self, monkeypatch): |
| 652 | + remote_storage_mock = MagicMock() |
| 653 | + monkeypatch.setattr("prefect.filesystems.RemoteFileSystem", remote_storage_mock) |
| 654 | + Azure( |
| 655 | + azure_storage_tenant_id="tenant", |
| 656 | + azure_storage_account_name="account", |
| 657 | + azure_storage_client_id="client_id", |
| 658 | + azure_storage_account_key="key", |
| 659 | + azure_storage_client_secret="secret", |
| 660 | + bucket_path="bucket", |
| 661 | + azure_storage_anon=False, |
| 662 | + ).filesystem |
| 663 | + remote_storage_mock.assert_called_once_with( |
| 664 | + basepath="az://bucket", |
| 665 | + settings={ |
| 666 | + "account_name": "account", |
| 667 | + "account_key": "key", |
| 668 | + "tenant_id": "tenant", |
| 669 | + "client_id": "client_id", |
| 670 | + "client_secret": "secret", |
| 671 | + "anon": False, |
| 672 | + }, |
| 673 | + ) |
0 commit comments