Пример #1
0
    def test_filters_on_categories(self, mocked_categories):
        # Given
        mocked_categories.return_value = test_categories
        catalog = Catalog()

        # When
        categories = catalog.country('usa').categories

        # Then
        mocked_categories.assert_called_once_with({COUNTRY_FILTER: 'usa'})
        assert categories == test_categories
Пример #2
0
    def test_filters_on_datasets(self, mocked_datasets):
        # Given
        mocked_datasets.return_value = test_datasets
        catalog = Catalog()

        # When
        datasets = catalog.country('usa').category('demographics').datasets

        # Then
        mocked_datasets.assert_called_once_with({
            COUNTRY_FILTER: 'usa',
            CATEGORY_FILTER: 'demographics'
        })
        assert datasets == test_datasets
Пример #3
0
    def test_filters_on_datasets(self, mocked_datasets):
        # Given
        mocked_datasets.return_value = test_datasets
        catalog = Catalog()

        # When
        datasets = catalog.country('usa').category('demographics').datasets

        # Then
        mocked_datasets.called_once_with({
            'country_id': 'usa',
            'category_id': 'demographics'
        })
        assert datasets == test_datasets
Пример #4
0
    def test_filters_on_geographies(self, mocked_geographies):
        # Given
        mocked_geographies.return_value = test_geographies
        catalog = Catalog()

        # When
        geographies = catalog.country('usa').category(
            'demographics').geographies

        # Then
        mocked_geographies.called_once_with({
            'country_id': 'usa',
            'category_id': 'demographics'
        })
        assert geographies == test_geographies
Пример #5
0
    def test_all_filters(self, mocked_datasets):
        # Given
        mocked_datasets.return_value = test_datasets
        catalog = Catalog()

        # When
        datasets = catalog.country('usa').category('demographics') \
            .geography('carto-do-public-data.tiger.geography_esp_census_2019').datasets

        # Then
        mocked_datasets.called_once_with({
            'country_id':
            'usa',
            'category_id':
            'demographics',
            'geography_id':
            'carto-do-public-data.tiger.geography_esp_census_2019'
        })

        assert datasets == test_datasets
Пример #6
0
    def test_all_filters(self, mocked_datasets):
        # Given
        mocked_datasets.return_value = test_datasets
        catalog = Catalog()

        # When
        datasets = catalog.country('usa').category('demographics').public() \
            .geography('carto-do-public-data.tiger.geography_esp_census_2019').datasets

        # Then
        mocked_datasets.assert_called_once_with({
            COUNTRY_FILTER:
            'usa',
            CATEGORY_FILTER:
            'demographics',
            PUBLIC_FILTER:
            'true',
            GEOGRAPHY_FILTER:
            'carto-do-public-data.tiger.geography_esp_census_2019'
        })

        assert datasets == test_datasets