diff --git a/V2/Makefile b/V2/Makefile index 11fadf6c..cf02904b 100644 --- a/V2/Makefile +++ b/V2/Makefile @@ -1,11 +1,11 @@ .PHONY: help help: @echo "---------------HELP-----------------" - @echo "To install the dependencies type make install" - @echo "To test the project type make test" - @echo "To test a specific test of the project make test specific_test=name of test" - @echo "To run the local database type make start-local" - @echo "To run all comands type make ci" + @echo "- make install --> Install the dependencies" + @echo "- make test --> Run all tests" + @echo "- make test specific_test= --> Run specific test" + @echo "- make start-local --> Run local database" + @echo "- make ci --> Install the dependencies and run all tests" @echo "------------------------------------" .PHONY: install @@ -18,14 +18,13 @@ install: .PHONY: test test: export ENVIRONMENT = test -test: export TEST_DB_CONNECTION = sqlite:///file:memory?mode=memory&cache=shared&uri=true test: @echo "=========================================Lint with flake8=========================================" flake8 . --show-source --statistics @echo "Completed flake8!" @echo "=========================================Test with pytest=========================================" @if [ "$(specific_test)" ]; then \ - python -m pytest -v -k $(specific_test);\ + python -m pytest -vv -s -k $(specific_test);\ else \ python -m pytest -v;\ fi diff --git a/V2/time_tracker/time_entries/_application/_time_entries/_create_time_entry.py b/V2/time_tracker/time_entries/_application/_time_entries/_create_time_entry.py index ee2b4f2f..95149c55 100644 --- a/V2/time_tracker/time_entries/_application/_time_entries/_create_time_entry.py +++ b/V2/time_tracker/time_entries/_application/_time_entries/_create_time_entry.py @@ -54,9 +54,8 @@ def create_time_entry(req: func.HttpRequest) -> func.HttpResponse: def _validate_time_entry(time_entry_data: dict) -> typing.List[str]: - time_entry_fields = [field.name for field in dataclasses.fields(_domain.TimeEntry)] - time_entry_fields.pop(8) - time_entry_fields.pop(0) + time_entry_fields = [field.name for field in dataclasses.fields(_domain.TimeEntry) + if field.type != typing.Optional[field.type]] missing_keys = [field for field in time_entry_fields if field not in time_entry_data] return [ f'The {missing_key} key is missing in the input data' diff --git a/V2/time_tracker/time_entries/_domain/_entities/_time_entry.py b/V2/time_tracker/time_entries/_domain/_entities/_time_entry.py index aa73a879..08df5f8f 100644 --- a/V2/time_tracker/time_entries/_domain/_entities/_time_entry.py +++ b/V2/time_tracker/time_entries/_domain/_entities/_time_entry.py @@ -1,10 +1,10 @@ from dataclasses import dataclass -from typing import List +from typing import List, Optional @dataclass(frozen=True) class TimeEntry: - id: int + id: Optional[int] start_date: str owner_id: int description: str @@ -12,6 +12,6 @@ class TimeEntry: uri: str technologies: List[str] end_date: str - deleted: bool + deleted: Optional[bool] timezone_offset: str project_id: int