Skip to content

Commit

Permalink
Merge pull request Azure#396 from huguesv/dev4
Browse files Browse the repository at this point in the history
Dev4
  • Loading branch information
Hugues Valois committed Jun 25, 2015
2 parents 91e41c5 + df29cae commit 3291ecf
Show file tree
Hide file tree
Showing 343 changed files with 837,788 additions and 948 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ TestResults/
# Credentials
credentials_real.json
testsettings_local.json
servicebus_settings_real.py
storage_settings_real.py
legacy_mgmt_settings_real.py
mgmt_settings_real.py

# User-specific files
*.suo
Expand All @@ -45,3 +49,4 @@ $RECYCLE.BIN/
src/build
*.iml
/doc/_build
/.vs/config/applicationhost.config
24 changes: 24 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ The following have moved from 'azure' to 'azure.storage':
DEV_ACCOUNT_NAME
DEV_ACCOUNT_KEY


TEST FAILURES
=============

StorageBlobTest
---------------
(fail in playback mode)
test_get_blob_to_text_chunked_download
test_put_block_blob_from_text_chunked_upload

StorageTableTest
----------------
(fail in any mode)
test_get_table_acl
test_get_table_acl_iter
test_set_table_acl
test_set_table_acl_with_empty_signed_identifiers
test_set_table_acl_with_empty_signed_identifiers

StorageQueueTest
----------------
<none>


2015-06-16 Version 0.11.1

