Changeset 13cbe66 for src/mapservice/src-gen/openapi_server
- Timestamp:
- May 25, 2019, 5:40:08 PM (8 years ago)
- 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)
- Location:
- src/mapservice/src-gen/openapi_server
- Files:
-
- 10 deleted
- 7 edited
-
__main__.py (modified) (3 diffs)
-
controllers/waters_controller.py (modified) (3 diffs)
-
models/__init__.py (modified) (1 diff)
-
models/water.py (modified) (7 diffs)
-
models/water_creation.py (modified) (1 diff)
-
openapi/openapi.yaml (modified) (17 diffs)
-
static/css/GnuBoat.Colors.css (deleted)
-
static/css/GnuBoat.css (deleted)
-
static/css/side-menu.css (deleted)
-
static/index.html (deleted)
-
static/js/GnuBoat.Webserver.js (deleted)
-
static/js/GnuBoat.js (deleted)
-
static/resources/gnuboat-256-256-transparent.png (deleted)
-
static/resources/layers-2x.png (deleted)
-
static/resources/layers.png (deleted)
-
templates/index.html (deleted)
-
test/test_waters_controller.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/mapservice/src-gen/openapi_server/__main__.py
r28198a1 r13cbe66 3 3 import connexion 4 4 from flask_cors import CORS 5 from flask import render_template 5 #from flask import render_template 6 import flask 7 from sqlalchemy import event 6 8 7 9 from openapi_server import encoder 8 10 9 11 from openapi_server.server_impl.database.Model import db, User, ApiKey, db_test_setup 12 13 from openapi_server.server_impl.ValidatorWorkaround import ValidatorWorkaround 10 14 11 15 app = connexion.App(__name__, specification_dir='./openapi/') … … 15 19 @application.before_first_request 16 20 def 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 17 28 db_test_setup() 18 29 … … 23 34 def main(): 24 35 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}) 26 37 application.config.from_object('openapi_server.server_impl.Config.DevelopmentConfig') 27 38 -
src/mapservice/src-gen/openapi_server/controllers/waters_controller.py
r28198a1 r13cbe66 2 2 import six 3 3 4 from openapi_server.models.gauge import Gauge # noqa: E501 5 from openapi_server.models.gauge_creation import GaugeCreation # noqa: E501 4 6 from openapi_server.models.http_error import HttpError # noqa: E501 5 7 from openapi_server.models.water import Water # noqa: E501 6 8 from openapi_server.models.water_creation import WaterCreation # noqa: E501 7 9 from openapi_server import util 8 9 from openapi_server.server_impl.controllers import WatersController10 11 def water_get_by_id(id): # noqa: E50112 """Represents a water13 14 Returns the water identified by id # noqa: E50115 16 :param id: Item ID17 :type id: int18 19 :rtype: Water20 """21 return WatersController.water_get_by_id(id)22 10 23 11 from openapi_server.server_impl.controllers import WatersController … … 36 24 water_creation = WaterCreation.from_dict(connexion.request.get_json()) # noqa: E501 37 25 return WatersController.waters_create(water_creation=water_creation) 26 27 from openapi_server.server_impl.controllers import WatersController 28 29 def 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 45 from openapi_server.server_impl.controllers import WatersController 46 47 def 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 61 from openapi_server.server_impl.controllers import WatersController 62 63 def 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) 38 84 39 85 from openapi_server.server_impl.controllers import WatersController … … 58 104 """ 59 105 return WatersController.waters_get(name=name, manager=manager, order_by=order_by, offset=offset, limit=limit) 106 107 from openapi_server.server_impl.controllers import WatersController 108 109 def 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 4 4 from __future__ import absolute_import 5 5 # import models into model package 6 from openapi_server.models.gauge import Gauge 7 from openapi_server.models.gauge_creation import GaugeCreation 8 from openapi_server.models.gauge_geo_json import GaugeGeoJson 9 from openapi_server.models.gauge_geo_json_properties import GaugeGeoJsonProperties 10 from openapi_server.models.geo_json_point import GeoJsonPoint 11 from openapi_server.models.geo_json_type import GeoJsonType 6 12 from openapi_server.models.http_error import HttpError 7 13 from openapi_server.models.order import Order -
src/mapservice/src-gen/openapi_server/models/water.py
r28198a1 r13cbe66 7 7 8 8 from openapi_server.models.base_model_ import Model 9 from openapi_server.models.gauge import Gauge 10 from openapi_server.models.osm_type import OsmType 9 11 from openapi_server import util 10 12 13 from openapi_server.models.gauge import Gauge # noqa: E501 11 14 from openapi_server.models.osm_type import OsmType # noqa: E501 12 15 … … 17 20 """ 18 21 19 def __init__(self, water_id=None, name=None, manager=None, osm_id=None, osm_type=None ): # noqa: E50122 def __init__(self, water_id=None, name=None, manager=None, osm_id=None, osm_type=None, gauges=None): # noqa: E501 20 23 """Water - a model defined in OpenAPI 21 24 … … 30 33 :param osm_type: The osm_type of this Water. # noqa: E501 31 34 :type osm_type: OsmType 35 :param gauges: The gauges of this Water. # noqa: E501 36 :type gauges: List[Gauge] 32 37 """ 33 38 self.openapi_types = { … … 36 41 'manager': str, 37 42 'osm_id': int, 38 'osm_type': OsmType 43 'osm_type': OsmType, 44 'gauges': List[Gauge] 39 45 } 40 46 … … 44 50 'manager': 'manager', 45 51 'osm_id': 'osmId', 46 'osm_type': 'osmType' 52 'osm_type': 'osmType', 53 'gauges': 'gauges' 47 54 } 48 55 … … 52 59 self._osm_id = osm_id 53 60 self._osm_type = osm_type 61 self._gauges = gauges 54 62 55 63 @classmethod … … 172 180 173 181 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 7 7 8 8 from openapi_server.models.base_model_ import Model 9 from openapi_server.models.osm_type import OsmType 9 10 from openapi_server import util 10 11 -
src/mapservice/src-gen/openapi_server/openapi/openapi.yaml
r28198a1 r13cbe66 23 23 default: v1 24 24 tags: 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) 26 27 name: waters 27 28 - description: All actions used to manage users and api keys … … 30 31 /user: 31 32 get: 32 description: Returns information for auser33 description: Returns information of current/authorized user 33 34 operationId: users_get 34 35 responses: … … 112 113 - users 113 114 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 114 143 /user/apikey_create: 115 144 get: … … 144 173 security: 145 174 - basicAuth: [] 146 - apiKeyAuth: []147 175 summary: Returns a new API key 148 176 tags: … … 189 217 $ref: '#/components/schemas/HttpError' 190 218 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 191 228 security: 192 229 - basicAuth: [] 193 - apiKeyAuth: []194 230 summary: Deletes API key 195 tags:196 - users197 x-openapi-router-controller: openapi_server.controllers.users_controller198 /user/activate/{activation_code}:199 get:200 description: Activates a user account201 operationId: users_activate202 parameters:203 - description: Activation code204 example: dac9630aec642a428cd73f4be0a03569205 explode: false206 in: path207 name: activation_code208 required: true209 schema:210 $ref: '#/components/schemas/activationCode'211 style: simple212 responses:213 302:214 description: OK or not OK215 headers:216 Location:217 description: URL to the website, showing the result of the activation218 explode: false219 schema:220 type: string221 style: simple222 summary: Activates a user account223 231 tags: 224 232 - users … … 255 263 type: string 256 264 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 258 267 explode: true 259 268 in: query … … 287 296 $ref: '#/components/schemas/waters' 288 297 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 289 307 summary: Find waters by id 290 308 tags: … … 341 359 get: 342 360 description: Returns the water identified by id 343 operationId: water _get_by_id361 operationId: waters_get_by_id 344 362 parameters: 345 363 - description: Item ID … … 371 389 description: Water with given Id not found 372 390 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 373 595 tags: 374 596 - waters … … 414 636 - waterId: 2 415 637 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 416 681 HttpError: 417 682 value: … … 440 705 style: form 441 706 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 443 709 explode: true 444 710 in: query … … 513 779 title: Item Name 514 780 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 515 793 osmType: 516 794 enum: … … 520 798 title: OSM type of item (N|W|R) 521 799 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 522 831 User: 523 832 example: … … 581 890 osmId: 6 582 891 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 583 907 waterId: 0 584 908 properties: … … 599 923 osmType: 600 924 $ref: '#/components/schemas/osmType' 925 gauges: 926 items: 927 $ref: '#/components/schemas/Gauge' 928 title: Gauges 929 type: array 601 930 required: 602 931 - name … … 627 956 title: waters 628 957 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 641 1044 HttpError: 642 1045 properties: 643 1046 code: 644 format: int32645 1047 type: integer 646 1048 message: … … 651 1053 title: HTTP Error Response Object 652 1054 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 653 1068 securitySchemes: 654 1069 basicAuth: -
src/mapservice/src-gen/openapi_server/test/test_waters_controller.py
r28198a1 r13cbe66 7 7 from six import BytesIO 8 8 9 from openapi_server.models.gauge import Gauge # noqa: E501 10 from openapi_server.models.gauge_creation import GaugeCreation # noqa: E501 9 11 from openapi_server.models.http_error import HttpError # noqa: E501 10 12 from openapi_server.models.water import Water # noqa: E501 … … 16 18 """WatersController integration test stubs""" 17 19 18 def test_water_get_by_id(self):19 """Test case for water_get_by_id20 21 Represents a water22 """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 32 20 def test_waters_create(self): 33 21 """Test case for waters_create … … 35 23 Add a new water 36 24 """ 37 water_creation = WaterCreation() 25 water_creation = { 26 "osmId" : 0, 27 "name" : "name" 28 } 38 29 headers = { 30 'Accept': 'application/json', 31 'Content-Type': 'application/json', 39 32 'X-API-KEY': 'test_key', 40 33 'Authorization': 'BasicZm9vOmJhcg==', 41 34 } 42 35 response = self.client.open( … … 46 39 data=json.dumps(water_creation), 47 40 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) 48 102 self.assert200(response, 49 103 'Response body is : ' + response.data.decode('utf-8')) … … 60 114 ('limit', '10')] 61 115 headers = { 116 'Accept': 'application/json', 62 117 } 63 118 response = self.client.open( … … 69 124 'Response body is : ' + response.data.decode('utf-8')) 70 125 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 71 141 72 142 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.
