コード例 #1
0
ファイル: models_test.py プロジェクト: BlobBackup/BlobBackup
 def test_get_backend__aws(self):
     backup = Backup()
     backup.location = "Amazon AWS"
     backup.aws_key_id = environ["BLOBBACKUP_AWS_KEY_ID"]
     backup.aws_key = environ["BLOBBACKUP_AWS_KEY"]
     backup.aws_bucket = environ["BLOBBACKUP_AWS_BUCKET"]
     backup.cloud_prefix = "tmp"
     self._verify_backend(Utils.get_backend(backup), AwsBackend)
コード例 #2
0
    def accept(self):
        name = self.name_line_edit.text().strip()
        password = self.password_line_edit.text()
        if self.just_save:
            confirm_password = password
        else:
            confirm_password = self.confirm_password_line_edit.text()
        url = self.s3_url_line_edit.text().strip()
        key_id = self.key_id_line_edit.text().strip()
        key = self.key_line_edit.text().strip()
        bucket = self.bucket_line_edit.text().strip()
        prefix = self.prefix_line_edit.text().strip()

        backup = Backup()
        backup.name = name
        backup.location = "S3 Storage"
        backup.password = password
        backup.s3_url = url
        backup.aws_key_id = key_id
        backup.aws_key = key
        backup.aws_bucket = bucket
        backup.cloud_prefix = prefix
        self.backup = backup

        fs = [
            Validator.validate_plan_name, Validator.validate_confirm_password,
            Validator.validate_non_empty, Validator.validate_non_empty,
            Validator.validate_non_empty, Validator.validate_non_empty,
            Validator.validate_non_empty, Validator.validate_no_space,
            Validator.validate_no_space, Validator.validate_backend,
            Validator.validate_repo
        ]
        args = [(name, ), (password, confirm_password), ("AWS Key Id", key_id),
                ("S3 URL", url), ("AWS Key", key), ("Bucket", bucket),
                ("Prefix", prefix), ("Bucket", bucket), ("Prefix", prefix),
                (backup, ), (backup, self.just_save)]
        self.setEnabled(False)
        self.thread = CommandThread(config_worker, {"fs": fs, "args": args})
        self.thread.result.connect(self.command_done)
        self.thread.start()