Skip to content

Commit

Permalink
update config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Oct 21, 2024
1 parent 9fe5b8e commit b2236ca
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
import logging
import unittest
import unittest.mock as mock
from datetime import datetime, timezone as tz
from pathlib import Path

import geospaas_harvesting.config as config
import geospaas_harvesting.providers.base as providers_base
import geospaas_harvesting.providers.podaac as providers_podaac
import geospaas_harvesting.providers.cmems as providers_cmems
import geospaas_harvesting.providers.resto as providers_resto
Expand Down Expand Up @@ -58,10 +55,17 @@ def test_parse(self):
name='cmems', username='user', password='pass'),
})

def test_parse_error(self):
def test_parse_config_error(self):
"""Test error handling when parsing wrong configuration"""
with self.assertLogs(config.logger, level=logging.ERROR):
_ = config.ProvidersArgument('providers').parse({'foo': {}})
config.ProvidersArgument('providers').parse({'foo': {}})

def test_parse_no_provider_found(self):
"""Test error handling when no provider matches the requested
type
"""
with self.assertLogs(config.logger, level=logging.ERROR):
config.ProvidersArgument('providers').parse({'foo': {'type': 'foo'}})


class ProvidersConfigurationTestCase(unittest.TestCase):
Expand Down

0 comments on commit b2236ca

Please sign in to comment.