9
9
10
10
11
11
@pytest .fixture
12
- def resp_issue ():
12
+ def resp_list_issues ():
13
13
content = [{"name" : "name" , "id" : 1 }, {"name" : "other_name" , "id" : 2 }]
14
14
15
15
with responses .RequestsMock () as rsps :
@@ -23,6 +23,19 @@ def resp_issue():
23
23
yield rsps
24
24
25
25
26
+ @pytest .fixture
27
+ def resp_get_issue ():
28
+ with responses .RequestsMock () as rsps :
29
+ rsps .add (
30
+ method = responses .GET ,
31
+ url = "http://localhost/api/v4/issues/1" ,
32
+ json = {"name" : "name" , "id" : 1 },
33
+ content_type = "application/json" ,
34
+ status = 200 ,
35
+ )
36
+ yield rsps
37
+
38
+
26
39
@pytest .fixture
27
40
def resp_issue_statistics ():
28
41
content = {"statistics" : {"counts" : {"all" : 20 , "closed" : 5 , "opened" : 15 }}}
@@ -38,12 +51,18 @@ def resp_issue_statistics():
38
51
yield rsps
39
52
40
53
41
- def test_issues (gl , resp_issue ):
54
+ def test_list_issues (gl , resp_list_issues ):
42
55
data = gl .issues .list ()
43
56
assert data [1 ].id == 2
44
57
assert data [1 ].name == "other_name"
45
58
46
59
60
+ def test_get_issue (gl , resp_get_issue ):
61
+ issue = gl .issues .get (1 )
62
+ assert issue .id == 1
63
+ assert issue .name == "name"
64
+
65
+
47
66
def test_project_issues_statistics (project , resp_issue_statistics ):
48
67
statistics = project .issuesstatistics .get ()
49
68
assert isinstance (statistics , ProjectIssuesStatistics )
0 commit comments