def test_load_tron_yaml_empty(self, mock_read_file, mock_read_service_info): mock_read_file.return_value = {} mock_read_service_info.return_value = {} soa_dir = '/other/services' with pytest.raises(NoConfigurationForServiceError): tron_tools.load_tron_yaml('foo', 'dev', soa_dir=soa_dir) assert mock_read_file.call_count == 1 assert mock_read_service_info.call_count == 1 mock_read_file.assert_has_calls([mock.call('/other/services/tron/dev/foo.yaml')]) mock_read_service_info.assert_has_calls([mock.call('foo', 'tron-dev', soa_dir)])
def test_load_tron_yaml_picks_service_dir_first(self, mock_read_extra_service_configuration): config = "test" mock_read_extra_service_configuration.return_value = config assert config == tron_tools.load_tron_yaml(service="foo", cluster="bar", soa_dir="test") mock_read_extra_service_configuration.assert_called_once_with( service_name='foo', extra_info="tron-bar", soa_dir="test", )
def test_load_tron_yaml_falls_back_to_tron_dir( self, mock_read_yaml_file, mock_read_extra_service_configuration, ): config = "test" mock_read_extra_service_configuration.return_value = {} mock_read_yaml_file.return_value = config assert config == tron_tools.load_tron_yaml(service="foo", cluster="bar", soa_dir="test") mock_read_extra_service_configuration.assert_called_once_with( service_name='foo', extra_info="tron-bar", soa_dir="test", ) mock_read_yaml_file.assert_called_once_with("test/tron/bar/foo.yaml")