fix some tests

This commit is contained in:
Joshua Taillon 2022-10-25 17:38:55 -06:00 committed by Sam
parent b2509ff1c6
commit d36a1f0ac0
5 changed files with 21 additions and 6 deletions

View File

@ -42,6 +42,9 @@ clean-install: clean
rm -rf dist/
## Docker commands for evaluation purposes
docker-bandit:
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_BANDIT) -r fittrackee -c pyproject.toml
docker-build:
docker-compose -f docker-compose-dev.yml build fittrackee
@ -50,11 +53,15 @@ docker-build-all: docker-build docker-build-client
docker-build-client:
docker-compose -f docker-compose-dev.yml build fittrackee_client
docker-check-all: docker-bandit docker-lint-all docker-type-check docker-test-client docker-test-python
docker-init: docker-run docker-init-db docker-restart docker-run-workers
docker-init-db:
docker-compose -f docker-compose-dev.yml exec fittrackee docker/init-database.sh
docker-lint-all: docker-lint-client docker-lint-python
docker-lint-client:
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn lint
@ -110,6 +117,10 @@ docker-test-e2e: docker-run
docker-test-python: docker-run
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-python.sh $(PYTEST_ARGS)
docker-type-check:
echo 'Running mypy in docker...'
docker-compose -f docker-compose-dev.yml exec fittrackee $(DOCKER_MYPY) fittrackee
docker-up:
docker-compose -f docker-compose-dev.yml up fittrackee

View File

@ -32,6 +32,8 @@ export DOCKER_APP_DIR = /usr/src/app
export DOCKER_MIGRATIONS = $(DOCKER_APP_DIR)/fittrackee/migrations
export DOCKER_FLASK = /usr/local/bin/flask
export DOCKER_FTCLI = /usr/local/bin/ftcli
export DOCKER_BANDIT = /usr/local/bin/bandit
export DOCKER_MYPY = /usr/local/bin/mypy
# Node env
NODE_MODULES = $(PWD)/fittrackee_client/node_modules

View File

@ -1394,6 +1394,7 @@ class TestUserPreferencesUpdate(ApiTestCaseMixin):
language=input_language,
imperial_units=True,
display_ascent=False,
date_format='yyyy-MM-dd'
)
),
headers=dict(Authorization=f'Bearer {auth_token}'),
@ -1407,6 +1408,7 @@ class TestUserPreferencesUpdate(ApiTestCaseMixin):
assert data['data']['imperial_units'] is True
assert data['data']['language'] == expected_language
assert data['data']['timezone'] == 'America/New_York'
assert data['data']['date_format'] == 'yyyy-MM-dd'
assert data['data']['weekm'] is True
@pytest.mark.parametrize(

View File

@ -856,7 +856,7 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
}
:<json boolean display_ascent: display highest ascent records and total
:<json string date_format: the format used to format dates throughout the interface
:<json string date_format: the format used to display dates in the app
:<json boolean imperial_units: display distance in imperial units
:<json string language: language preferences
:<json string timezone: user time zone

View File

@ -19,7 +19,7 @@ describe('formatRecord', () => {
workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
},
timezone: 'Europe/Paris',
date_format: 'dd/MM/yyyy'
date_format: 'yyyy/dd/MM'
},
expected: {
id: 9,
@ -181,7 +181,7 @@ describe('formatRecord after conversion', () => {
id: 10,
record_type: 'FD',
value: '11.185 mi',
workout_date: '2019/07/08',
workout_date: '2019/08/07',
workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
},
},
@ -227,7 +227,7 @@ describe('formatRecord after conversion', () => {
id: 12,
record_type: 'MS',
value: '11.18 mi/h',
workout_date: '2019/07/08',
workout_date: '2019/08/07',
workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
},
},
@ -401,7 +401,7 @@ describe('getRecordsBySports', () => {
id: 10,
record_type: 'FD',
value: '18 km',
workout_date: '2019/07/08',
workout_date: '2019/08/07',
workout_id: 'n6JcLPQt3QtZWFfiSnYm4C',
},
],
@ -536,7 +536,7 @@ describe('getRecordsBySports after conversion', () => {
id: 10,
record_type: 'FD',
value: '11.185 mi',
workout_date: '2019/07/08',
workout_date: '2019/08/07',
workout_id: 'n6JcLPQt3QtZWFfiSnYm4C',
},
],