Basic storage routine works, basic file handling.

This commit is contained in:
James Cole
2018-05-10 09:10:16 +02:00
parent 116f7ed613
commit cabcb9c6d0
16 changed files with 278 additions and 157 deletions

View File

@@ -288,7 +288,7 @@ class JobStatusControllerTest extends TestCase
$this->be($this->user());
$response = $this->post(route('import.job.start', [$job->key]));
$response->assertStatus(200);
$response->assertExactJson(['status' => 'NOK', 'message' => 'JobStatusController::start expects state "ready_to_run".']);
$response->assertExactJson(['status' => 'NOK', 'message' => 'JobStatusController::start expects status "ready_to_run".']);
}
/**
@@ -322,26 +322,6 @@ class JobStatusControllerTest extends TestCase
$response->assertExactJson(['status' => 'OK', 'message' => 'storage_finished']);
}
/**
* @covers \FireflyIII\Http\Controllers\Import\JobStatusController
*/
public function testStoreInvalidState(): void
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Kfake_job_' . random_int(1, 1000);
$job->status = 'some_bad_state';
$job->provider = 'fake';
$job->transactions = [];
$job->file_type = '';
$job->save();
$this->be($this->user());
$response = $this->post(route('import.job.store', [$job->key]));
$response->assertStatus(200);
$response->assertExactJson(['status' => 'NOK', 'message' => 'JobStatusController::start expects state "provider_finished".']);
}
/**
* @covers \FireflyIII\Http\Controllers\Import\JobStatusController
*/
@@ -372,4 +352,26 @@ class JobStatusControllerTest extends TestCase
$response->assertStatus(200);
$response->assertExactJson(['status' => 'NOK', 'message' => 'The import storage routine crashed: Some storage exception.']);
}
/**
* @covers \FireflyIII\Http\Controllers\Import\JobStatusController
*/
public function testStoreInvalidState(): void
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'Kfake_job_' . random_int(1, 1000);
$job->status = 'some_bad_state';
$job->provider = 'fake';
$job->transactions = [];
$job->file_type = '';
$job->save();
$this->be($this->user());
$response = $this->post(route('import.job.store', [$job->key]));
$response->assertStatus(200);
$response->assertExactJson(
['status' => 'NOK', 'message' => 'JobStatusController::start expects status "provider_finished" instead of "' . $job->status . '".']
);
}
}