Browse Source

Better naming and datetime for fake_api example

Guénaël Muller 6 years ago
parent
commit
f92d641ab1

+ 3 - 3
example/fake_api/bottle_api.py View File

@@ -14,7 +14,7 @@ class NoContentException(Exception):
14 14
     pass
15 15
 
16 16
 
17
-class Controllers(object):
17
+class BottleController(object):
18 18
     @hapic.with_api_doc()
19 19
     @hapic.output_body(AboutResponseSchema())
20 20
     def about(self):
@@ -23,7 +23,7 @@ class Controllers(object):
23 23
         """
24 24
         return {
25 25
             'version': '1.2.3',
26
-            'datetime': datetime.now(),
26
+            'datetime': datetime(2017, 12, 7, 10, 55, 8, 488996),
27 27
         }
28 28
 
29 29
     @hapic.with_api_doc()
@@ -109,7 +109,7 @@ class Controllers(object):
109 109
 
110 110
 if __name__ == "__main__":
111 111
     app = bottle.Bottle()
112
-    controllers = Controllers()
112
+    controllers = BottleController()
113 113
     controllers.bind(app)
114 114
     hapic.set_context(hapic.ext.bottle.BottleContext(app))
115 115
     time.sleep(1)

+ 3 - 3
example/fake_api/flask_api.py View File

@@ -14,7 +14,7 @@ class NoContentException(Exception):
14 14
     pass
15 15
 
16 16
 
17
-class Controllers(object):
17
+class FlaskController(object):
18 18
     @hapic.with_api_doc()
19 19
     @hapic.output_body(AboutResponseSchema())
20 20
     def about(self):
@@ -23,7 +23,7 @@ class Controllers(object):
23 23
         """
24 24
         return {
25 25
             'version': '1.2.3',
26
-            'datetime': datetime.now(),
26
+            'datetime': datetime(2017, 12, 7, 10, 55, 8, 488996),
27 27
         }
28 28
 
29 29
     @hapic.with_api_doc()
@@ -116,7 +116,7 @@ class Controllers(object):
116 116
 
117 117
 if __name__ == "__main__":
118 118
     app = flask.Flask(__name__)
119
-    controllers = Controllers()
119
+    controllers = FlaskController()
120 120
     controllers.bind(app)
121 121
     hapic.set_context(hapic.ext.flask.FlaskContext(app))
122 122
     time.sleep(1)

+ 3 - 3
example/fake_api/pyramid_api.py View File

@@ -15,7 +15,7 @@ class NoContentException(Exception):
15 15
     pass
16 16
 
17 17
 
18
-class Controllers(object):
18
+class PyramidController(object):
19 19
     @hapic.with_api_doc()
20 20
     @hapic.output_body(AboutResponseSchema())
21 21
     def about(self, context, request):
@@ -24,7 +24,7 @@ class Controllers(object):
24 24
         """
25 25
         return {
26 26
             'version': '1.2.3',
27
-            'datetime': datetime.now(),
27
+            'datetime': datetime(2017, 12, 7, 10, 55, 8, 488996),
28 28
         }
29 29
 
30 30
     @hapic.with_api_doc()
@@ -119,7 +119,7 @@ class Controllers(object):
119 119
 
120 120
 if __name__ == "__main__":
121 121
     configurator = Configurator(autocommit=True)
122
-    controllers = Controllers()
122
+    controllers = PyramidController()
123 123
     controllers.bind(configurator)
124 124
     hapic.set_context(hapic.ext.pyramid.PyramidContext(configurator))
125 125
     time.sleep(1)