Bug 39320: (follow-up) Add counts API tests
Prevent tests to fail if data in DB Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
aab1c7e37e
commit
1a5de8d08f
|
|
@ -24,6 +24,13 @@ use Test::Mojo;
|
|||
use t::lib::TestBuilder;
|
||||
use t::lib::Mocks;
|
||||
|
||||
use Koha::ERM::Agreements;
|
||||
use Koha::ERM::Documents;
|
||||
use Koha::ERM::EHoldings::Packages;
|
||||
use Koha::ERM::EHoldings::Titles;
|
||||
use Koha::ERM::Licenses;
|
||||
use Koha::ERM::EUsage::UsageDataProviders;
|
||||
|
||||
use Koha::Database;
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
|
|
@ -37,6 +44,13 @@ subtest 'count() tests' => sub {
|
|||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
Koha::ERM::Agreements->search->delete;
|
||||
Koha::ERM::Documents->search->delete;
|
||||
Koha::ERM::EHoldings::Packages->search->delete;
|
||||
Koha::ERM::EHoldings::Titles->search->delete;
|
||||
Koha::ERM::Licenses->search->delete;
|
||||
Koha::ERM::EUsage::UsageDataProviders->search->delete;
|
||||
|
||||
my $librarian = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Patrons',
|
||||
|
|
@ -64,8 +78,12 @@ subtest 'count() tests' => sub {
|
|||
$t->get_ok("//$userid:$password@/api/v1/erm/counts")->status_is(200)->json_is(
|
||||
{
|
||||
counts => {
|
||||
agreements_count => 1, documents_count => 0, eholdings_packages_count => 0,
|
||||
eholdings_titles_count => 0, licenses_count => 1, usage_data_providers_count => 0
|
||||
agreements_count => 1,
|
||||
documents_count => 0,
|
||||
eholdings_packages_count => 0,
|
||||
eholdings_titles_count => 0,
|
||||
licenses_count => 1,
|
||||
usage_data_providers_count => 0
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue