@@ -31,9 +31,34 @@ def test_find_issue(gh):
31
31
32
32
@pytest .mark .vcr ()
33
33
def test_set_lines_issue (gh ):
34
- repo = _get_repository (gh , "OCA" , "contract" )
35
- milestone = _create_or_find_branch_milestone (repo , "14.0" )
36
- issue = _find_issue (repo , milestone , "14.0" )
37
- gh_pr = gh .pull_request ("OCA" , "contract" , 705 )
38
- lines = _set_lines_issue (gh_pr , issue , "contract" )
39
- assert len (lines ) > 0
34
+ module = "mis_builder"
35
+ gh_pr_user_login = "sbidoul"
36
+ gh_pr_number = 11
37
+
38
+ body_transformation = [
39
+ (
40
+ "Issue with list but not the module\n "
41
+ "- [ ] a_module_1 - By @legalsylvain - #1\n "
42
+ "- [ ] z_module_1 - By @pedrobaeza - #2" ,
43
+ f"Issue with list but not the module\n "
44
+ f"- [ ] a_module_1 - By @legalsylvain - #1\n "
45
+ f"- [ ] { module } - By @{ gh_pr_user_login } - #{ gh_pr_number } \n "
46
+ f"- [ ] z_module_1 - By @pedrobaeza - #2" ,
47
+ ),
48
+ (
49
+ f"Issue with list containing the module\n "
50
+ f"- [x] { module } - By @legalsylvain - #1\n "
51
+ f"- [ ] z_module_1 - By @pedrobaeza - #2" ,
52
+ f"Issue with list containing the module\n "
53
+ f"- [x] { module } - By @{ gh_pr_user_login } - #{ gh_pr_number } \n "
54
+ f"- [ ] z_module_1 - By @pedrobaeza - #2" ,
55
+ ),
56
+ (
57
+ "Issue with no list" ,
58
+ f"Issue with no list\n "
59
+ f"- [ ] { module } - By @{ gh_pr_user_login } - #{ gh_pr_number } " ,
60
+ ),
61
+ ]
62
+ for (old_body , new_body_expected ) in body_transformation :
63
+ new_body = _set_lines_issue (gh_pr_user_login , gh_pr_number , old_body , module )
64
+ assert new_body == new_body_expected
0 commit comments