Esempio n. 1
0
def endpoint():
    yield Endpoint.from_dict(
        "test",
        {
            "enabled": True,
            "version": "v10",
            "model": "api.models.WellHorizontal",
            "exclude": [],
            "normalize": False,
            "options": {
                "data_type": "Well",
                "template": "EnerdeqML Well",
                "criteria": {
                    "hole_direction": "H"
                },
            },
            "tasks": {
                "endpoint_check": {
                    "seconds": 60,
                    "options": {
                        "query_path": "well_by_api.xml",
                        "matrix": {
                            "sequoia": {
                                "api": "42461409160000"
                            }
                        },
                    },
                },
            },
        },
    )
Esempio n. 2
0
def endpoints():
    yield Endpoint.load_from_config(conf)
Esempio n. 3
0
    def test_load_from_config_bad_endpoint(self):
        class Conf:
            endpoints = {None: None}

        Endpoint.load_from_config(Conf())
Esempio n. 4
0
 def test_load_from_empty_config(self):
     with pytest.raises(AttributeError):
         assert Endpoint.load_from_config({}) == {}
Esempio n. 5
0
 def test_load_from_config(self, conf):
     Endpoint.load_from_config(conf)
Esempio n. 6
0
 def test_create_endpoint(self):
     Endpoint("test", "well_horizontal")
Esempio n. 7
0
                # persist leftovers
                self.model.core_insert(rows)


if __name__ == "__main__":
    from fracfocus import create_app, db
    from collector import Endpoint
    import requests
    from pathlib import Path
    import os

    app = create_app()
    app.app_context().push()

    endpoints = Endpoint.load_from_config(conf)

    endpoint = endpoints["registry"]
    c = FracFocusCollector(endpoint)

    paths = [
        Path(os.path.join(conf.COLLECTOR_DOWNLOAD_PATH, x))
        for x in os.listdir(conf.COLLECTOR_DOWNLOAD_PATH)
    ]

    paths

    row = {
        "upload_key": "68acaa3e-c788-45fb-8f08-b1dc81ccf0ca",
        "api14": "42127380120000",
        "state_no": 42,