* Azure storage connection string support
Expand Down
4 changes: 2 additions & 2 deletions azure-storage/azure/storage/_http/batchclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class _BatchClient(_HTTPClient):
'''

def __init__(self, service_instance, authentication,
protocol='http', timeout=65):
_HTTPClient.__init__(self, service_instance, protocol=protocol, timeout=timeout)
protocol='http', request_session=None, timeout=65, user_agent=''):
_HTTPClient.__init__(self, service_instance, protocol=protocol, request_session=request_session, timeout=timeout, user_agent=user_agent)
self.authentication = authentication
self.is_batch = False
self.batch_requests = []
Expand Down
5 changes: 4 additions & 1 deletion azure-storage/azure/storage/tableservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ def begin_batch(self):
self._batchclient = _BatchClient(
service_instance=self,
authentication=self.authentication,
timeout=self._httpclient.timeout)
request_session=self._httpclient.request_session,
timeout=self._httpclient.timeout,
user_agent=self._httpclient.user_agent,
)
return self._batchclient.begin_batch()

def commit_batch(self):
Expand Down
49 changes: 30 additions & 19 deletions azure.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ProjectGuid>{25b2c65a-0553-4452-8907-8b5b17544e68}</ProjectGuid>
<ProjectHome>
</ProjectHome>
<StartupFile>tests\create_credentials_file.py</StartupFile>
<StartupFile>tests\doctest_tableservice.py</StartupFile>
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
<Name>azure</Name>
Expand Down Expand Up @@ -182,9 +182,21 @@
<Compile Include="azure-_core\setup.py" />
<Compile Include="azure\setup.py" />
<Compile Include="setup.py" />
<Compile Include="tests\mgmtutil.py" />
<Compile Include="tests\common_auth.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\common_extendedtestcase.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\legacy_mgmt_settings_real.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\mgmt_settings_fake.py" />
<Compile Include="tests\mgmt_settings_real.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\mgmt_testcase.py" />
<Compile Include="tests\blob_performance.py" />
<Compile Include="tests\clean.py" />
<Compile Include="tests\create_credentials_file.py" />
<Compile Include="tests\doctest_blobservice.py" />
<Compile Include="tests\doctest_queueservice.py" />
Expand All @@ -194,7 +206,21 @@
<Compile Include="tests\loader.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\testutil.py" />
<Compile Include="tests\legacy_mgmt_testcase.py" />
<Compile Include="tests\legacy_mgmt_settings_fake.py" />
<Compile Include="tests\storage_testcase.py" />
<Compile Include="tests\servicebus_testcase.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\servicebus_settings_real.py" />
<Compile Include="tests\servicebus_settings_fake.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\storage_settings_real.py" />
<Compile Include="tests\storage_settings_fake.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="tests\common_recordingtestcase.py" />
<Compile Include="tests\test_legacy_mgmt_affinitygroup.py" />
<Compile Include="tests\test_mgmt_compute.py" />
<Compile Include="tests\test_mgmt_network.py" />
Expand Down Expand Up @@ -314,25 +340,10 @@
<Content Include="README.rst" />
<Content Include="optional-requirements.txt" />
<Content Include="requirements.txt" />
<Content Include="tests\azurecredentials_sample.json" />
<Content Include="tests\coverage.bat" />
<Content Include="tests\coverage_x64.bat" />
<Content Include="tests\data\testhd" />
<Content Include="tests\data\WindowsAzure1.cspkg" />
<Content Include="tests\recordings\test_mgmt_compute.test_availability_sets.yaml" />
<Content Include="tests\recordings\test_mgmt_compute.test_usage.yaml" />
<Content Include="tests\recordings\test_mgmt_compute.test_vms_with_image_reference.yaml" />
<Content Include="tests\recordings\test_mgmt_compute.test_vms_with_source_image.yaml" />
<Content Include="tests\recordings\test_mgmt_compute.test_vm_extensions.yaml" />
<Content Include="tests\recordings\test_mgmt_compute.test_vm_sizes.yaml" />
<Content Include="tests\recordings\test_mgmt_network.test_dns_availability.yaml" />
<Content Include="tests\recordings\test_mgmt_network.test_network_security_groups.yaml" />
<Content Include="tests\recordings\test_mgmt_network.test_public_ip_addresses.yaml" />
<Content Include="tests\recordings\test_mgmt_network.test_subnets.yaml" />
<Content Include="tests\recordings\test_mgmt_network.test_virtual_networks.yaml" />
<Content Include="tests\recordings\test_mgmt_resource.test_providers.yaml" />
<Content Include="tests\recordings\test_mgmt_resource.test_resource_groups.yaml" />
<Content Include="tests\recordings\test_mgmt_storage.test_storage_accounts.yaml" />
<Content Include="tests\run" />
<Content Include="tests\run-legacy-mgmt.bat" />
<Content Include="tests\run-mgmt.bat" />
Expand Down
16 changes: 0 additions & 16 deletions tests/azurecredentials_sample.json

This file was deleted.

8 changes: 2 additions & 6 deletions tests/blob_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import sys

from azure.storage import BlobService
from .util import credentials
from . import storage_settings_real as settings

# Warning:
# This script will take a while to run with everything enabled.
Expand Down Expand Up @@ -131,11 +131,7 @@ def process(service, blobs, counts, is_page_blob):


def main():
service = BlobService(
credentials.getStorageServicesName(),
credentials.getStorageServicesKey(),
)

service = BlobService(settings.STORAGE_ACCOUNT_NAME, settings.STORAGE_ACCOUNT_KEY)
service.create_container(CONTAINER_NAME)

process(service, LOCAL_BLOCK_BLOB_FILES, CONNECTION_COUNTS, is_page_blob=False)
Expand Down
78 changes: 0 additions & 78 deletions tests/clean.py

This file was deleted.

54 changes: 54 additions & 0 deletions tests/common_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#-------------------------------------------------------------------------
# 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 json
import os.path

from .util import (
get_test_file_path,
)


def get_token_from_username_password(authority_url, username, password):
import adal
token_response = adal.acquire_token_with_username_password(
authority_url,
username,
password,
)
return token_response.get('accessToken')


def get_token_from_client_credentials(authority, client_id, secret):
import adal
token_response = adal.acquire_token_with_client_credentials(
authority,
client_id,
secret,
)
return token_response.get('accessToken')


def get_token_from_json_file():
'''
Read the token from a json file 'credentials_real.json' in this directory
where the file looks like this:
{
"authorization_header": "Bearer eyJ0...8f5w"
}
'''
with open(get_test_file_path(os.path.join('credentials_real.json'))) as credential_file:
credential = json.load(credential_file)
token = credential['authorization_header'].split()[1]
return token
Loading

0 comments on commit 3291ecf

Please sign in to comment.