summaryrefslogtreecommitdiffstats
path: root/modules/test/context_tests.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-02-26 07:32:22 +0100
committerGitHub <noreply@github.com>2020-02-26 03:32:22 -0300
commit084a2b00268ed561f59ac19b1b6660a3c58573b3 (patch)
tree5474cb8c1bd5a16251edf46cd99d54757e3ebc0c /modules/test/context_tests.go
parente5944a9521102c4917399a6550a0756919527944 (diff)
downloadgitea-084a2b00268ed561f59ac19b1b6660a3c58573b3.tar.gz
gitea-084a2b00268ed561f59ac19b1b6660a3c58573b3.zip
Code Refactor of IssueWatch related things (#10401)
* refactor * optimize * remove Iretating function LoadWatchUsers do not load Users into IW object and it is used only in api ... so move this logic * remove unessesary * Apply suggestions from code review Thx Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * make Tests more robust * fix rebase * restart CI * CI no dont hit sqlites deadlock Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'modules/test/context_tests.go')
-rw-r--r--modules/test/context_tests.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/test/context_tests.go b/modules/test/context_tests.go
index cf9c5fbc54..f9f0ec5d42 100644
--- a/modules/test/context_tests.go
+++ b/modules/test/context_tests.go
@@ -58,8 +58,11 @@ func LoadRepoCommit(t *testing.T, ctx *context.Context) {
defer gitRepo.Close()
branch, err := gitRepo.GetHEADBranch()
assert.NoError(t, err)
- ctx.Repo.Commit, err = gitRepo.GetBranchCommit(branch.Name)
- assert.NoError(t, err)
+ assert.NotNil(t, branch)
+ if branch != nil {
+ ctx.Repo.Commit, err = gitRepo.GetBranchCommit(branch.Name)
+ assert.NoError(t, err)
+ }
}
// LoadUser load a user into a test context.