コード例 #1
0
    def test_delete_snapshot(self, storage_account_name, storage_account_key):
        self._setup(storage_account_name, storage_account_key)
        share = self._get_share_reference()
        share.create_share()
        snapshot = share.create_snapshot()

        # Act
        with self.assertRaises(HttpResponseError):
            share.delete_share()

        snapshot_client = ShareClient(self.account_url(storage_account_name,
                                                       "file"),
                                      share_name=share.share_name,
                                      snapshot=snapshot,
                                      credential=storage_account_key)

        deleted = snapshot_client.delete_share()
        self.assertIsNone(deleted)
        self._delete_shares()
コード例 #2
0
    def test_delete_snapshot(self):
        # Arrange
        share = self._get_share_reference()
        share.create_share()
        snapshot = share.create_snapshot()

        # Act
        with self.assertRaises(HttpResponseError):
            share.delete_share()

        snapshot_client = ShareClient(
            self.get_file_url(),
            share_name=share.share_name,
            snapshot=snapshot,
            credential=self.settings.STORAGE_ACCOUNT_KEY)

        deleted = snapshot_client.delete_share()
        self.assertIsNone(deleted)
        self._delete_shares()