"Fossies" - the Fresh Open Source Software Archive

Member "freezer-10.0.0/freezer/tests/unit/openstack/test_admin.py" (14 Apr 2021, 2492 Bytes) of package /linux/misc/openstack/freezer-10.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test_admin.py": 9.0.0_vs_10.0.0.

    1 """Freezer admin.py related tests
    2 
    3 (c) Copyright 2018 ZTE Corporation.
    4 Licensed under the Apache License, Version 2.0 (the "License");
    5 you may not use this file except in compliance with the License.
    6 You may obtain a copy of the License at
    7 
    8     http://www.apache.org/licenses/LICENSE-2.0
    9 
   10 Unless required by applicable law or agreed to in writing, software
   11 distributed under the License is distributed on an "AS IS" BASIS,
   12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13 See the License for the specific language governing permissions and
   14 limitations under the License.
   15 
   16 """
   17 
   18 from freezer.openstack import admin
   19 from freezer.tests import commons
   20 
   21 
   22 class TestAdmin(commons.FreezerBaseTestCase):
   23     def setUp(self):
   24         super(TestAdmin, self).setUp()
   25         self.backup_opt = commons.BackupOpt1()
   26         self.admin_os = admin.AdminOs(self.backup_opt.client_manager)
   27         self.client_manager = self.backup_opt.client_manager
   28 
   29     def test_del_cinderbackup_and_dependend_incremental(self):
   30         self.admin_os.del_cinderbackup_and_dependend_incremental(1)
   31         try:
   32             self.admin_os.del_cinderbackup_and_dependend_incremental(1023)
   33         except Exception as e:
   34             msg = "Delete backup 1023 failed, the status of backup is error."
   35             self.assertEqual(msg, str(e))
   36 
   37         try:
   38             self.admin_os.del_cinderbackup_and_dependend_incremental(1024)
   39         except Exception as e:
   40             msg = "Delete backup 1024 failed due to timeout over 120s," \
   41                   " the status of backup is deleting."
   42             self.assertEqual(msg, str(e))
   43 
   44     def test_del_off_limit_fullbackup_keep(self):
   45         self.admin_os.del_off_limit_fullbackup('2', 1)
   46 
   47     def test_del_off_limit_fullbackup_keep_two(self):
   48         self.admin_os.del_off_limit_fullbackup('2', 2)
   49 
   50     def test_remove_cinderbackup_older_than(self):
   51         self.admin_os.remove_cinderbackup_older_than(35, 1463896546.0)
   52         try:
   53             self.admin_os.remove_cinderbackup_older_than(1023, 1463896546.0)
   54         except Exception as e:
   55             msg = "Delete backup 1023 failed, the status of backup is error."
   56             self.assertEqual(msg, str(e))
   57 
   58         try:
   59             self.admin_os.remove_cinderbackup_older_than(1024, 1463896546.0)
   60         except Exception as e:
   61             msg = "Delete backup 1024 failed due to timeout over 120s," \
   62                   " the status of backup is deleting."
   63             self.assertEqual(msg, str(e))