Skip to content

Commit 5a2826b

Browse files
authored
Merge branch 'development' into corrects-dredd-hooks
2 parents 27d431b + b402a4a commit 5a2826b

38 files changed

+105
-47
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Fixes #
99

1010
- [ ] I have read the [Contribution & Best practices Guide](https://blog.fossasia.org/open-source-developer-guide-and-best-practices-at-fossasia) and my PR follows them.
1111
- [ ] My branch is up-to-date with the Upstream `development` branch.
12-
- [ ] The unit tests pass locally with my changes <!-- use `nosetests tests/unittests` to run all the tests -->
12+
- [ ] The unit tests pass locally with my changes <!-- use `nosetests tests/all` to run all the tests -->
1313
- [ ] I have added tests that prove my fix is effective or that my feature works
1414
- [ ] I have added necessary documentation (if appropriate)
1515
<!-- If an existing function does not have a docstring, please add one -->

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ before_script:
3535
- dredd
3636

3737
script:
38-
- nosetests tests/unittests -v --with-coverage
38+
- nosetests tests/all -v --with-coverage
3939

4040
after_success:
4141
- 'bash <(curl -s https://codecov.io/bash)'

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ export APP_CONFIG=config.TestingConfig
204204

205205
* Then go to the project directory and run the following command:
206206
```
207-
python3 -m unittest discover tests/unittests/
207+
python3 -m unittest discover tests/all/
208208
```
209209
* It will run each test one by one.
210210

211211
* You can also use the following command to run tests using nosetests:
212212
```
213-
nosetests tests/unittests/
213+
nosetests tests/all/
214214
```
215215

216216
#### Running robot framework tests
@@ -252,7 +252,7 @@ This is an Open Source project and we would be happy to see contributors who rep
252252
We have the following branches :
253253
* **development**
254254
All development goes on in this branch. If you're making a contribution, please make a pull request to _development_.
255-
PRs to must pass a build check and a unit-test check on Travis (https://open-event-api.herokuapp.com - Is running off the development branch. It is hosted on Heroku.)
255+
All PRs must pass a build check and a unit-test check on Travis (https://open-event-api.herokuapp.com - Is running off the development branch. It is hosted on Heroku.)
256256
(https://api.eventyay.com - Is running off the `development` branch. Hosted on Google Cloud Platform (Google Container Engine + Kubernetes).)
257257
* **master**
258258
This contains shipped code. After significant features/bug-fixes are accumulated on development, we make a version update and make a release. (https://eventyay.com - Is running off the master branch. (whichever is the latest release.) Hosted on Google Cloud Platform (Google Container Engine + Kubernetes).)
@@ -261,7 +261,7 @@ We have the following branches :
261261

262262
## Release Policy
263263

264-
The tentative release policy, for now, is, (since there is a lot of activity and a lot of bugs), an alpha release every Monday and Friday (since we see more activity on weekends). So, any bug-fixes will not be reflected at eventyay.com until a new release is made in the master branch.
264+
The tentative release policy, for now (since there is a lot of activity and a lot of bugs), is an alpha release every Monday and Friday (since we see more activity on weekends). So, any bug-fixes will not be reflected at eventyay.com until a new release is made in the master branch.
265265

266266
## Contributions Best Practices
267267

app/api/helpers/files.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ def make_frontend_url(path, parameters=None):
251251
Create URL for frontend
252252
"""
253253
settings = get_settings()
254-
frontend_url = urllib.parse.urlparse(settings['frontend_url'] if settings['frontend_url'] else '')
254+
frontend_url = urllib.parse.urlparse(settings.get('frontend_url') or '')
255+
256+
full_path = '/'.join(x.strip('/') for x in (frontend_url.path, str(path)) if x)
255257
return urllib.parse.urlunparse((
256258
frontend_url.scheme,
257259
frontend_url.netloc,
258-
str(path),
260+
full_path,
259261
'',
260262
str(urllib.parse.urlencode(parameters) if parameters else ''),
261263
''

app/api/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from app.api.schema.settings import SettingSchemaAdmin, SettingSchemaNonAdmin, SettingSchemaPublic
88
from app.models import db
99
from app.models.setting import Setting
10+
from app.settings import refresh_settings
1011

1112

1213
class Environment:
@@ -43,3 +44,7 @@ def before_get(self, args, kwargs):
4344
schema = SettingSchemaAdmin
4445
data_layer = {'session': db.session,
4546
'model': Setting}
47+
48+
def after_patch(self, result):
49+
# Update settings cache after PATCH
50+
refresh_settings()

app/settings/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from app.models.setting import Setting, Environment
77

88

9-
def get_settings():
9+
def get_settings(from_db=False):
1010
"""
1111
Use this to get latest system settings
1212
"""
13-
if 'custom_settings' in current_app.config:
13+
if not from_db and 'custom_settings' in current_app.config:
1414
return current_app.config['custom_settings']
1515
s = Setting.query.order_by(desc(Setting.id)).first()
1616
if s is None:
@@ -22,6 +22,11 @@ def get_settings():
2222
return current_app.config['custom_settings']
2323

2424

25+
def refresh_settings():
26+
# Force fetch settings from DB, thus refreshing it
27+
get_settings(from_db=True)
28+
29+
2530
def get_setts():
2631
return Setting.query.order_by(desc(Setting.id)).first()
2732

create_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from app import current_app
88
from app.models import db
99
from populate_db import populate
10-
from tests.unittests.auth_helper import create_super_admin
10+
from tests.all.integration.auth_helper import create_super_admin
1111

1212

1313
def create_default_user(email, password):

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ x-defaults: &defaults
2121
- redis:redis
2222
- elastic:elastic
2323
volumes:
24-
- ./data/web:/open_event/static
24+
- ./static:/data/app/static
2525

2626
services:
2727

manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from flask_migrate import stamp
1111
from sqlalchemy.engine import reflection
1212

13-
from tests.unittests.auth_helper import create_super_admin
13+
from tests.all.integration.auth_helper import create_super_admin
1414

1515

1616
@manager.command
File renamed without changes.

0 commit comments

Comments
 (0)