@@ -97,31 +97,6 @@ func TestFindRenamedBranch(t *testing.T) {
97
97
assert .Equal (t , false , exist )
98
98
}
99
99
100
- func TestOnlyGetDeletedBranchOnCorrectRepo (t * testing.T ) {
101
- assert .NoError (t , unittest .PrepareTestDatabase ())
102
-
103
- // Get deletedBranch with ID of 1 on repo with ID 2.
104
- // This should return a nil branch as this deleted branch
105
- // is actually on repo with ID 1.
106
- repo2 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 2 }).(* repo_model.Repository )
107
-
108
- deletedBranch , err := git_model .GetDeletedBranchByID (repo2 .ID , 1 )
109
-
110
- // Expect no error, and the returned branch is nil.
111
- assert .NoError (t , err )
112
- assert .Nil (t , deletedBranch )
113
-
114
- // Now get the deletedBranch with ID of 1 on repo with ID 1.
115
- // This should return the deletedBranch.
116
- repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 }).(* repo_model.Repository )
117
-
118
- deletedBranch , err = git_model .GetDeletedBranchByID (repo1 .ID , 1 )
119
-
120
- // Expect no error, and the returned branch to be not nil.
121
- assert .NoError (t , err )
122
- assert .NotNil (t , deletedBranch )
123
- }
124
-
125
100
func TestRenameBranch (t * testing.T ) {
126
101
assert .NoError (t , unittest .PrepareTestDatabase ())
127
102
repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 }).(* repo_model.Repository )
@@ -161,3 +136,28 @@ func TestRenameBranch(t *testing.T) {
161
136
BranchName : "main" ,
162
137
})
163
138
}
139
+
140
+ func TestOnlyGetDeletedBranchOnCorrectRepo (t * testing.T ) {
141
+ assert .NoError (t , unittest .PrepareTestDatabase ())
142
+
143
+ // Get deletedBranch with ID of 1 on repo with ID 2.
144
+ // This should return a nil branch as this deleted branch
145
+ // is actually on repo with ID 1.
146
+ repo2 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 2 }).(* repo_model.Repository )
147
+
148
+ deletedBranch , err := git_model .GetDeletedBranchByID (repo2 .ID , 1 )
149
+
150
+ // Expect no error, and the returned branch is nil.
151
+ assert .NoError (t , err )
152
+ assert .Nil (t , deletedBranch )
153
+
154
+ // Now get the deletedBranch with ID of 1 on repo with ID 1.
155
+ // This should return the deletedBranch.
156
+ repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 }).(* repo_model.Repository )
157
+
158
+ deletedBranch , err = git_model .GetDeletedBranchByID (repo1 .ID , 1 )
159
+
160
+ // Expect no error, and the returned branch to be not nil.
161
+ assert .NoError (t , err )
162
+ assert .NotNil (t , deletedBranch )
163
+ }
0 commit comments