0
當渡槽實施的OAuth我錯誤地沒有按照測試驅動開發思想,我現在爲它付出...丟失配置文件測試 - 渡槽
當我運行我的測試中,我得到的錯誤:
"No configuration file found. See README.md."
這是從initializeApplication方法在我AppSink類拋出。 據我瞭解,測試利用config.src.yaml文件,所以我有相應的配置我的測試工具:
application = new Application<OdexSink>();
application.configuration.port = 0;
application.configuration.configurationFilePath = "config.src.yaml";
因爲我是能夠運行測試我實現了AuthServer等之前,我懷疑它發生在一路上。
我的測試設置如下:
var app = new Application<OdexSink>();
TestClient client;
setUp(() async {
await app.start(runOnMainIsolate: true);
client = new TestClient(app);
var ctx = ManagedContext.defaultContext;
var builder = new SchemaBuilder.toSchema(ctx.persistentStore, new Schema.fromDataModel(ctx.dataModel), isTemporary: true);
for (var cmd in builder.commands) {
await ctx.persistentStore.execute(cmd);
}
});
而且我的測試工具start()方法是:
Future start() async {
RequestController.letUncaughtExceptionsEscape = true;
application = new Application<OdexSink>();
application.configuration.port = 0;
application.configuration.configurationFilePath = "config.src.yaml";
await application.start(runOnMainIsolate: true);
await createDatabaseSchema(ManagedContext.defaultContext, sink.logger);
await addClientRecord();
await addClientRecord(clientID: DefaultClientID, clientSecret: DefaultClientSecret);
client = new TestClient(application)
..clientID = DefaultClientID
..clientSecret = DefaultClientSecret;
}
我config.src.yaml文件退出,幷包含DB信息。