@@ -39,8 +39,6 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch strin
39
39
})
40
40
resp = session .MakeRequest (t , req , http .StatusFound )
41
41
42
- //TODO check the redirected URL
43
-
44
42
return resp
45
43
}
46
44
@@ -49,5 +47,16 @@ func TestPullCreate(t *testing.T) {
49
47
session := loginUser (t , "user1" )
50
48
testRepoFork (t , session , "user2" , "repo1" , "user1" , "repo1" )
51
49
testEditFile (t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n " )
52
- testPullCreate (t , session , "user1" , "repo1" , "master" )
50
+ resp := testPullCreate (t , session , "user1" , "repo1" , "master" )
51
+
52
+ // check the redirected URL
53
+ url := resp .HeaderMap .Get ("Location" )
54
+ assert .Regexp (t , "^/user2/repo1/pulls/[0-9]*$" , url )
55
+
56
+ // check .diff can be accessed and matches performed change
57
+ req := NewRequest (t , "GET" , url + ".diff" )
58
+ resp = session .MakeRequest (t , req , http .StatusOK )
59
+ assert .Regexp (t , "\\ +Hello, World \\ (Edited\\ )" , resp .Body )
60
+ assert .Regexp (t , "^diff" , resp .Body )
61
+ assert .NotRegexp (t , "diff.*diff" , resp .Body ) // not two diffs, just one
53
62
}
0 commit comments