Skip to content

Commit 5f045e5

Browse files
fred-yu-2013stiartsly
authored andcommitted
CU-3884ybt - fix an issue on travis.
1 parent 12cda45 commit 5f045e5

File tree

7 files changed

+37
-27
lines changed

7 files changed

+37
-27
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: python
22
python:
3-
- "3.9"
3+
- "3.9.12"
44
dist: bionic
55
services:
66
- docker
@@ -12,7 +12,6 @@ before_install:
1212
- docker run -d --name ipfs-node -v ${PWD}/.ipfs-data/ipfs-docker-staging:/export -v ${PWD}/.ipfs-data/ipfs-docker-data:/data/ipfs -p 8080:8080 -p 4001:4001 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest
1313
- cp config/.env.travis .env
1414
- pip install -r requirements.txt
15-
- LD_LIBRARY_PATH="$PWD/src/util/did/" TRAVIS=True python manage.py runserver &
1615
install:
1716
- docker ps
1817
script:
@@ -22,6 +21,7 @@ script:
2221
- pytest --disable-pytest-warnings -xs tests_v1/hive_file_test.py
2322
- pytest --disable-pytest-warnings -xs tests_v1/hive_scripting_test.py
2423

24+
- TRAVIS=True python manage.py runserver &
2525
- ./wait_node.sh
2626
- pytest --disable-pytest-warnings -xs tests/about_test.py
2727
- pytest --disable-pytest-warnings -xs tests/auth_test.py

requirements.txt

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
google-api-python-client
2-
google-auth
3-
google-auth-oauthlib
4-
google-auth-httplib2
5-
pymongo==4.1.1
1+
base58==2.0.1
2+
cffi==1.14.1
3+
click==8.1.2
64
Flask==2.0.3
75
Flask-Script==2.0.5
86
Flask-APScheduler==1.11.0
97
Flask-RESTful==0.3.9
108
Flask-RangeRequest==0.0.2
11-
cffi==1.14.1
12-
base58==2.0.1
9+
Flask-Testing===0.8.1
10+
flask-cors==3.0.10
11+
flask-unittest==0.1.2
12+
Flask-Executor==0.10.0
13+
google-api-python-client
14+
google-auth
15+
google-auth-oauthlib
16+
google-auth-httplib2
17+
pyftpdlib==1.5.6
18+
PyOpenSSL==22.0.0
19+
pysendfile==2.0.1
20+
PyJWT==2.0.0
21+
pymongo==4.1.1
1322
python-decouple==3.3
1423
PyYAML==5.4.1
1524
pytest==6.0.1
1625
requests==2.25.0
1726
sentry-sdk[flask]==0.19.4
18-
pyftpdlib==1.5.6
19-
PyOpenSSL==22.0.0
20-
pysendfile==2.0.1
21-
PyJWT==2.0.0
22-
Flask-Testing===0.8.1
23-
flask-cors==3.0.10
24-
flask-unittest==0.1.2
25-
web3==5.29.0
26-
click==8.1.2
27-
Flask-Executor==0.10.0
27+
web3==5.29.0

run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,6 @@ case "$1" in
229229
stop
230230
;;
231231
*)
232-
echo "Usage: run.sh {docker|direct|test}"
232+
echo "Usage: run.sh {setup|direct|docker|test|test_v1|test_v2|stop}"
233233
exit 1
234234
esac

src/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from src.settings import hive_setting
1414
from src.utils.executor import init_executor, update_vault_databases_usage_task
1515
from src.utils.http_exception import HiveException, InternalServerErrorException, UnauthorizedException
16-
from src.utils.http_request import RegexConverter
16+
from src.utils.http_request import RegexConverter, FileFolderPath
1717
from src.utils.http_response import HiveApi
1818
from src.utils.sentry_error import init_sentry_hook
1919
from src.utils.auth_token import TokenParser
@@ -30,6 +30,7 @@
3030

3131

3232
app = Flask('Hive Node V2')
33+
app.url_map.converters['folder_path'] = FileFolderPath
3334
app.url_map.converters['regex'] = RegexConverter
3435
api = HiveApi(app, prefix='/api/v2')
3536

src/utils/did/did_wrapper.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ def list_dids(self):
382382
"""
383383
dids = []
384384

385-
@ffi.callback("int(struct DID *, void *)")
386-
def did_callback(did, context):
385+
@ffi.def_extern()
386+
def ListDIDsCallback(did, context):
387387
# INFO: contains a terminating signal by a did with None.
388388
if did:
389389
did_str = ffi.new('char[64]')
@@ -394,7 +394,7 @@ def did_callback(did, context):
394394
return 0
395395

396396
filter_has_private_keys = 1
397-
ret_value = lib.DIDStore_ListDIDs(self.store, filter_has_private_keys, did_callback, ffi.NULL)
397+
ret_value = lib.DIDStore_ListDIDs(self.store, filter_has_private_keys, lib.ListDIDsCallback, ffi.NULL)
398398
if ret_value != 0:
399399
raise ElaDIDException(ElaError.get_from_method())
400400

src/utils/http_request.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@
99
from flask import request, g
1010
from werkzeug.routing import BaseConverter
1111

12-
from src.utils.http_exception import InvalidParameterException, NotImplementedException
12+
from src.utils.http_exception import InvalidParameterException
13+
14+
15+
class FileFolderPath(BaseConverter):
16+
""" support read empty folder path, based on PathConverter """
17+
regex = r'[0-9a-zA-Z_/.]*'
18+
weight = 200
19+
part_isolating = False
1320

1421

1522
class RegexConverter(BaseConverter):
16-
""" Support regex on url match """
23+
""" Support regex on url match
24+
@deprecated
25+
"""
1726
def __init__(self, url_map, *items):
1827
super().__init__(url_map)
1928
self.regex = items[0]

src/view/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def init_app(api: Api):
3838
api.add_resource(database.Query, '/vault/db/query', endpoint='database.query')
3939

4040
# files service
41-
api.add_resource(files.ReadingOperation, '/vault/files/<regex("(|[0-9a-zA-Z_/.]*)"):path>', endpoint='files.reading_operation')
41+
api.add_resource(files.ReadingOperation, '/vault/files/<folder_path:path>', endpoint='files.reading_operation')
4242
api.add_resource(files.WritingOperation, '/vault/files/<path:path>', endpoint='files.writing_operation')
4343
api.add_resource(files.MoveFile, '/vault/files/<path:path>', endpoint='files.move_file')
4444
api.add_resource(files.DeleteFile, '/vault/files/<path:path>', endpoint='files.delete_file')

0 commit comments

Comments
 (0)