2017-07-07 7 views
0

私が誤ってテスト駆動開発のイデオロギーに従わなかった、と私は今それのために払ってい水路でのOAuthを実装する...欠落設定ファイル - 水道橋

私は私のテストを実行すると、私が手エラー:

"No configuration file found. See README.md." 

私のAppSinkクラスのinitializeApplicationメソッドからスローされます。 私はそれを理解するとして、私はそれに応じて私のテストハーネスを構成しているので、テストは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の情報が含まれてい

私のテストのセットアップは、次の通りです。

答えて

1

ああ、あなたのsetUpメソッドでは、TestApplicationハーネスの代わりにApplicationを作成して起動しています。それは、すでにテストハーネスで行われ、この

var app = new TestApplication(); 

setUp(() async { 
    await app.start(); 
}); 

セットアップで他のもののすべてのようになりますと、あなたはapp.clientとしてTestClientを使用することができます。

expect(await app.client.request("/endpoint"), hasStatus(200));