class TestWmsIdentification(unittest.TestCase):
    def setUp(self):
        yaml_file = 'tests/test_data/complex_identifier_test.yaml'

        with open(
                'tests/test_data/esri_wms_35bd4e2ce8cd13e8697b03976ffe1ee6.txt',
                'r') as f:
            content = f.read()
        url = 'http://www.mapserver.com/cgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GETCAPABILITIES'

        content = content.replace('\\n', '')
        parser = Parser(content)

        self.identifier = Identify([yaml_file], content, url,
                                   **{'parser': parser})
        # self.identifier.identify()

    def test_identify_dataset(self):
        protocol_data = next(p for p in self.identifier.yaml
                             if p['name'] == 'OGC:WMS')
        has_dataset = self.identifier._identify_dataset_service(protocol_data)

        self.assertFalse(has_dataset)

    def test_identify_metadata(self):
        protocol_data = next(p for p in self.identifier.yaml
                             if p['name'] == 'OGC:WMS')
        has_metadata = self.identifier._identify_metadata_service(
            protocol_data)

        self.assertFalse(has_metadata)
class TestWmsIdentification(unittest.TestCase):
    def setUp(self):
        yaml_file = 'tests/test_data/complex_identifier_test.yaml'

        with open('tests/test_data/esri_wms_35bd4e2ce8cd13e8697b03976ffe1ee6.txt', 'r') as f:
            content = f.read()
        url = 'http://www.mapserver.com/cgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GETCAPABILITIES'

        content = content.replace('\\n', '')
        parser = Parser(content)

        self.identifier = Identify([yaml_file], content, url, **{'parser': parser})
        # self.identifier.identify()

    def test_identify_dataset(self):
        protocol_data = next(p for p in self.identifier.yaml if p['name'] == 'OGC:WMS')
        has_dataset = self.identifier._identify_dataset_service(protocol_data)

        self.assertFalse(has_dataset)

    def test_identify_metadata(self):
        protocol_data = next(p for p in self.identifier.yaml if p['name'] == 'OGC:WMS')
        has_metadata = self.identifier._identify_metadata_service(protocol_data)

        self.assertFalse(has_metadata)
class TestWfsIdentification(unittest.TestCase):
    def setUp(self):
        yaml_file = 'tests/test_data/complex_identifier_test.yaml'

        with open('tests/test_data/wfs_v1_1_0.xml', 'r') as f:
            content = f.read()
        url = 'http://www.mapserver.com/cgi?SERVICE=WFS&VERSION=1.1.0&REQUEST=GETCAPABILITIES'

        content = content.replace('\\n', '')
        parser = Parser(content)

        self.identifier = Identify([yaml_file], content, url,
                                   **{'parser': parser})
        # self.identifier.identify()

    def test_identify_dataset(self):
        protocol_data = next(p for p in self.identifier.yaml
                             if p['name'] == 'OGC:WFS')
        has_dataset = self.identifier._identify_dataset_service(protocol_data)

        self.assertTrue(has_dataset)

    def test_identify_metadata(self):
        protocol_data = next(p for p in self.identifier.yaml
                             if p['name'] == 'OGC:WFS')
        has_metadata = self.identifier._identify_metadata_service(
            protocol_data)

        self.assertTrue(has_metadata)
class TestWfsIdentification(unittest.TestCase):
    def setUp(self):
        yaml_file = 'tests/test_data/complex_identifier_test.yaml'

        with open('tests/test_data/wfs_v1_1_0.xml', 'r') as f:
            content = f.read()
        url = 'http://www.mapserver.com/cgi?SERVICE=WFS&VERSION=1.1.0&REQUEST=GETCAPABILITIES'

        content = content.replace('\\n', '')
        parser = Parser(content)

        self.identifier = Identify([yaml_file], content, url, **{'parser': parser})
        # self.identifier.identify()

    def test_identify_dataset(self):
        protocol_data = next(p for p in self.identifier.yaml if p['name'] == 'OGC:WFS')
        has_dataset = self.identifier._identify_dataset_service(protocol_data)

        self.assertTrue(has_dataset)

    def test_identify_metadata(self):
        protocol_data = next(p for p in self.identifier.yaml if p['name'] == 'OGC:WFS')
        has_metadata = self.identifier._identify_metadata_service(protocol_data)

        self.assertTrue(has_metadata)