An error occurred while loading the file. Please try again.
-
xuty authored6b935ff7
minio_test.dart 19.35 KiB
import 'dart:io';
import 'dart:typed_data';
import 'package:minio/io.dart';
import 'package:minio/minio.dart';
import 'package:minio/src/minio_models_generated.dart';
import 'package:test/test.dart';
import 'helpers.dart';
void main() {
testConstruct();
testListBuckets();
testBucketExists();
testFPutObject();
testGetObjectACL();
testSetObjectACL();
testGetObject();
testPutObject();
testGetBucketNotification();
testSetBucketNotification();
testRemoveAllBucketNotification();
testListenBucketNotification();
testStatObject();
testMakeBucket();
testRemoveBucket();
testRemoveObject();
testListObjects();
}
void testConstruct() {
test('Minio() implies http port', () {
final client = getMinioClient(port: null, useSSL: false);
expect(client.port, equals(80));
});
test('Minio() implies https port', () {
final client = getMinioClient(port: null, useSSL: true);
expect(client.port, equals(443));
});
test('Minio() overrides port with http', () {
final client = getMinioClient(port: 1234, useSSL: false);
expect(client.port, equals(1234));
});
test('Minio() overrides port with https', () {
final client = getMinioClient(port: 1234, useSSL: true);
expect(client.port, equals(1234));
});
test('Minio() throws when endPoint is url', () {
expect(
() => getMinioClient(endpoint: 'http://play.min.io'),
throwsA(isA<MinioError>()),
);
});
test('Minio() throws when port is invalid', () {
expect(
() => getMinioClient(port: -1),
throwsA(isA<MinioError>()),
);
expect(
() => getMinioClient(port: 65536),
throwsA(isA<MinioError>()),
);
});
}