コード例 #1
0
    def test_delete_account_backups(self):
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)

        account_backup_list = self.client.account_backups.list(
            BACKUP_RG, TEST_ACC_1)
        self.assertGreaterEqual(len(list(account_backup_list)), 1)

        delete_volume(self.client,
                      BACKUP_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        self.client.account_backups.begin_delete(BACKUP_RG, TEST_ACC_1,
                                                 TEST_BACKUP_1).wait()

        account_backup_list = self.client.account_backups.list(
            BACKUP_RG, TEST_ACC_1)
        for backup in account_backup_list:
            self.assertNotEqual(backup.name, TEST_ACC_1 + "/" + TEST_BACKUP_1)

        delete_pool(self.client,
                    BACKUP_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, BACKUP_RG, TEST_ACC_1, live=self.is_live)
コード例 #2
0
    def test_get_account_backups(self):
        # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers
        set_custom_default_matcher(
            compare_bodies=False,
            excluded_headers=
            "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
        )
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)

        account_backup = self.client.account_backups.get(
            TEST_RG, TEST_ACC_1, TEST_BACKUP_1)
        assert account_backup.name == TEST_ACC_1 + "/" + TEST_BACKUP_1

        disable_backup(self.client, TEST_BACKUP_1, live=self.is_live)
        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #3
0
    def test_list_account_backups(self):
        # this can be reverted to set_bodiless_matcher() after tests are re-recorded and don't contain these headers
        set_custom_default_matcher(
            compare_bodies=False,
            excluded_headers=
            "Authorization,Content-Length,x-ms-client-request-id,x-ms-request-id"
        )
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)
        create_backup(self.client,
                      backup_name=TEST_BACKUP_2,
                      backup_only=True,
                      live=self.is_live)

        account_backup_list = self.client.account_backups.list(
            TEST_RG, TEST_ACC_1)
        backup_count = 0
        for backup in account_backup_list:
            if TEST_BACKUP_1 in backup.name or TEST_BACKUP_2 in backup.name:
                backup_count += 1

        assert backup_count == 2

        disable_backup(self.client, live=self.is_live)
        disable_backup(self.client,
                       backup_name=TEST_BACKUP_2,
                       live=self.is_live)

        account_backup_list = self.client.account_backups.list(
            TEST_RG, TEST_ACC_1)
        backup_count = 0
        for backup in account_backup_list:
            if TEST_BACKUP_1 in backup.name or TEST_BACKUP_2 in backup.name:
                backup_count += 1

        assert backup_count == 0

        delete_volume(self.client,
                      TEST_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    TEST_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, TEST_RG, TEST_ACC_1, live=self.is_live)
コード例 #4
0
    def test_list_account_backups(self):
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)
        create_backup(self.client,
                      backup_name=TEST_BACKUP_2,
                      backup_only=True,
                      live=self.is_live)

        account_backup_list = self.client.account_backups.list(
            BACKUP_RG, TEST_ACC_1)
        backup_count = 0
        for backup in account_backup_list:
            if TEST_BACKUP_1 in backup.name or TEST_BACKUP_2 in backup.name:
                backup_count += 1

        self.assertEqual(backup_count, 2)

        disable_backup(self.client, live=self.is_live)
        disable_backup(self.client,
                       backup_name=TEST_BACKUP_2,
                       live=self.is_live)

        account_backup_list = self.client.account_backups.list(
            BACKUP_RG, TEST_ACC_1)
        backup_count = 0
        for backup in account_backup_list:
            if TEST_BACKUP_1 in backup.name or TEST_BACKUP_2 in backup.name:
                backup_count += 1

        self.assertEqual(backup_count, 0)

        delete_volume(self.client,
                      BACKUP_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    BACKUP_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, BACKUP_RG, TEST_ACC_1, live=self.is_live)
コード例 #5
0
    def test_get_account_backups(self):
        create_backup(self.client,
                      backup_name=TEST_BACKUP_1,
                      live=self.is_live)

        account_backup = self.client.account_backups.get(
            BACKUP_RG, TEST_ACC_1, TEST_BACKUP_1)
        self.assertEqual(account_backup.name, TEST_ACC_1 + "/" + TEST_BACKUP_1)

        disable_backup(self.client, TEST_BACKUP_1, live=self.is_live)
        delete_volume(self.client,
                      BACKUP_RG,
                      TEST_ACC_1,
                      TEST_POOL_1,
                      TEST_VOL_1,
                      live=self.is_live)
        delete_pool(self.client,
                    BACKUP_RG,
                    TEST_ACC_1,
                    TEST_POOL_1,
                    live=self.is_live)
        delete_account(self.client, BACKUP_RG, TEST_ACC_1, live=self.is_live)