Skip to content

Commit bd96112

Browse files
ararcosmandres2015
authored andcommitted
fix: TT-401 implemented faker url
1 parent 602726e commit bd96112

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
@@ -88,26 +88,13 @@ def create_temp_time_entries(tmpdir_factory):
8888
"owner_id": Faker().random_int(),
8989
"description": Faker().sentence(),
9090
"activity_id": Faker().random_int(),
91-
"uri": "http://time-tracker.com",
91+
"uri": Faker().domain_name(),
9292
"technologies": ["jira", "git"],
9393
"end_date": Faker().date(),
9494
"deleted": Faker().random_int(),
9595
"timezone_offset": "300",
9696
"project_id": Faker().random_int(),
97-
},
98-
{
99-
"id": Faker().random_int(),
100-
"start_date": Faker().date(),
101-
"owner_id": Faker().random_int(),
102-
"description": Faker().sentence(),
103-
"activity_id": Faker().random_int(),
104-
"uri": "http://time-tracker.com",
105-
"technologies": ["jira", "git"],
106-
"end_date": Faker().date(),
107-
"deleted": Faker().random_int(),
108-
"timezone_offset": "300",
109-
"project_id": Faker().random_int(),
110-
},
97+
}
11198
]
11299

113100
with open(json_file, "w") as outfile:
@@ -125,10 +112,10 @@ def _make_time_entry(
125112
owner_id=Faker().random_int(),
126113
description=Faker().sentence(),
127114
activity_id=Faker().random_int(),
128-
uri="http://time-tracker.com",
115+
uri=Faker().domain_name(),
129116
technologies=["jira", "git"],
130117
end_date=Faker().date(),
131-
deleted=Faker().random_int(),
118+
deleted=False,
132119
timezone_offset="300",
133120
project_id=Faker().random_int(),
134121
):

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)