|
6 | 6 | from jira_dump.base import dict_value, get_fields, extract_dict
|
7 | 7 |
|
8 | 8 |
|
9 |
| -def test_dumper_basic(patch_jira): |
10 |
| - with Dumper(server="https://jira.server.com") as dumper: |
11 |
| - issues = list(dumper.issues) |
12 |
| - assert len(issues) == 1 |
| 9 | +def test_dumper_basic(dumper): |
| 10 | + issues = list(dumper.issues) |
| 11 | + assert len(issues) == 1 |
13 | 12 |
|
14 |
| - issue = issues[0] |
15 |
| - assert issue["status"] == "Running automatic tests" |
16 |
| - assert issue["issue"] == "TEST-42" |
| 13 | + issue = issues[0] |
| 14 | + assert issue["status"] == "Running automatic tests" |
| 15 | + assert issue["issue"] == "TEST-42" |
17 | 16 |
|
18 | 17 |
|
19 | 18 | def test_subclassing(patch_jira):
|
@@ -56,72 +55,66 @@ def test_extract_dict():
|
56 | 55 | assert parsed_issue["c"] == "b"
|
57 | 56 |
|
58 | 57 |
|
59 |
| -def test_worklogs(patch_jira): |
60 |
| - with Dumper(server="https://jira.server.com") as dumper: |
61 |
| - worklogs = list(dumper.worklogs) |
| 58 | +def test_worklogs(dumper): |
| 59 | + worklogs = list(dumper.worklogs) |
62 | 60 |
|
63 |
| - assert len(worklogs) == 10 |
64 |
| - assert worklogs[0]["author"] == "john.doe" |
65 |
| - assert sorted(worklogs[0].keys()) == [ |
66 |
| - "author", |
67 |
| - "comment", |
68 |
| - "issue", |
69 |
| - "started", |
70 |
| - "time_spent", |
71 |
| - ] |
| 61 | + assert len(worklogs) == 10 |
| 62 | + assert worklogs[0]["author"] == "john.doe" |
| 63 | + assert sorted(worklogs[0].keys()) == [ |
| 64 | + "author", |
| 65 | + "comment", |
| 66 | + "issue", |
| 67 | + "started", |
| 68 | + "time_spent", |
| 69 | + ] |
72 | 70 |
|
73 | 71 |
|
74 |
| -def test_transitions(patch_jira): |
75 |
| - with Dumper(server="https://jira.server.com") as dumper: |
76 |
| - transitions = list(dumper.transitions) |
| 72 | +def test_transitions(dumper): |
| 73 | + transitions = list(dumper.transitions) |
77 | 74 |
|
78 |
| - assert len(transitions) == 3 |
| 75 | + assert len(transitions) == 3 |
79 | 76 |
|
80 |
| - transition = transitions[0] |
81 |
| - assert transition[ "author"] == "[email protected]" |
82 |
| - assert list(transition.keys()) == ["author", "created", "from", "to", "issue"] |
| 77 | + transition = transitions[0] |
| 78 | + assert transition[ "author"] == "[email protected]" |
| 79 | + assert list(transition.keys()) == ["author", "created", "from", "to", "issue"] |
83 | 80 |
|
84 | 81 |
|
85 |
| -def test_comments(patch_jira): |
86 |
| - with Dumper(server="https://jira.server.com") as dumper: |
87 |
| - comments = list(dumper.comments) |
| 82 | +def test_comments(dumper): |
| 83 | + comments = list(dumper.comments) |
88 | 84 |
|
89 |
| - assert len(comments) == 1 |
| 85 | + assert len(comments) == 1 |
90 | 86 |
|
91 |
| - comment = comments[0] |
92 |
| - assert comment[ "author"] == "[email protected]" |
93 |
| - assert sorted(list(comment.keys())) == sorted( |
94 |
| - ["author", "created", "body", "issue"] |
95 |
| - ) |
| 87 | + comment = comments[0] |
| 88 | + assert comment[ "author"] == "[email protected]" |
| 89 | + assert sorted(list(comment.keys())) == sorted( |
| 90 | + ["author", "created", "body", "issue"] |
| 91 | + ) |
96 | 92 |
|
97 | 93 |
|
98 |
| -def test_fix_versions(patch_jira): |
99 |
| - with Dumper(server="https://jira.server.com") as dumper: |
100 |
| - fix_versions = list(dumper.fix_versions) |
| 94 | +def test_fix_versions(dumper): |
| 95 | + fix_versions = list(dumper.fix_versions) |
101 | 96 |
|
102 |
| - assert len(fix_versions) == 1 |
| 97 | + assert len(fix_versions) == 1 |
103 | 98 |
|
104 |
| - fix_version = fix_versions[0] |
105 |
| - assert fix_version["name"] == "RELEASE_05" |
106 |
| - assert sorted(list(fix_version.keys())) == sorted( |
107 |
| - ["description", "name", "release_date", "issue"] |
108 |
| - ) |
| 99 | + fix_version = fix_versions[0] |
| 100 | + assert fix_version["name"] == "RELEASE_05" |
| 101 | + assert sorted(list(fix_version.keys())) == sorted( |
| 102 | + ["description", "name", "release_date", "issue"] |
| 103 | + ) |
109 | 104 |
|
110 | 105 |
|
111 |
| -def test_sla_overview(patch_jira): |
112 |
| - with Dumper(server="https://jira.server.com") as dumper: |
113 |
| - sla_overview = list(dumper.sla_overview) |
| 106 | +def test_sla_overview(dumper): |
| 107 | + sla_overview = list(dumper.sla_overview) |
114 | 108 |
|
115 |
| - assert len(sla_overview) == 2 |
| 109 | + assert len(sla_overview) == 2 |
116 | 110 |
|
117 |
| - sla = sla_overview[0] |
118 |
| - assert sla["status"] == "SUCCESS" |
| 111 | + sla = sla_overview[0] |
| 112 | + assert sla["status"] == "SUCCESS" |
119 | 113 |
|
120 | 114 |
|
121 |
| -def test_dataframes(patch_jira): |
122 |
| - with Dumper(server="https://jira.server.com") as dumper: |
123 |
| - for name, object_ in inspect.getmembers(Dumper): |
124 |
| - if "__" not in name and inspect.isdatadescriptor(object_): |
125 |
| - df = pd.DataFrame(getattr(dumper, name)) |
126 |
| - assert "issue" in df.columns |
127 |
| - assert len(df) > 0 |
| 115 | +def test_dataframes(dumper): |
| 116 | + for name, object_ in inspect.getmembers(Dumper): |
| 117 | + if "__" not in name and inspect.isdatadescriptor(object_): |
| 118 | + df = pd.DataFrame(getattr(dumper, name)) |
| 119 | + assert "issue" in df.columns |
| 120 | + assert len(df) > 0 |
0 commit comments