Skip to content

Commit 1bc56d1

Browse files
nejchJohnVillalovos
authored andcommitted
test(unit): consistently use inline fixtures
1 parent 847004b commit 1bc56d1

File tree

3 files changed

+31
-88
lines changed

3 files changed

+31
-88
lines changed

tests/unit/conftest.py

-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
import gitlab
44

55

6-
@pytest.fixture(scope="session")
7-
def fixture_dir(test_dir):
8-
return test_dir / "unit" / "fixtures"
9-
10-
116
@pytest.fixture
127
def gl():
138
return gitlab.Gitlab(

tests/unit/fixtures/todo.json

-75
This file was deleted.

tests/unit/objects/test_todos.py

+31-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
11
"""
22
GitLab API: https://docs.gitlab.com/ce/api/todos.html
33
"""
4-
5-
import json
6-
74
import pytest
85
import responses
96

107
from gitlab.v4.objects import Todo
118

129

13-
@pytest.fixture()
14-
def json_content(fixture_dir):
15-
with open(fixture_dir / "todo.json", "r", encoding="utf-8") as f:
16-
todo_content = f.read()
17-
return json.loads(todo_content)
10+
@pytest.fixture
11+
def json_content():
12+
return [
13+
{
14+
"id": 102,
15+
"project": {
16+
"id": 2,
17+
"name": "Gitlab Ce",
18+
"name_with_namespace": "Gitlab Org / Gitlab Ce",
19+
"path": "gitlab-ce",
20+
"path_with_namespace": "gitlab-org/gitlab-ce",
21+
},
22+
"author": {
23+
"name": "Administrator",
24+
"username": "root",
25+
"id": 1,
26+
},
27+
"action_name": "marked",
28+
"target_type": "MergeRequest",
29+
"target": {
30+
"id": 34,
31+
"iid": 7,
32+
"project_id": 2,
33+
"assignee": {
34+
"name": "Administrator",
35+
"username": "root",
36+
"id": 1,
37+
},
38+
},
39+
}
40+
]
1841

1942

2043
@pytest.fixture

0 commit comments

Comments
 (0)