this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

✅ Add tests for interactive mode in main

+68
+68
issurge/main_test.py
··· 100 100 ], 101 101 ] 102 102 103 + 103 104 @test("issues are submitted when --dry-run is not passed, with gitlab provider") 104 105 def _(_=setup, opts=default_opts): 105 106 Issue._get_remote_url = Mock( ··· 135 136 ], 136 137 ] 137 138 139 + 138 140 @test("issues are not submitted when --dry-run is passed") 139 141 def _(_=setup, opts=default_opts): 140 142 run(opts=opts | {"<file>": "test_some_issues", "--dry-run": True}) 141 143 assert len(subprocess.run.mock_calls) == 0 144 + 145 + 146 + @test("issues are not submitted when --dry-run is passed, in interactive mode") 147 + def _(_=setup, opts=default_opts): 148 + run( 149 + opts=opts 150 + | { 151 + "new": True, 152 + "--dry-run": True, 153 + "<words>": ["testing", "~this", "issue", "@me"], 154 + } 155 + ) 156 + assert len(subprocess.run.mock_calls) == 0 157 + 158 + @test("issues are submitted when --dry-run is not passed, in interactive mode, github provider") 159 + def _(_=setup, opts=default_opts): 160 + run( 161 + opts=opts 162 + | { 163 + "new": True, 164 + "<words>": ["testing", "~this", "issue", "@me"], 165 + } 166 + ) 167 + assert [call.args[0] for call in subprocess.run.mock_calls] == [ 168 + [ 169 + "gh", 170 + "issue", 171 + "new", 172 + "-t", 173 + "testing this issue", 174 + "-b", 175 + "", 176 + "-a", 177 + "@me", 178 + "-l", 179 + "this", 180 + ], 181 + ] 182 + 183 + @test("issues are submitted when --dry-run is not passed, in interactive mode, gitlab provider") 184 + def _(_=setup, opts=default_opts): 185 + Issue._get_remote_url = Mock( 186 + return_value=urlparse("https://gitlab.com/ewen-lbh/gh-api-playground") 187 + ) 188 + run( 189 + opts=opts 190 + | { 191 + "new": True, 192 + "<words>": ["testing", "~this", "issue", "@me"], 193 + } 194 + ) 195 + assert [call.args[0] for call in subprocess.run.mock_calls] == [ 196 + [ 197 + "glab", 198 + "issue", 199 + "new", 200 + "-t", 201 + "testing this issue", 202 + "-d", 203 + "", 204 + "-a", 205 + "@me", 206 + "-l", 207 + "this", 208 + ], 209 + ]