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 66 67 68 69 70 71 72
|
# -------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# --------------------------------------------------------------------------
import unittest
from azure.cosmosdb.table.common import CloudStorageAccount
from samples.advanced import (
AuthenticationSamples,
ClientSamples,
)
from samples.table import (
TableSasSamples,
TableEncryptionSamples,
TableSamples,
)
@unittest.skip('Skip sample tests.')
class SampleTest(unittest.TestCase):
def setUp(self):
super(SampleTest, self).setUp()
try:
import samples.config as config
except:
raise ValueError('Please specify configuration settings in config.py.')
if config.IS_EMULATED:
self.account = CloudStorageAccount(is_emulated=True)
else:
# Note that account key and sas should not both be included
account_name = config.STORAGE_ACCOUNT_NAME
account_key = config.STORAGE_ACCOUNT_KEY
sas = config.SAS
self.account = CloudStorageAccount(account_name=account_name,
account_key=account_key,
sas_token=sas)
def test_table_samples(self):
table = TableSamples(self.account)
table.run_all_samples()
def test_table_sas_samples(self):
sas = TableSasSamples(self.account)
sas.run_all_samples()
def test_authentication_samples(self):
auth = AuthenticationSamples()
auth.run_all_samples()
def test_client_samples(self):
client = ClientSamples()
client.run_all_samples()
def test_table_encryption_samples(self):
encryption = TableEncryptionSamples(self.account)
encryption.run_all_samples()
# ------------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()
|