]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge "Add insecure option for swift backup"
authorJenkins <jenkins@review.openstack.org>
Fri, 9 Oct 2015 01:51:43 +0000 (01:51 +0000)
committerGerrit Code Review <review@openstack.org>
Fri, 9 Oct 2015 01:51:43 +0000 (01:51 +0000)
1  2 
cinder/tests/unit/test_backup_swift.py

index ca1eef6ce04baaf860ab5889b92f6744ea659022,5c57b2b2864ad072538a816abac0e7c6cb042bfc..faa4b9db1ff5d22c828983d7b1888d0667c5c424
@@@ -139,9 -129,43 +143,44 @@@ class BackupSwiftTestCase(test.TestCase
                            swift_dr.SwiftBackupDriver,
                            self.ctxt)
  
+     @ddt.data(
+         {'auth': 'single_user', 'insecure': True},
+         {'auth': 'single_user', 'insecure': False},
+         {'auth': 'per_user', 'insecure': True},
+         {'auth': 'per_user', 'insecure': False},
+     )
+     @ddt.unpack
+     def test_backup_swift_auth_insecure(self, auth, insecure):
+         self.override_config("backup_swift_auth_insecure", insecure)
+         self.override_config('backup_swift_auth', auth)
+         if auth == 'single_user':
+             self.override_config('backup_swift_user', 'swift-user')
+         mock_connection = self.mock_object(swift, 'Connection')
+         swift_dr.SwiftBackupDriver(self.ctxt)
+         if auth == 'single_user':
+             mock_connection.assert_called_once_with(insecure=insecure,
+                                                     authurl=ANY,
+                                                     auth_version=ANY,
+                                                     tenant_name=ANY,
+                                                     user=ANY,
+                                                     key=ANY,
+                                                     retries=ANY,
+                                                     starting_backoff=ANY,
+                                                     cacert=ANY)
+         else:
+             mock_connection.assert_called_once_with(insecure=insecure,
+                                                     retries=ANY,
+                                                     preauthurl=ANY,
+                                                     preauthtoken=ANY,
+                                                     starting_backoff=ANY,
+                                                     cacert=ANY)
      def test_backup_uncompressed(self):
 -        self._create_backup_db_entry()
 +        volume_id = '2b9f10a3-42b4-4fdf-b316-000000ceb039'
 +        self._create_backup_db_entry(volume_id=volume_id)
          self.flags(backup_compression_algorithm='none')
          service = swift_dr.SwiftBackupDriver(self.ctxt)
          self.volume_file.seek(0)