@ -39,8 +39,6 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch strin
} )
} )
resp = session . MakeRequest ( t , req , http . StatusFound )
resp = session . MakeRequest ( t , req , http . StatusFound )
//TODO check the redirected URL
return resp
return resp
}
}
@ -49,5 +47,16 @@ func TestPullCreate(t *testing.T) {
session := loginUser ( t , "user1" )
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
testPullCreate ( t , session , "user1" , "repo1" , "master" )
resp := testPullCreate ( t , session , "user1" , "repo1" , "master" )
// check the redirected URL
url := resp . HeaderMap . Get ( "Location" )
assert . Regexp ( t , "^/user2/repo1/pulls/[0-9]*$" , url )
// check .diff can be accessed and matches performed change
req := NewRequest ( t , "GET" , url + ".diff" )
resp = session . MakeRequest ( t , req , http . StatusOK )
assert . Regexp ( t , "\\+Hello, World \\(Edited\\)" , resp . Body )
assert . Regexp ( t , "^diff" , resp . Body )
assert . NotRegexp ( t , "diff.*diff" , resp . Body ) // not two diffs, just one
}
}