def test_non_sqlite(self, config_instance): """Make sure that passing a store other than 'sqlalchemy' raises exception.""" config_instance = config_instance(db_engine='postgres') backend, client = hamster_cli._get_config(config_instance) assert backend['db_host'] == config_instance.get('Backend', 'db_host') assert backend['db_port'] == config_instance.get('Backend', 'db_port') assert backend['db_name'] == config_instance.get('Backend', 'db_name') assert backend['db_user'] == config_instance.get('Backend', 'db_user') assert backend['db_password'] == config_instance.get('Backend', 'db_password')
def test_non_sqlite(self, config_instance): """Make sure that passing a store other than 'sqlalchemy' raises exception.""" config_instance = config_instance(db_engine='postgres') backend, client = hamster_cli._get_config(config_instance) assert backend['db_host'] == config_instance.get('Backend', 'db_host') assert backend['db_port'] == config_instance.get('Backend', 'db_port') assert backend['db_name'] == config_instance.get('Backend', 'db_name') assert backend['db_user'] == config_instance.get('Backend', 'db_user') assert backend['db_password'] == config_instance.get( 'Backend', 'db_password')
def test_daystart_valid(self, config_file, day_start): backend, client = hamster_cli._get_config(config_file( daystart=day_start)) assert backend['day_start'] == datetime.datetime.strptime( '05:00:00', '%H:%M:%S').time()
def test_log_levels_invalid(self, log_level, config_file): with pytest.raises(ValueError): backend, client = hamster_cli._get_config( config_file(log_level=log_level))
def test_log_levels_valid(self, log_level, config_file): backend, client = hamster_cli._get_config( config_file(log_level=log_level)) assert client['log_level'] == 10
def test_cwd(self, config_file): backend, client = hamster_cli._get_config(config_file()) assert client['cwd'] == '.'
def test_invalid_store(self, config_instance): """Make sure that encountering an unsupportet store will raise an exception.""" with pytest.raises(ValueError): backend, client = hamster_cli._get_config( config_instance(store='foobar'))
def test_log_levels_invalid(self, log_level, config_instance): """Test that invalid *string loglevels* raise ``ValueError``.""" with pytest.raises(ValueError): backend, client = hamster_cli._get_config( config_instance(log_level=log_level))
def test_daystart_valid(self, config_instance, day_start): """Test that ``day_start`` string translate to proper ``datetime.time`` instances.""" backend, client = hamster_cli._get_config( config_instance(daystart=day_start)) assert backend['day_start'] == datetime.datetime.strptime( '05:00:00', '%H:%M:%S').time()
def test_log_levels_valid(self, log_level, config_instance): """Make sure that *string loglevels* translate to their respective integers properly.""" backend, client = hamster_cli._get_config( config_instance(log_level=log_level)) assert client['log_level'] == 10
def test_invalid_store(self, config_instance): """Make sure that encountering an unsupportet store will raise an exception.""" with pytest.raises(ValueError): backend, client = hamster_cli._get_config(config_instance(store='foobar'))
def test_daystart_invalid(self, config_instance, day_start): """Test that invalid ``day_start`` strings raises ``ValueError``.""" with pytest.raises(ValueError): backend, client = hamster_cli._get_config( config_instance(daystart=day_start))
def test_daystart_valid(self, config_instance, day_start): """Test that ``day_start`` string translate to proper ``datetime.time`` instances.""" backend, client = hamster_cli._get_config(config_instance( daystart=day_start)) assert backend['day_start'] == datetime.datetime.strptime( '05:00:00', '%H:%M:%S').time()
def test_daystart_invalid(self, config_file, day_start): with pytest.raises(ValueError): backend, client = hamster_cli._get_config( config_file(daystart=day_start))
def test_log_filename_empty(self, config_file): """Test that a empty filename throws an error.""" with pytest.raises(ValueError): backend, client = hamster_cli._get_config( config_file(log_filename=''))