Skip to content

Commit 39d2b24

Browse files
committed
feat: TT-401 validated request create time entry
1 parent 4676dc4 commit 39d2b24

File tree

4 files changed

+15
-105
lines changed

4 files changed

+15
-105
lines changed

V2/tests/fixtures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
@pytest.fixture(name='activity_factory')
1111
def _activity_factory() -> activities_domain.Activity:
1212
def _make_activity(
13-
name: str = Faker().name(), description: str = Faker().sentence(), deleted: bool = False, status: int = 1
13+
name: str = Faker().name(),
14+
description: str = Faker().sentence(),
15+
deleted: bool = False,
16+
status: int = 1,
1417
):
1518
activity = activities_domain.Activity(
1619
id=None,
@@ -20,6 +23,7 @@ def _make_activity(
2023
status=status
2124
)
2225
return activity
26+
2327
return _make_activity
2428

2529

V2/tests/integration/daos/time_entries_dao.test.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,17 @@ def test_create_time_entry__returns_an_time_entry_dto__when_create_an_time_entry
2525

2626
time_entries_json_dao = TimeEntriesJsonDao(Faker().file_path())
2727
time_entry_data = {
28-
"id" : None,
29-
"start_date" : Faker().date(),
30-
"owner_id" : Faker().random_int(),
28+
"id": None,
29+
"start_date": Faker().date(),
30+
"owner_id": Faker().random_int(),
3131
"description": Faker().sentence(),
32-
"activity_id" : Faker().random_int(),
33-
"uri": "http://hola.com",
34-
"technologies" : ["jira","git"],
32+
"activity_id": Faker().random_int(),
33+
"uri": "http://timetracker.com",
34+
"technologies": ["jira", "git"],
3535
"end_date": Faker().date(),
36-
"deleted": Faker().random_int(),
37-
"timezone_offset": "UTC-5",
36+
"deleted": False,
37+
"timezone_offset": "300",
3838
"project_id": Faker().random_int(),
3939
}
4040
result = time_entries_json_dao.create(time_entry_data)
4141
assert result == TimeEntry(**time_entry_data)
42-
43-
44-
45-

V2/time_tracker/time_entries/_application/_time_entries/_create_time_entry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from time_tracker._infrastructure import DB
1010

1111

12+
1213
def create_time_entry(req: func.HttpRequest) -> func.HttpResponse:
1314
database = DB()
1415
time_entry_dao = _infrastructure.TimeEntriesSQLDao(database)
Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1 @@
1-
[{
2-
"id": null,
3-
"start_date": "12/07/2021",
4-
"owner_id": 2,
5-
"tenant_id": "asdasdsa",
6-
"description": "No se que poner jajaj ",
7-
"activity_id": 2,
8-
"uri": "http://hola.que.hace.com",
9-
"technologies": ["git", "jira", "python"],
10-
"end_date": "12/07/2021",
11-
"deleted": "asdasdsaadssa",
12-
"timezone_offset": "asdasdsa",
13-
"project_id": 1
14-
}, {
15-
"id": null,
16-
"start_date": "12/07/2021",
17-
"owner_id": 2,
18-
"tenant_id": "asdasdsa",
19-
"description": "No se que poner jajaj ",
20-
"activity_id": 2,
21-
"uri": "http://hola.que.hace.com",
22-
"technologies": ["git", "jira", "python"],
23-
"end_date": "12/07/2021",
24-
"deleted": "asdasdsaadssa",
25-
"timezone_offset": "asdasdsa",
26-
"project_id": 1
27-
}, {
28-
"id": null,
29-
"start_date": "12/07/2021",
30-
"owner_id": 2,
31-
"tenant_id": "asdasdsa",
32-
"description": "No se que poner jajaj ",
33-
"activity_id": 2,
34-
"uri": "http://hola.que.hace.com",
35-
"technologies": ["git", "jira", "python"],
36-
"end_date": "12/07/2021",
37-
"deleted": "asdasdsaadssa",
38-
"timezone_offset": "asdasdsa",
39-
"project_id": 1
40-
}, {
41-
"id": null,
42-
"start_date": "12/07/2021",
43-
"owner_id": 2,
44-
"tenant_id": "asdasdsa",
45-
"description": "No se que poner jajaj ",
46-
"activity_id": 2,
47-
"uri": "http://hola.que.hace.com",
48-
"technologies": ["git", "jira", "python"],
49-
"end_date": "12/07/2021",
50-
"deleted": "asdasdsaadssa",
51-
"timezone_offset": "asdasdsa",
52-
"project_id": 1
53-
}, {
54-
"id": null,
55-
"start_date": "12/07/2021",
56-
"owner_id": 2,
57-
"tenant_id": "asdasdsa",
58-
"description": "No se que poner jajaj ",
59-
"activity_id": 2,
60-
"uri": "http://hola.que.hace.com",
61-
"technologies": ["git", "jira", "python"],
62-
"end_date": "12/07/2021",
63-
"deleted": "asdasdsaadssa",
64-
"timezone_offset": "asdasdsa",
65-
"project_id": 1
66-
}, {
67-
"id": null,
68-
"start_date": "12/07/2021",
69-
"owner_id": 2,
70-
"tenant_id": "asdasdsa",
71-
"description": "No se que poner jajaj ",
72-
"activity_id": 2,
73-
"uri": "http://hola.que.hace.com",
74-
"technologies": ["git", "jira", "python"],
75-
"end_date": "12/07/2021",
76-
"deleted": "asdasdsaadssa",
77-
"timezone_offset": "asdasdsa",
78-
"project_id": 1
79-
}, {
80-
"id": null,
81-
"start_date": "12/07/2021",
82-
"owner_id": 2,
83-
"tenant_id": "asdasdsa",
84-
"description": "No se que poner jajaj ",
85-
"activity_id": 2,
86-
"uri": "http://hola.que.hace.com",
87-
"technologies": ["git", "jira", "python"],
88-
"end_date": "12/07/2021",
89-
"deleted": "asdasdsaadssa",
90-
"timezone_offset": "asdasdsa",
91-
"project_id": 1
92-
}]
1+
[{"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "tenant_id": "asdasdsa", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": "asdasdsaadssa", "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": 2, "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": false, "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": "2", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": false, "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": "2", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": false, "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": "2", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": false, "timezone_offset": "asdasdsa", "project_id": 1}, {"id": null, "start_date": "12/07/2021", "owner_id": "2", "description": "No se que poner jajaj ", "activity_id": 2, "uri": "http://hola.que.hace.com", "technologies": ["git", "jira", "python"], "end_date": "12/07/2021", "deleted": false, "timezone_offset": "asdasdsa", "project_id": 1}]

0 commit comments

Comments
 (0)