Ignore:
Timestamp:
May 25, 2019, 5:40:08 PM (8 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
70f328b
Parents:
28198a1
git-author:
Joachim Langenbach <joachim.langenbach@…> (05/22/19 18:20:13)
git-committer:
Joachim Langenbach <joachim.langenbach@…> (05/25/19 17:40:08)
Message:

Gauges could be added now

Location:
src/mapservice/src-gen
Files:
10 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • src/mapservice/src-gen/.openapi-generator/VERSION

    r28198a1 r13cbe66  
    1 3.3.4
     14.0.0
  • src/mapservice/src-gen/openapi_server/__main__.py

    r28198a1 r13cbe66  
    33import connexion
    44from flask_cors import CORS
    5 from flask import render_template
     5#from flask import render_template
     6import flask
     7from sqlalchemy import event
    68
    79from openapi_server import encoder
    810
    911from openapi_server.server_impl.database.Model import db, User, ApiKey, db_test_setup
     12
     13from openapi_server.server_impl.ValidatorWorkaround import ValidatorWorkaround
    1014
    1115app = connexion.App(__name__, specification_dir='./openapi/')
    … …  
    1519@application.before_first_request
    1620def create_database():
     21        @event.listens_for(db.engine, "connect")
     22        def load_spatialite(dbapi_conn, connection_record):
     23                if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:
     24                        # From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html
     25                        dbapi_conn.enable_load_extension(True)
     26                        dbapi_conn.load_extension('/usr/local/lib64/mod_spatialite')
     27
    1728        db_test_setup()
    1829
    … …  
    2334def main():
    2435        application.json_encoder = encoder.JSONEncoder
    25         app.add_api('openapi.yaml', arguments={'title': 'GNUBoat Mapservice API'}, validate_responses=True)
     36        app.add_api('openapi.yaml', arguments={'title': 'GNUBoat Mapservice API'}, validate_responses=True, strict_validation=True, validator_map={'response': ValidatorWorkaround})
    2637        application.config.from_object('openapi_server.server_impl.Config.DevelopmentConfig')
    2738
  • src/mapservice/src-gen/openapi_server/controllers/waters_controller.py

    r28198a1 r13cbe66  
    22import six
    33
     4from openapi_server.models.gauge import Gauge  # noqa: E501
     5from openapi_server.models.gauge_creation import GaugeCreation  # noqa: E501
    46from openapi_server.models.http_error import HttpError  # noqa: E501
    57from openapi_server.models.water import Water  # noqa: E501
    68from openapi_server.models.water_creation import WaterCreation  # noqa: E501
    79from openapi_server import util
    8 
    9 from openapi_server.server_impl.controllers import WatersController
    10 
    11 def water_get_by_id(id):  # noqa: E501
    12     """Represents a water
    13 
    14     Returns the water identified by id # noqa: E501
    15 
    16     :param id: Item ID
    17     :type id: int
    18 
    19     :rtype: Water
    20     """
    21     return WatersController.water_get_by_id(id)
    2210
    2311from openapi_server.server_impl.controllers import WatersController
    … …  
    3624        water_creation = WaterCreation.from_dict(connexion.request.get_json())  # noqa: E501
    3725    return WatersController.waters_create(water_creation=water_creation)
     26
     27from openapi_server.server_impl.controllers import WatersController
     28
     29def waters_gauge_create(water_id, gauge_creation=None):  # noqa: E501
     30    """Add a new water
     31
     32    Adds a new gauge for water waterId to the database # noqa: E501
     33
     34    :param water_id: Water ID
     35    :type water_id: int
     36    :param gauge_creation:
     37    :type gauge_creation: dict | bytes
     38
     39    :rtype: Gauge
     40    """
     41    if connexion.request.is_json:
     42        gauge_creation = GaugeCreation.from_dict(connexion.request.get_json())  # noqa: E501
     43    return WatersController.waters_gauge_create(water_id, gauge_creation=gauge_creation)
     44
     45from openapi_server.server_impl.controllers import WatersController
     46
     47def waters_gauge_get_by_id(water_id, gauge_id):  # noqa: E501
     48    """Represents a gauge
     49
     50    Returns the gauge identified by id # noqa: E501
     51
     52    :param water_id: Water ID
     53    :type water_id: int
     54    :param gauge_id: Gauge ID
     55    :type gauge_id: int
     56
     57    :rtype: Gauge
     58    """
     59    return WatersController.waters_gauge_get_by_id(water_id, gauge_id)
     60
     61from openapi_server.server_impl.controllers import WatersController
     62
     63def waters_gauges_get(water_id, name=None, manager=None, order_by=None, offset=None, limit=None):  # noqa: E501
     64    """Find gauges of water waterId by gaugeId
     65
     66    Returns all gauges of water waterId # noqa: E501
     67
     68    :param water_id: Water ID
     69    :type water_id: int
     70    :param name:
     71    :type name: str
     72    :param manager:
     73    :type manager: str
     74    :param order_by: Order by field: name
     75    :type order_by: str
     76    :param offset: Skip over a number of elements by specifying an offset value for the query
     77    :type offset: int
     78    :param limit: Limit the number of elements on the response
     79    :type limit: int
     80
     81    :rtype: List[Gauge]
     82    """
     83    return WatersController.waters_gauges_get(water_id, name=name, manager=manager, order_by=order_by, offset=offset, limit=limit)
    3884
    3985from openapi_server.server_impl.controllers import WatersController
    … …  
    58104    """
    59105    return WatersController.waters_get(name=name, manager=manager, order_by=order_by, offset=offset, limit=limit)
     106
     107from openapi_server.server_impl.controllers import WatersController
     108
     109def waters_get_by_id(id):  # noqa: E501
     110    """Represents a water
     111
     112    Returns the water identified by id # noqa: E501
     113
     114    :param id: Item ID
     115    :type id: int
     116
     117    :rtype: Water
     118    """
     119    return WatersController.waters_get_by_id(id)
  • src/mapservice/src-gen/openapi_server/models/__init__.py

    r28198a1 r13cbe66  
    44from __future__ import absolute_import
    55# import models into model package
     6from openapi_server.models.gauge import Gauge
     7from openapi_server.models.gauge_creation import GaugeCreation
     8from openapi_server.models.gauge_geo_json import GaugeGeoJson
     9from openapi_server.models.gauge_geo_json_properties import GaugeGeoJsonProperties
     10from openapi_server.models.geo_json_point import GeoJsonPoint
     11from openapi_server.models.geo_json_type import GeoJsonType
    612from openapi_server.models.http_error import HttpError
    713from openapi_server.models.order import Order
  • src/mapservice/src-gen/openapi_server/models/water.py

    r28198a1 r13cbe66  
    77
    88from openapi_server.models.base_model_ import Model
     9from openapi_server.models.gauge import Gauge
     10from openapi_server.models.osm_type import OsmType
    911from openapi_server import util
    1012
     13from openapi_server.models.gauge import Gauge  # noqa: E501
    1114from openapi_server.models.osm_type import OsmType  # noqa: E501
    1215
    … …  
    1720    """
    1821
    19     def __init__(self, water_id=None, name=None, manager=None, osm_id=None, osm_type=None):  # noqa: E501
     22    def __init__(self, water_id=None, name=None, manager=None, osm_id=None, osm_type=None, gauges=None):  # noqa: E501
    2023        """Water - a model defined in OpenAPI
    2124
    … …  
    3033        :param osm_type: The osm_type of this Water.  # noqa: E501
    3134        :type osm_type: OsmType
     35        :param gauges: The gauges of this Water.  # noqa: E501
     36        :type gauges: List[Gauge]
    3237        """
    3338        self.openapi_types = {
    … …  
    3641            'manager': str,
    3742            'osm_id': int,
    38             'osm_type': OsmType
     43            'osm_type': OsmType,
     44            'gauges': List[Gauge]
    3945        }
    4046
    … …  
    4450            'manager': 'manager',
    4551            'osm_id': 'osmId',
    46             'osm_type': 'osmType'
     52            'osm_type': 'osmType',
     53            'gauges': 'gauges'
    4754        }
    4855
    … …  
    5259        self._osm_id = osm_id
    5360        self._osm_type = osm_type
     61        self._gauges = gauges
    5462
    5563    @classmethod
    … …  
    172180
    173181        self._osm_type = osm_type
     182
     183    @property
     184    def gauges(self):
     185        """Gets the gauges of this Water.
     186
     187
     188        :return: The gauges of this Water.
     189        :rtype: List[Gauge]
     190        """
     191        return self._gauges
     192
     193    @gauges.setter
     194    def gauges(self, gauges):
     195        """Sets the gauges of this Water.
     196
     197
     198        :param gauges: The gauges of this Water.
     199        :type gauges: List[Gauge]
     200        """
     201
     202        self._gauges = gauges
  • src/mapservice/src-gen/openapi_server/models/water_creation.py

    r28198a1 r13cbe66  
    77
    88from openapi_server.models.base_model_ import Model
     9from openapi_server.models.osm_type import OsmType
    910from openapi_server import util
    1011
  • src/mapservice/src-gen/openapi_server/openapi/openapi.yaml

    r28198a1 r13cbe66  
    2323      default: v1
    2424tags:
    25 - description: A water is a river (like Mississippi, lake (Lake Ontario), or a sea (North Sea)
     25- description: A water is a river (like Mississippi, lake (Lake Ontario), or a sea
     26    (North Sea)
    2627  name: waters
    2728- description: All actions used to manage users and api keys
    … …  
    3031  /user:
    3132    get:
    32       description: Returns information for a user
     33      description: Returns information of current/authorized user
    3334      operationId: users_get
    3435      responses:
    … …  
    112113      - users
    113114      x-openapi-router-controller: openapi_server.controllers.users_controller
     115  /user/activate/{activation_code}:
     116    get:
     117      description: Activates a user account
     118      operationId: users_activate
     119      parameters:
     120      - description: Activation code
     121        example: dac9630aec642a428cd73f4be0a03569
     122        explode: false
     123        in: path
     124        name: activation_code
     125        required: true
     126        schema:
     127          $ref: '#/components/schemas/activationCode'
     128        style: simple
     129      responses:
     130        302:
     131          description: OK or not OK
     132          headers:
     133            Location:
     134              description: URL to the website, showing the result of the activation
     135              explode: false
     136              schema:
     137                type: string
     138              style: simple
     139      summary: Activates a user account
     140      tags:
     141      - users
     142      x-openapi-router-controller: openapi_server.controllers.users_controller
    114143  /user/apikey_create:
    115144    get:
    … …  
    144173      security:
    145174      - basicAuth: []
    146       - apiKeyAuth: []
    147175      summary: Returns a new API key
    148176      tags:
    … …  
    189217                $ref: '#/components/schemas/HttpError'
    190218          description: Unauthorized (401) acces to resource
     219        404:
     220          content:
     221            application/json:
     222              examples:
     223                HttpError:
     224                  $ref: '#/components/examples/HttpError'
     225              schema:
     226                $ref: '#/components/schemas/HttpError'
     227          description: Water with given Id not found
    191228      security:
    192229      - basicAuth: []
    193       - apiKeyAuth: []
    194230      summary: Deletes API key
    195       tags:
    196       - users
    197       x-openapi-router-controller: openapi_server.controllers.users_controller
    198   /user/activate/{activation_code}:
    199     get:
    200       description: Activates a user account
    201       operationId: users_activate
    202       parameters:
    203       - description: Activation code
    204         example: dac9630aec642a428cd73f4be0a03569
    205         explode: false
    206         in: path
    207         name: activation_code
    208         required: true
    209         schema:
    210           $ref: '#/components/schemas/activationCode'
    211         style: simple
    212       responses:
    213         302:
    214           description: OK or not OK
    215           headers:
    216             Location:
    217               description: URL to the website, showing the result of the activation
    218               explode: false
    219               schema:
    220                 type: string
    221               style: simple
    222       summary: Activates a user account
    223231      tags:
    224232      - users
    … …  
    255263          type: string
    256264        style: form
    257       - description: Skip over a number of elements by specifying an offset value for the query
     265      - description: Skip over a number of elements by specifying an offset value
     266          for the query
    258267        explode: true
    259268        in: query
    … …  
    287296                $ref: '#/components/schemas/waters'
    288297          description: OK
     298        404:
     299          content:
     300            application/json:
     301              examples:
     302                HttpError:
     303                  $ref: '#/components/examples/HttpError'
     304              schema:
     305                $ref: '#/components/schemas/HttpError'
     306          description: Water with given Id not found
    289307      summary: Find waters by id
    290308      tags:
    … …  
    341359    get:
    342360      description: Returns the water identified by id
    343       operationId: water_get_by_id
     361      operationId: waters_get_by_id
    344362      parameters:
    345363      - description: Item ID
    … …  
    371389          description: Water with given Id not found
    372390      summary: Represents a water
     391      tags:
     392      - waters
     393      x-openapi-router-controller: openapi_server.controllers.waters_controller
     394  /waters/{water_id}/gauges:
     395    get:
     396      description: Returns all gauges of water waterId
     397      operationId: waters_gauges_get
     398      parameters:
     399      - description: Water ID
     400        explode: false
     401        in: path
     402        name: water_id
     403        required: true
     404        schema:
     405          $ref: '#/components/schemas/itemId'
     406        style: simple
     407      - example: Missi
     408        explode: true
     409        in: query
     410        name: name
     411        required: false
     412        schema:
     413          $ref: '#/components/schemas/itemName'
     414        style: form
     415      - example: jane
     416        explode: true
     417        in: query
     418        name: manager
     419        required: false
     420        schema:
     421          $ref: '#/components/schemas/username'
     422        style: form
     423      - description: 'Order by field: name'
     424        explode: true
     425        in: query
     426        name: orderBy
     427        required: false
     428        schema:
     429          default: name
     430          example: name
     431          type: string
     432        style: form
     433      - description: Skip over a number of elements by specifying an offset value
     434          for the query
     435        explode: true
     436        in: query
     437        name: offset
     438        required: false
     439        schema:
     440          default: 0
     441          example: 0
     442          format: int32
     443          type: integer
     444        style: form
     445      - description: Limit the number of elements on the response
     446        explode: true
     447        in: query
     448        name: limit
     449        required: false
     450        schema:
     451          default: 10
     452          example: 10
     453          format: int32
     454          type: integer
     455        style: form
     456      responses:
     457        200:
     458          content:
     459            application/json:
     460              examples:
     461                Gauges:
     462                  $ref: '#/components/examples/Gauges'
     463              schema:
     464                $ref: '#/components/schemas/Gauges'
     465            application/geo+json:
     466              examples:
     467                Gauge:
     468                  $ref: '#/components/examples/GaugesGeoJson'
     469              schema:
     470                $ref: '#/components/schemas/GaugesGeoJson'
     471          description: OK
     472      summary: Find gauges of water waterId by gaugeId
     473      tags:
     474      - waters
     475      x-openapi-router-controller: openapi_server.controllers.waters_controller
     476    post:
     477      description: Adds a new gauge for water waterId to the database
     478      operationId: waters_gauge_create
     479      parameters:
     480      - description: Water ID
     481        explode: false
     482        in: path
     483        name: water_id
     484        required: true
     485        schema:
     486          $ref: '#/components/schemas/itemId'
     487        style: simple
     488      requestBody:
     489        content:
     490          application/json:
     491            example:
     492              name: New Orleans
     493              location:
     494              - 90.136111
     495              - 29.934722
     496            schema:
     497              $ref: '#/components/schemas/GaugeCreation'
     498      responses:
     499        201:
     500          content:
     501            application/json:
     502              examples:
     503                Gauge:
     504                  $ref: '#/components/examples/Gauge'
     505              schema:
     506                $ref: '#/components/schemas/Gauge'
     507            application/geo+json:
     508              examples:
     509                Gauge:
     510                  $ref: '#/components/examples/GaugeGeoJson'
     511              schema:
     512                $ref: '#/components/schemas/GaugeGeoJson'
     513          description: Gauge created
     514        400:
     515          content:
     516            application/json:
     517              examples:
     518                HttpError:
     519                  $ref: '#/components/examples/HttpError'
     520              schema:
     521                $ref: '#/components/schemas/HttpError'
     522          description: Bad Request (400)
     523        401:
     524          content:
     525            application/json:
     526              examples:
     527                HttpError:
     528                  $ref: '#/components/examples/HttpError'
     529              schema:
     530                $ref: '#/components/schemas/HttpError'
     531          description: Unauthorized (401) acces to resource
     532      security:
     533      - basicAuth: []
     534      - apiKeyAuth: []
     535      summary: Add a new water
     536      tags:
     537      - waters
     538      x-openapi-router-controller: openapi_server.controllers.waters_controller
     539  /waters/{water_id}/gauges/{gauge_id}:
     540    get:
     541      description: Returns the gauge identified by id
     542      operationId: waters_gauge_get_by_id
     543      parameters:
     544      - description: Water ID
     545        explode: false
     546        in: path
     547        name: water_id
     548        required: true
     549        schema:
     550          $ref: '#/components/schemas/itemId'
     551        style: simple
     552      - description: Gauge ID
     553        explode: false
     554        in: path
     555        name: gauge_id
     556        required: true
     557        schema:
     558          $ref: '#/components/schemas/itemId'
     559        style: simple
     560      responses:
     561        200:
     562          content:
     563            application/json:
     564              examples:
     565                Gauge:
     566                  $ref: '#/components/examples/Gauge'
     567              schema:
     568                $ref: '#/components/schemas/Gauge'
     569            application/geo+json:
     570              examples:
     571                Gauge:
     572                  $ref: '#/components/examples/GaugeGeoJson'
     573              schema:
     574                $ref: '#/components/schemas/GaugeGeoJson'
     575          description: OK
     576        400:
     577          content:
     578            application/json:
     579              examples:
     580                HttpError:
     581                  $ref: '#/components/examples/HttpError'
     582              schema:
     583                $ref: '#/components/schemas/HttpError'
     584          description: Bad Request (400)
     585        404:
     586          content:
     587            application/json:
     588              examples:
     589                HttpError:
     590                  $ref: '#/components/examples/HttpError'
     591              schema:
     592                $ref: '#/components/schemas/HttpError'
     593          description: Water with given Id not found
     594      summary: Represents a gauge
    373595      tags:
    374596      - waters
    … …  
    414636      - waterId: 2
    415637        name: Bodensee
     638    Gauge:
     639      value:
     640        gaugeId: 1
     641        name: New Orleans
     642        manager: jane
     643        location:
     644        - 90.136111
     645        - 29.934722
     646        comment: Gauge for Mississippi in New Orleans
     647    Gauges:
     648      summary: A sample list of gauges
     649      value:
     650      - gaugeId: 1
     651        name: New Orleans
     652        manager: jane
     653        location:
     654        - 90.136111
     655        - 29.934722
     656    GaugeGeoJson:
     657      value:
     658        type: Feature
     659        geometry:
     660          type: Point
     661          coordinates:
     662          - 90.136111
     663          - 29.934722
     664          properties:
     665            name: New Orleans
     666            manager: jane
     667            comment: Gauge for Mississippi in New Orleans
     668    GaugesGeoJson:
     669      summary: A sample list of gauges in GeoJson format
     670      value:
     671      - type: Feature
     672        geometry:
     673          type: Point
     674          coordinates:
     675          - 90.136111
     676          - 29.934722
     677          properties:
     678            name: New Orleans
     679            manager: jane
     680            comment: Gauge for Mississippi in New Orleans
    416681    HttpError:
    417682      value:
    … …  
    440705      style: form
    441706    offset:
    442       description: Skip over a number of elements by specifying an offset value for the query
     707      description: Skip over a number of elements by specifying an offset value for
     708        the query
    443709      explode: true
    444710      in: query
    … …  
    513779      title: Item Name
    514780      type: string
     781    order:
     782      default: asc
     783      description: |
     784        Sort order:
     785          * `asc` - Ascending, from A to Z
     786          * `desc` - Descending, from Z to A
     787      enum:
     788      - desc
     789      - asc
     790      example: asc
     791      title: order
     792      type: string
    515793    osmType:
    516794      enum:
    … …  
    520798      title: OSM type of item (N|W|R)
    521799      type: string
     800    comment:
     801      title: Comment of an item
     802      type: string
     803    point:
     804      items:
     805        type: number
     806      maxItems: 2
     807      minItems: 2
     808      title: Point of type [longitude, latitude]
     809      type: array
     810    geoJsonType:
     811      enum:
     812      - Feature
     813      - Point
     814      title: Type of GeoJSON objects
     815      type: string
     816    geoJsonPoint:
     817      description: GeoJSon geometry
     818      externalDocs:
     819        url: http://geojson.org/geojson-spec.html#id2
     820      properties:
     821        type:
     822          type: string
     823        coordinates:
     824          items:
     825            type: number
     826          maxItems: 2
     827          minItems: 2
     828          title: Point of type [longitude, latitude]
     829          type: array
     830      type: object
    522831    User:
    523832      example:
    … …  
    581890        osmId: 6
    582891        name: name
     892        gauges:
     893        - manager: manager
     894          name: name
     895          location:
     896          - 5.962133916683182
     897          - 5.962133916683182
     898          comment: comment
     899          gaugeId: 1
     900        - manager: manager
     901          name: name
     902          location:
     903          - 5.962133916683182
     904          - 5.962133916683182
     905          comment: comment
     906          gaugeId: 1
    583907        waterId: 0
    584908      properties:
    … …  
    599923        osmType:
    600924          $ref: '#/components/schemas/osmType'
     925        gauges:
     926          items:
     927            $ref: '#/components/schemas/Gauge'
     928          title: Gauges
     929          type: array
    601930      required:
    602931      - name
    … …  
    627956      title: waters
    628957      type: array
    629     order:
    630       default: asc
    631       description: |
    632         Sort order:
    633           * `asc` - Ascending, from A to Z
    634           * `desc` - Descending, from Z to A
    635       enum:
    636       - desc
    637       - asc
    638       example: asc
    639       title: order
    640       type: string
     958    Gauge:
     959      example:
     960        manager: manager
     961        name: name
     962        location:
     963        - 5.962133916683182
     964        - 5.962133916683182
     965        comment: comment
     966        gaugeId: 1
     967      properties:
     968        gaugeId:
     969          format: int32
     970          title: Item ID
     971          type: integer
     972        name:
     973          title: Item Name
     974          type: string
     975        manager:
     976          title: Username
     977          type: string
     978        location:
     979          items:
     980            type: number
     981          maxItems: 2
     982          minItems: 2
     983          title: Point of type [longitude, latitude]
     984          type: array
     985        comment:
     986          title: Comment of an item
     987          type: string
     988      required:
     989      - gaugeId
     990      - location
     991      - name
     992      title: Gauge
     993      type: object
     994    GaugeCreation:
     995      example:
     996        name: name
     997        location:
     998        - 0.8008281904610115
     999        - 0.8008281904610115
     1000        comment: comment
     1001      properties:
     1002        name:
     1003          title: Item Name
     1004          type: string
     1005        location:
     1006          items:
     1007            type: number
     1008          maxItems: 2
     1009          minItems: 2
     1010          title: Point of type [longitude, latitude]
     1011          type: array
     1012        comment:
     1013          title: Comment of an item
     1014          type: string
     1015      required:
     1016      - location
     1017      - name
     1018      title: Gauge for Creation
     1019      type: object
     1020    Gauges:
     1021      items:
     1022        $ref: '#/components/schemas/Gauge'
     1023      title: Gauges
     1024      type: array
     1025    GaugeGeoJson:
     1026      properties:
     1027        type:
     1028          $ref: '#/components/schemas/geoJsonType'
     1029        geometry:
     1030          $ref: '#/components/schemas/geoJsonPoint'
     1031        properties:
     1032          $ref: '#/components/schemas/GaugeGeoJson_properties'
     1033      required:
     1034      - geometry
     1035      - properties
     1036      - type
     1037      title: Gauge
     1038      type: object
     1039    GaugesGeoJson:
     1040      items:
     1041        $ref: '#/components/schemas/GaugeGeoJson'
     1042      title: Gauges in GeoJson format
     1043      type: array
    6411044    HttpError:
    6421045      properties:
    6431046        code:
    644           format: int32
    6451047          type: integer
    6461048        message:
    … …  
    6511053      title: HTTP Error Response Object
    6521054      type: object
     1055    GaugeGeoJson_properties:
     1056      properties:
     1057        name:
     1058          title: Item Name
     1059          type: string
     1060        manager:
     1061          title: Username
     1062          type: string
     1063        comment:
     1064          title: Comment of an item
     1065          type: string
     1066      required:
     1067      - name
    6531068  securitySchemes:
    6541069    basicAuth:
  • src/mapservice/src-gen/openapi_server/test/test_waters_controller.py

    r28198a1 r13cbe66  
    77from six import BytesIO
    88
     9from openapi_server.models.gauge import Gauge  # noqa: E501
     10from openapi_server.models.gauge_creation import GaugeCreation  # noqa: E501
    911from openapi_server.models.http_error import HttpError  # noqa: E501
    1012from openapi_server.models.water import Water  # noqa: E501
    … …  
    1618    """WatersController integration test stubs"""
    1719
    18     def test_water_get_by_id(self):
    19         """Test case for water_get_by_id
    20 
    21         Represents a water
    22         """
    23         headers = {
    24         }
    25         response = self.client.open(
    26             '/mapservice/v1/waters/{id}'.format(id='56'),
    27             method='GET',
    28             headers=headers)
    29         self.assert200(response,
    30                        'Response body is : ' + response.data.decode('utf-8'))
    31 
    3220    def test_waters_create(self):
    3321        """Test case for waters_create
    … …  
    3523        Add a new water
    3624        """
    37         water_creation = WaterCreation()
     25        water_creation = {
     26  "osmId" : 0,
     27  "name" : "name"
     28}
    3829        headers = {
     30            'Accept': 'application/json',
     31            'Content-Type': 'application/json',
    3932            'X-API-KEY': 'test_key',
    40            
     33            'Authorization': 'BasicZm9vOmJhcg==',
    4134        }
    4235        response = self.client.open(
    … …  
    4639            data=json.dumps(water_creation),
    4740            content_type='application/json')
     41        self.assert200(response,
     42                       'Response body is : ' + response.data.decode('utf-8'))
     43
     44    def test_waters_gauge_create(self):
     45        """Test case for waters_gauge_create
     46
     47        Add a new water
     48        """
     49        gauge_creation = {
     50  "name" : "name",
     51  "location" : [ 0.8008281904610115, 0.8008281904610115 ],
     52  "comment" : "comment"
     53}
     54        headers = {
     55            'Accept': 'application/json',
     56            'Content-Type': 'application/json',
     57            'X-API-KEY': 'test_key',
     58            'Authorization': 'BasicZm9vOmJhcg==',
     59        }
     60        response = self.client.open(
     61            '/mapservice/v1/waters/{water_id}/gauges'.format(water_id='56'),
     62            method='POST',
     63            headers=headers,
     64            data=json.dumps(gauge_creation),
     65            content_type='application/json')
     66        self.assert200(response,
     67                       'Response body is : ' + response.data.decode('utf-8'))
     68
     69    def test_waters_gauge_get_by_id(self):
     70        """Test case for waters_gauge_get_by_id
     71
     72        Represents a gauge
     73        """
     74        headers = {
     75            'Accept': 'application/json',
     76        }
     77        response = self.client.open(
     78            '/mapservice/v1/waters/{water_id}/gauges/{gauge_id}'.format(water_id='56', gauge_id='56'),
     79            method='GET',
     80            headers=headers)
     81        self.assert200(response,
     82                       'Response body is : ' + response.data.decode('utf-8'))
     83
     84    def test_waters_gauges_get(self):
     85        """Test case for waters_gauges_get
     86
     87        Find gauges of water waterId by gaugeId
     88        """
     89        query_string = [('name', 'Missi'),
     90                        ('manager', 'jane'),
     91                        ('order_by', 'name'),
     92                        ('offset', '0'),
     93                        ('limit', '10')]
     94        headers = {
     95            'Accept': 'application/json',
     96        }
     97        response = self.client.open(
     98            '/mapservice/v1/waters/{water_id}/gauges'.format(water_id='56'),
     99            method='GET',
     100            headers=headers,
     101            query_string=query_string)
    48102        self.assert200(response,
    49103                       'Response body is : ' + response.data.decode('utf-8'))
    … …  
    60114                        ('limit', '10')]
    61115        headers = {
     116            'Accept': 'application/json',
    62117        }
    63118        response = self.client.open(
    … …  
    69124                       'Response body is : ' + response.data.decode('utf-8'))
    70125
     126    def test_waters_get_by_id(self):
     127        """Test case for waters_get_by_id
     128
     129        Represents a water
     130        """
     131        headers = {
     132            'Accept': 'application/json',
     133        }
     134        response = self.client.open(
     135            '/mapservice/v1/waters/{id}'.format(id='56'),
     136            method='GET',
     137            headers=headers)
     138        self.assert200(response,
     139                       'Response body is : ' + response.data.decode('utf-8'))
     140
    71141
    72142if __name__ == '__main__':
  • src/mapservice/src-gen/requirements.txt

    r28198a1 r13cbe66  
    1 connexion == 2.0.2
     1connexion == 2.2.0
    22swagger-ui-bundle == 0.0.2
    33python_dateutil == 2.6.0
    … …  
    55flask-sqlalchemy
    66flask-cors
     7shapely
Note: See TracChangeset for help on using the changeset viewer.