Example #1
0
    def test_builds_search_from_row_and_path(self):
        search = ImagerySearch.add_wgs_row_and_path({}, 1, 10)
        assert json.dumps(
            search
        ) == '{"sceneFilter": {"metadataFilter": {"filterType": "and", "childFilters": [{"filterType": "value", "filterId": "5e83d0b81d20cee8", "value": "10"}, {"filterType": "value", "filterId": "5e83d0b849ed5ee7", "value": "1"}]}}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path(
            {'sceneFilter': {
                'metadataFilter': {}
            }}, 1, 10)
        assert json.dumps(
            search
        ) == '{"sceneFilter": {"metadataFilter": {"filterType": "and", "childFilters": [{"filterType": "value", "filterId": "5e83d0b81d20cee8", "value": "10"}, {"filterType": "value", "filterId": "5e83d0b849ed5ee7", "value": "1"}]}}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path(
            {
                'sceneFilter': {
                    'metadataFilter': {
                        'filterType': 'and',
                        'childFilters': []
                    }
                }
            }, 1, 10)  # noqa: E501
        assert json.dumps(
            search
        ) == '{"sceneFilter": {"metadataFilter": {"filterType": "and", "childFilters": [{"filterType": "value", "filterId": "5e83d0b81d20cee8", "value": "10"}, {"filterType": "value", "filterId": "5e83d0b849ed5ee7", "value": "1"}]}}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path(
            {
                'sceneFilter': {
                    'metadataFilter': {
                        'filterType': 'and',
                        'childFilters': ['blah']
                    }
                }
            }, 1, 10)  # noqa: E501
        assert json.dumps(
            search
        ) == '{"sceneFilter": {"metadataFilter": {"filterType": "and", "childFilters": ["blah", {"filterType": "value", "filterId": "5e83d0b81d20cee8", "value": "10"}, {"filterType": "value", "filterId": "5e83d0b849ed5ee7", "value": "1"}]}}}'  # noqa: E501
Example #2
0
    def test_builds_search_from_row_and_path(self):
        search = ImagerySearch.add_wgs_row_and_path({}, 1, 10)
        assert json.dumps(
            search
        ) == '{"additionalCriteria": {"filterType": "and", "childFilters": [{"filterType": "value", "fieldId": 20514, "value": 10}, {"filterType": "value", "fieldId": 20516, "value": 1}]}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path({'foo': 'bar'}, 1, 10)
        assert json.dumps(
            search
        ) == '{"foo": "bar", "additionalCriteria": {"filterType": "and", "childFilters": [{"filterType": "value", "fieldId": 20514, "value": 10}, {"filterType": "value", "fieldId": 20516, "value": 1}]}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path({'additionalCriteria': {}},
                                                    1, 10)
        assert json.dumps(
            search
        ) == '{"additionalCriteria": {"filterType": "and", "childFilters": [{"filterType": "value", "fieldId": 20514, "value": 10}, {"filterType": "value", "fieldId": 20516, "value": 1}]}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path(
            {'additionalCriteria': {
                'filterType': 'and',
                'childFilters': []
            }}, 1, 10)  # noqa: E501
        assert json.dumps(
            search
        ) == '{"additionalCriteria": {"filterType": "and", "childFilters": [{"filterType": "value", "fieldId": 20514, "value": 10}, {"filterType": "value", "fieldId": 20516, "value": 1}]}}'  # noqa: E501

        search = ImagerySearch.add_wgs_row_and_path(
            {
                'additionalCriteria': {
                    'filterType': 'and',
                    'childFilters': ['blah']
                }
            }, 1, 10)  # noqa: E501
        assert json.dumps(
            search
        ) == '{"additionalCriteria": {"filterType": "and", "childFilters": ["blah", {"filterType": "value", "fieldId": 20514, "value": 10}, {"filterType": "value", "fieldId": 20516, "value": 1}]}}'  # noqa: E501