fix some tests
This commit is contained in:
		
							
								
								
									
										11
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Makefile
									
									
									
									
									
								
							@@ -42,6 +42,9 @@ clean-install: clean
 | 
				
			|||||||
	rm -rf dist/
 | 
						rm -rf dist/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Docker commands for evaluation purposes
 | 
					## 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-build:
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml build fittrackee
 | 
						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-build-client:
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml build fittrackee_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: docker-run docker-init-db docker-restart docker-run-workers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
docker-init-db:
 | 
					docker-init-db:
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml exec fittrackee docker/init-database.sh
 | 
						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-lint-client:
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml up -d fittrackee_client
 | 
						docker-compose -f docker-compose-dev.yml up -d fittrackee_client
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn lint
 | 
						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-test-python: docker-run
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-python.sh $(PYTEST_ARGS)
 | 
						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-up:
 | 
				
			||||||
	docker-compose -f docker-compose-dev.yml up fittrackee
 | 
						docker-compose -f docker-compose-dev.yml up fittrackee
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,6 +32,8 @@ export DOCKER_APP_DIR = /usr/src/app
 | 
				
			|||||||
export DOCKER_MIGRATIONS = $(DOCKER_APP_DIR)/fittrackee/migrations
 | 
					export DOCKER_MIGRATIONS = $(DOCKER_APP_DIR)/fittrackee/migrations
 | 
				
			||||||
export DOCKER_FLASK = /usr/local/bin/flask
 | 
					export DOCKER_FLASK = /usr/local/bin/flask
 | 
				
			||||||
export DOCKER_FTCLI = /usr/local/bin/ftcli
 | 
					export DOCKER_FTCLI = /usr/local/bin/ftcli
 | 
				
			||||||
 | 
					export DOCKER_BANDIT = /usr/local/bin/bandit
 | 
				
			||||||
 | 
					export DOCKER_MYPY = /usr/local/bin/mypy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Node env
 | 
					# Node env
 | 
				
			||||||
NODE_MODULES = $(PWD)/fittrackee_client/node_modules
 | 
					NODE_MODULES = $(PWD)/fittrackee_client/node_modules
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1394,6 +1394,7 @@ class TestUserPreferencesUpdate(ApiTestCaseMixin):
 | 
				
			|||||||
                    language=input_language,
 | 
					                    language=input_language,
 | 
				
			||||||
                    imperial_units=True,
 | 
					                    imperial_units=True,
 | 
				
			||||||
                    display_ascent=False,
 | 
					                    display_ascent=False,
 | 
				
			||||||
 | 
					                    date_format='yyyy-MM-dd'
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            headers=dict(Authorization=f'Bearer {auth_token}'),
 | 
					            headers=dict(Authorization=f'Bearer {auth_token}'),
 | 
				
			||||||
@@ -1407,6 +1408,7 @@ class TestUserPreferencesUpdate(ApiTestCaseMixin):
 | 
				
			|||||||
        assert data['data']['imperial_units'] is True
 | 
					        assert data['data']['imperial_units'] is True
 | 
				
			||||||
        assert data['data']['language'] == expected_language
 | 
					        assert data['data']['language'] == expected_language
 | 
				
			||||||
        assert data['data']['timezone'] == 'America/New_York'
 | 
					        assert data['data']['timezone'] == 'America/New_York'
 | 
				
			||||||
 | 
					        assert data['data']['date_format'] == 'yyyy-MM-dd'
 | 
				
			||||||
        assert data['data']['weekm'] is True
 | 
					        assert data['data']['weekm'] is True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @pytest.mark.parametrize(
 | 
					    @pytest.mark.parametrize(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 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 boolean imperial_units: display distance in imperial units
 | 
				
			||||||
    :<json string language: language preferences
 | 
					    :<json string language: language preferences
 | 
				
			||||||
    :<json string timezone: user time zone
 | 
					    :<json string timezone: user time zone
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ describe('formatRecord', () => {
 | 
				
			|||||||
          workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
 | 
					          workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        timezone: 'Europe/Paris',
 | 
					        timezone: 'Europe/Paris',
 | 
				
			||||||
        date_format: 'dd/MM/yyyy'
 | 
					        date_format: 'yyyy/dd/MM'
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      expected: {
 | 
					      expected: {
 | 
				
			||||||
        id: 9,
 | 
					        id: 9,
 | 
				
			||||||
@@ -181,7 +181,7 @@ describe('formatRecord after conversion', () => {
 | 
				
			|||||||
        id: 10,
 | 
					        id: 10,
 | 
				
			||||||
        record_type: 'FD',
 | 
					        record_type: 'FD',
 | 
				
			||||||
        value: '11.185 mi',
 | 
					        value: '11.185 mi',
 | 
				
			||||||
        workout_date: '2019/07/08',
 | 
					        workout_date: '2019/08/07',
 | 
				
			||||||
        workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
 | 
					        workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -227,7 +227,7 @@ describe('formatRecord after conversion', () => {
 | 
				
			|||||||
        id: 12,
 | 
					        id: 12,
 | 
				
			||||||
        record_type: 'MS',
 | 
					        record_type: 'MS',
 | 
				
			||||||
        value: '11.18 mi/h',
 | 
					        value: '11.18 mi/h',
 | 
				
			||||||
        workout_date: '2019/07/08',
 | 
					        workout_date: '2019/08/07',
 | 
				
			||||||
        workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
 | 
					        workout_id: 'hvYBqYBRa7wwXpaStWR4V2',
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -401,7 +401,7 @@ describe('getRecordsBySports', () => {
 | 
				
			|||||||
              id: 10,
 | 
					              id: 10,
 | 
				
			||||||
              record_type: 'FD',
 | 
					              record_type: 'FD',
 | 
				
			||||||
              value: '18 km',
 | 
					              value: '18 km',
 | 
				
			||||||
              workout_date: '2019/07/08',
 | 
					              workout_date: '2019/08/07',
 | 
				
			||||||
              workout_id: 'n6JcLPQt3QtZWFfiSnYm4C',
 | 
					              workout_id: 'n6JcLPQt3QtZWFfiSnYm4C',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
          ],
 | 
					          ],
 | 
				
			||||||
@@ -536,7 +536,7 @@ describe('getRecordsBySports after conversion', () => {
 | 
				
			|||||||
              id: 10,
 | 
					              id: 10,
 | 
				
			||||||
              record_type: 'FD',
 | 
					              record_type: 'FD',
 | 
				
			||||||
              value: '11.185 mi',
 | 
					              value: '11.185 mi',
 | 
				
			||||||
              workout_date: '2019/07/08',
 | 
					              workout_date: '2019/08/07',
 | 
				
			||||||
              workout_id: 'n6JcLPQt3QtZWFfiSnYm4C',
 | 
					              workout_id: 'n6JcLPQt3QtZWFfiSnYm4C',
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
          ],
 | 
					          ],
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user