Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
communications-backbone
Commits
3b0ed55a
Verified
Commit
3b0ed55a
authored
6 months ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
fix: fixup refactored api after rebase
parent
e2e861ee
Pipeline
#262151
failed with stages
in 36 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
27 deletions
+30
-27
api_rest.py
api_rest.py
+22
-19
api_wrap_socket.py
api_wrap_socket.py
+3
-2
tests/api_client_test.py
tests/api_client_test.py
+1
-1
tests/api_notify_test.py
tests/api_notify_test.py
+1
-1
tests/api_receive_test.py
tests/api_receive_test.py
+1
-1
tests/api_send_test.py
tests/api_send_test.py
+1
-1
tests/api_token_test.py
tests/api_token_test.py
+1
-1
tests/models/client_model_test.py
tests/models/client_model_test.py
+0
-1
No files found.
api_rest.py
View file @
3b0ed55a
...
...
@@ -30,31 +30,34 @@ def get_config():
return
config
def
create_app
():
app
=
Flask
(
__name__
)
api
=
Api
(
app
)
api_config
=
get_config
()
logging
.
debug
(
str
(
api_config
))
CORS
(
app
,
resources
=
api_config
[
"cors"
])
api
.
add_resource
(
ClientList
,
"/client"
)
api
.
add_resource
(
Client
,
"/client/<client_id>"
)
api
.
add_resource
(
Receive
,
"/receive"
)
api
.
add_resource
(
Send
,
"/send"
)
api
.
add_resource
(
Notify
,
"/notify"
)
api
.
add_resource
(
Token
,
"/token"
)
api
.
add_resource
(
QueueList
,
"/queue"
)
api
.
add_resource
(
Queue
,
"/queue/<queue_name>"
)
return
app
def
run
():
token
=
TokenModel
()
token
.
setSecret
()
app
=
create_app
()
flask_host
=
os
.
getenv
(
"FLASK_HOST"
,
"localhost"
)
# Sets to whatever MQ_HOST is, or defaults to localhost
app
.
run
(
debug
=
True
,
port
=
8087
,
host
=
flask_host
)
token
=
TokenModel
()
token
.
setSecret
()
app
=
Flask
(
__name__
)
api
=
Api
(
app
)
api_config
=
get_config
()
logging
.
debug
(
str
(
api_config
))
CORS
(
app
,
resources
=
api_config
[
"cors"
])
api
.
add_resource
(
ClientList
,
"/client"
)
api
.
add_resource
(
Client
,
"/client/<client_id>"
)
api
.
add_resource
(
Receive
,
"/receive"
)
api
.
add_resource
(
Send
,
"/send"
)
api
.
add_resource
(
Notify
,
"/notify"
)
api
.
add_resource
(
Token
,
"/token"
)
api
.
add_resource
(
QueueList
,
"/queue"
)
api
.
add_resource
(
Queue
,
"/queue/<queue_name>"
)
if
__name__
==
"__main__"
:
run
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
api_wrap_socket.py
View file @
3b0ed55a
...
...
@@ -31,7 +31,7 @@ from autobahn.twisted.resource import WebSocketResource
from
autobahn.twisted.websocket
import
WebSocketServerFactory
,
WebSocketServerProtocol
,
listenWS
from
models.client_model
import
ClientModel
from
models.token_model
import
TokenModel
from
api_rest
import
app
from
api_rest
import
create_
app
from
rmq
import
write_to_queue
,
listen
,
stop_listening
SUBSCRIPTIONS
=
{}
...
...
@@ -192,7 +192,8 @@ def run():
factory
.
protocol
=
SubscriptionServerProtocol
socket_resource
=
WebSocketResource
(
factory
)
app
=
create_app
()
flask_resource
=
WSGIResource
(
reactor
,
reactor
.
getThreadPool
(),
app
)
# Create the flask resource and socket resource
...
...
This diff is collapsed.
Click to expand it.
tests/api_client_test.py
View file @
3b0ed55a
...
...
@@ -3,7 +3,7 @@ import json
import
pytest
from
unittest.mock
import
patch
,
mock_open
,
call
from
werkzeug.exceptions
import
HTTPException
from
api
import
create_app
from
api
_rest
import
create_app
@
pytest
.
mark
.
usefixtures
(
"mock_clients"
)
...
...
This diff is collapsed.
Click to expand it.
tests/api_notify_test.py
View file @
3b0ed55a
...
...
@@ -3,7 +3,7 @@ import json
import
pytest
from
unittest.mock
import
patch
,
mock_open
,
call
from
werkzeug.exceptions
import
HTTPException
from
api
import
create_app
from
api
_rest
import
create_app
from
endpoints
import
notify
from
conftest
import
get_auth_header
...
...
This diff is collapsed.
Click to expand it.
tests/api_receive_test.py
View file @
3b0ed55a
...
...
@@ -3,7 +3,7 @@ import json
import
pytest
from
unittest.mock
import
patch
,
mock_open
,
call
from
werkzeug.exceptions
import
HTTPException
from
api
import
create_app
from
api
_rest
import
create_app
from
endpoints
import
receive
from
conftest
import
get_auth_header
...
...
This diff is collapsed.
Click to expand it.
tests/api_send_test.py
View file @
3b0ed55a
...
...
@@ -3,7 +3,7 @@ import json
import
pytest
from
unittest.mock
import
patch
,
mock_open
,
call
from
werkzeug.exceptions
import
HTTPException
from
api
import
create_app
from
api
_rest
import
create_app
from
endpoints
import
send
from
conftest
import
get_auth_header
...
...
This diff is collapsed.
Click to expand it.
tests/api_token_test.py
View file @
3b0ed55a
...
...
@@ -3,7 +3,7 @@ import json
import
pytest
from
unittest.mock
import
patch
,
mock_open
,
call
from
werkzeug.exceptions
import
HTTPException
from
api
import
create_app
from
api
_rest
import
create_app
@
pytest
.
mark
.
usefixtures
(
"mock_clients"
,
"mock_client_credentials"
)
...
...
This diff is collapsed.
Click to expand it.
tests/models/client_model_test.py
View file @
3b0ed55a
import
json
import
os
import
pytest
import
re
from
unittest.mock
import
patch
,
mock_open
,
call
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment