Skip to content

Commit bf76daf

Browse files
committed
fix: TT-401 implemented faker url
1 parent 42cfc46 commit bf76daf

File tree

5 files changed

+46
-48
lines changed

5 files changed

+46
-48
lines changed

V2/tests/api/azure/time_entry_azure_endpoints_test.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from time_tracker.time_entries._application import _time_entries as time_entries
2-
from faker import Faker
32

43
import azure.functions as func
54
import json
@@ -9,24 +8,12 @@
98

109

1110
def test__time_entry_azure_endpoint__creates_an_time_entry__when_time_entry_has_all_attributes(
12-
create_temp_time_entries,
11+
create_temp_time_entries, time_entry_factory
1312
):
1413
time_entries_json, tmp_directory = create_temp_time_entries
1514
time_entries._create_time_entry._JSON_PATH = tmp_directory
1615

17-
time_entry_body = {
18-
"id": None,
19-
"start_date": Faker().date(),
20-
"owner_id": Faker().random_int(),
21-
"description": Faker().sentence(),
22-
"activity_id": Faker().random_int(),
23-
"uri": "http://timetracker.com",
24-
"technologies": ["jira", "git"],
25-
"end_date": Faker().date(),
26-
"deleted": False,
27-
"timezone_offset": "300",
28-
"project_id": Faker().random_int(),
29-
}
16+
time_entry_body = time_entry_factory(None).__dict__
3017
body = json.dumps(time_entry_body).encode("utf-8")
3118
req = func.HttpRequest(
3219
method="POST",

V2/tests/fixtures.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,13 @@ def create_temp_time_entries(tmpdir_factory):
5555
"owner_id": Faker().random_int(),
5656
"description": Faker().sentence(),
5757
"activity_id": Faker().random_int(),
58-
"uri": "http://time-tracker.com",
58+
"uri": Faker().domain_name(),
5959
"technologies": ["jira", "git"],
6060
"end_date": Faker().date(),
6161
"deleted": Faker().random_int(),
6262
"timezone_offset": "300",
6363
"project_id": Faker().random_int(),
64-
},
65-
{
66-
"id": Faker().random_int(),
67-
"start_date": Faker().date(),
68-
"owner_id": Faker().random_int(),
69-
"description": Faker().sentence(),
70-
"activity_id": Faker().random_int(),
71-
"uri": "http://time-tracker.com",
72-
"technologies": ["jira", "git"],
73-
"end_date": Faker().date(),
74-
"deleted": Faker().random_int(),
75-
"timezone_offset": "300",
76-
"project_id": Faker().random_int(),
77-
},
64+
}
7865
]
7966

8067
with open(json_file, 'w') as outfile:
@@ -92,10 +79,10 @@ def _make_time_entry(
9279
owner_id=Faker().random_int(),
9380
description=Faker().sentence(),
9481
activity_id=Faker().random_int(),
95-
uri="http://time-tracker.com",
82+
uri=Faker().domain_name(),
9683
technologies=["jira", "git"],
9784
end_date=Faker().date(),
98-
deleted=Faker().random_int(),
85+
deleted=False,
9986
timezone_offset="300",
10087
project_id=Faker().random_int(),
10188
):

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,11 @@ def _creator(time_entries):
1919

2020

2121
def test_create_time_entry__returns_an_time_entry_dto__when_create_an_time_entry_that_matches_attributes(
22-
create_fake_time_entries,
22+
create_fake_time_entries, time_entry_factory
2323
):
2424
create_fake_time_entries([])
2525

2626
time_entries_json_dao = TimeEntriesJsonDao(Faker().file_path())
27-
time_entry_data = {
28-
"id": None,
29-
"start_date": Faker().date(),
30-
"owner_id": Faker().random_int(),
31-
"description": Faker().sentence(),
32-
"activity_id": Faker().random_int(),
33-
"uri": "http://timetracker.com",
34-
"technologies": ["jira", "git"],
35-
"end_date": Faker().date(),
36-
"deleted": False,
37-
"timezone_offset": "300",
38-
"project_id": Faker().random_int(),
39-
}
40-
result = time_entries_json_dao.create(time_entry_data)
27+
time_entry_data = time_entry_factory()
28+
result = time_entries_json_dao.create(time_entry_data.__dict__)
4129
assert result == TimeEntry(**time_entry_data)

V2/time_tracker/time_entries/_domain/_persistence_contracts/_time_entries_dao.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44

55

66
class TimeEntriesDao(abc.ABC):
7+
@abc.abstractmethod
78
def create(self, time_entry_data: dict) -> TimeEntry:
89
pass
Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
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}]
1+
[
2+
{
3+
"id": 1,
4+
"start_date": "12/07/2021",
5+
"owner_id": 2,
6+
"description": "Review system of Time Tracker",
7+
"activity_id": 2,
8+
"uri": "http://time_tracker.com",
9+
"technologies": [
10+
"git",
11+
"jira",
12+
"python"
13+
],
14+
"end_date": "12/07/2021",
15+
"deleted": false,
16+
"timezone_offset": "300",
17+
"project_id": 1
18+
},
19+
{
20+
"id": 2,
21+
"start_date": "12/07/2021",
22+
"owner_id": 2,
23+
"description": "Review system of doors in the ioet office Loja, change the current raspberry pi ",
24+
"activity_id": 2,
25+
"uri": null,
26+
"technologies": [
27+
"git",
28+
"jira",
29+
"python"
30+
],
31+
"end_date": "12/07/2021",
32+
"deleted": false,
33+
"timezone_offset": "300",
34+
"project_id": 1
35+
}
36+
]

0 commit comments

Comments
 (0)