Beispiel #1
0
    def test_should_filter_a_backup_list_by_equal_and_not_equal_values(self):
        filtered = filter_backups_by_tags(self.backup_list,
                                          tags_equal={"foo": "bar"},
                                          tags_not_equal={"loren": "ipsun"})

        self.assertEqual(1, len(filtered))
        self.assertIn(self.backup_list[0], filtered)
Beispiel #2
0
    def delete(self):
        self.response.headers['Content-Type'] = 'text/plain'
        account = EC2Account()

        today = str(datetime.date.today())
        backups = account.get_backups()
        old_backups = filter_backups_by_tags(backups,
                                             tags_equal={"created_by":
                                                         "cloudsnap"},
                                             tags_not_equal={"created_at":
                                                             today}
                                             )
        for backup in old_backups:
            account.delete_backup(backup)
            Logger.log(self,
                       "image %s deregistered and snapshot %s deleted" %
                       (backup.id,
                        backup.block_device_mapping.current_value.snapshot_id))
Beispiel #3
0
    def test_should_filter_a_backup_list_by_not_equal_values(self):
        filtered_list = filter_backups_by_tags(self.backup_list,
                                               tags_not_equal={"foo": "bar"})

        self.assertEqual(1, len(filtered_list))
        self.assertIn(self.backup_list[1], filtered_list)