added it_get_public_file_record_and_download_them, it_try_to_get_protected_file_record, it_get_shared_record, it_get_deleted_shared_record, it_get_shared_page, it_get_deleted_shared_page test

This commit is contained in:
Peter Papp
2021-03-10 08:41:21 +01:00
parent e164d1021c
commit aecdf56304
14 changed files with 195 additions and 41 deletions
+64 -1
View File
@@ -237,5 +237,68 @@ class ShareTest extends TestCase
]);
}
// TODO: napisat testy pre FileSharingController
/**
* @test
*/
public function it_get_shared_record()
{
$share = Share::factory(Share::class)
->create([
'is_protected' => 0,
]);
$this->get("/api/shared/$share->token")
->assertStatus(200)
->assertExactJson([
'data' => [
'id' => $share->id,
'type' => 'shares',
'attributes' => [
'permission' => $share->permission,
'is_protected' => '0',
'item_id' => $share->item_id,
'expire_in' => $share->expire_in,
'token' => $share->token,
'link' => $share->link,
'type' => $share->type,
'created_at' => $share->created_at->toJson(),
'updated_at' => $share->updated_at->toJson(),
],
]
]);
}
/**
* @test
*/
public function it_get_deleted_shared_record()
{
$this->get("/api/shared/19ZMPNiass4ZqWwQ")
->assertNotFound();
}
/**
* @test
*/
public function it_get_shared_page()
{
$share = Share::factory(Share::class)
->create([
'type' => 'file',
'is_protected' => false,
]);
$this->get("/shared/$share->token")
->assertViewIs('index')
->assertStatus(200);
}
/**
* @test
*/
public function it_get_deleted_shared_page()
{
$this->get('/shared/19ZMPNiass4ZqWwQ')
->assertNotFound();
}
}