Bug 26309: Unit tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2020-08-27 15:03:07 +00:00 committed by Jonathan Druart
parent 017e19567a
commit 2e421ed7a4

View file

@ -37,7 +37,7 @@ $schema->storage->txn_begin;
subtest '_read_configuration() tests' => sub {
plan tests => 10;
plan tests => 13;
my $configuration;
t::lib::Mocks::mock_config( 'elasticsearch', undef );
@ -93,7 +93,17 @@ subtest '_read_configuration() tests' => sub {
$configuration = Koha::SearchEngine::Elasticsearch::_read_configuration;
is( $configuration->{index_name}, 'index', 'Index configuration parsed correctly' );
is( $configuration->{cxn_pool}, 'Static', 'cxn_pool configuration set correctly to Static if not specified' );
is_deeply( $configuration->{nodes}, \@servers , 'Server configuration parsed correctly' );
t::lib::Mocks::mock_config( 'elasticsearch', { server => \@servers, index_name => 'index', cxn_pool => 'Fluid' } );
$configuration = Koha::SearchEngine::Elasticsearch::_read_configuration;
is( $configuration->{cxn_pool}, 'Fluid', 'cxn_pool configuration parsed correctly' );
my $params = Koha::SearchEngine::Elasticsearch::get_elasticsearch_params;
is_deeply( $configuration->{nodes}, \@servers , 'get_elasticsearch_params is just a wrapper for _read_configuration' );
};
subtest 'get_elasticsearch_settings() tests' => sub {