mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
chore: more tests for image/cover upload
This commit is contained in:
parent
e5a67fed05
commit
b8b522b422
2 changed files with 32 additions and 2 deletions
|
@ -34,6 +34,21 @@ class AlbumCoverTest extends TestCase
|
||||||
|
|
||||||
$this->putAsUser('api/album/9999/cover', [
|
$this->putAsUser('api/album/9999/cover', [
|
||||||
'cover' => 'data:image/jpeg;base64,Rm9v'
|
'cover' => 'data:image/jpeg;base64,Rm9v'
|
||||||
], factory(User::class, 'admin')->create());
|
], factory(User::class, 'admin')->create())
|
||||||
|
->seeStatusCode(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUpdateNotAllowedForNormalUsers(): void
|
||||||
|
{
|
||||||
|
factory(Album::class)->create(['id' => 9999]);
|
||||||
|
|
||||||
|
$this->mediaMetadataService
|
||||||
|
->shouldReceive('writeAlbumCover')
|
||||||
|
->never();
|
||||||
|
|
||||||
|
$this->putAsUser('api/album/9999/cover', [
|
||||||
|
'cover' => 'data:image/jpeg;base64,Rm9v'
|
||||||
|
], factory(User::class)->create())
|
||||||
|
->seeStatusCode(403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,21 @@ class ArtistImageTest extends TestCase
|
||||||
|
|
||||||
$this->putAsUser('api/artist/9999/image', [
|
$this->putAsUser('api/artist/9999/image', [
|
||||||
'image' => 'data:image/jpeg;base64,Rm9v'
|
'image' => 'data:image/jpeg;base64,Rm9v'
|
||||||
], factory(User::class, 'admin')->create());
|
], factory(User::class, 'admin')->create())
|
||||||
|
->seeStatusCode(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUpdateNotAllowedForNormalUsers(): void
|
||||||
|
{
|
||||||
|
factory(Artist::class)->create(['id' => 9999]);
|
||||||
|
|
||||||
|
$this->mediaMetadataService
|
||||||
|
->shouldReceive('writeArtistImage')
|
||||||
|
->never();
|
||||||
|
|
||||||
|
$this->putAsUser('api/artist/9999/image', [
|
||||||
|
'image' => 'data:image/jpeg;base64,Rm9v'
|
||||||
|
], factory(User::class)->create())
|
||||||
|
->seeStatusCode(403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue