You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2017/09/19 21:01:09 UTC
[11/11] libcloud git commit: Add tests for "_get_instance_vhd" method.
Add tests for "_get_instance_vhd" method.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/91ea0911
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/91ea0911
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/91ea0911
Branch: refs/heads/trunk
Commit: 91ea09116afa5b5e969a6a2184c3a68fc192c485
Parents: 800f8d1
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Sep 19 22:57:58 2017 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Sep 19 23:00:49 2017 +0200
----------------------------------------------------------------------
libcloud/test/compute/test_azure_arm.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/91ea0911/libcloud/test/compute/test_azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py
index 25c3e11..984feed 100644
--- a/libcloud/test/compute/test_azure_arm.py
+++ b/libcloud/test/compute/test_azure_arm.py
@@ -12,11 +12,14 @@
# 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 libcloud
+
import json
import sys
import functools
from datetime import datetime
+import mock
+
from libcloud.compute.base import (NodeLocation, NodeSize, VolumeSnapshot,
StorageVolume)
from libcloud.compute.drivers.azure_arm import AzureImage, NodeAuthPassword
@@ -379,6 +382,21 @@ class AzureNodeDriverTests(LibcloudTestCase):
res_value = snapshot.destroy()
self.assertTrue(res_value)
+ def test_get_instance_vhd(self):
+ with mock.patch.object(self.driver, '_ex_delete_old_vhd'):
+ # Default storage suffix
+ vhd_url = self.driver._get_instance_vhd(name='test1',
+ ex_resource_group='000000',
+ ex_storage_account='sga1')
+ self.assertEqual(vhd_url, 'https://sga1.blob.core.windows.net/vhds/test1-os_0.vhd')
+
+ # Custom storage suffix
+ self.driver.connection.storage_suffix = '.core.chinacloudapi.cn'
+ vhd_url = self.driver._get_instance_vhd(name='test1',
+ ex_resource_group='000000',
+ ex_storage_account='sga1')
+ self.assertEqual(vhd_url, 'https://sga1.blob.core.chinacloudapi.cn/vhds/test1-os_0.vhd')
+
class AzureMockHttp(MockHttp):
fixtures = ComputeFileFixtures('azure_arm')