Add reopen test

This commit is contained in:
Lunny Xiao 2024-12-17 22:58:35 -08:00
parent 1c9b2a9e62
commit a869ae7088
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A

View File

@ -52,6 +52,10 @@ func TestCreateIssueDependency(t *testing.T) {
_, err = issues_model.CloseIssue(db.DefaultContext, issue2, user1) _, err = issues_model.CloseIssue(db.DefaultContext, issue2, user1)
assert.NoError(t, err) assert.NoError(t, err)
issue2_closed, err := issues_model.GetIssueByID(db.DefaultContext, 2)
assert.NoError(t, err)
assert.True(t, issue2_closed.IsClosed)
left, err = issues_model.IssueNoDependenciesLeft(db.DefaultContext, issue1) left, err = issues_model.IssueNoDependenciesLeft(db.DefaultContext, issue1)
assert.NoError(t, err) assert.NoError(t, err)
assert.True(t, left) assert.True(t, left)
@ -59,4 +63,11 @@ func TestCreateIssueDependency(t *testing.T) {
// Test removing the dependency // Test removing the dependency
err = issues_model.RemoveIssueDependency(db.DefaultContext, user1, issue1, issue2, issues_model.DependencyTypeBlockedBy) err = issues_model.RemoveIssueDependency(db.DefaultContext, user1, issue1, issue2, issues_model.DependencyTypeBlockedBy)
assert.NoError(t, err) assert.NoError(t, err)
_, err = issues_model.ReopenIssue(db.DefaultContext, issue2, user1)
assert.NoError(t, err)
issue2_reopened, err := issues_model.GetIssueByID(db.DefaultContext, 2)
assert.NoError(t, err)
assert.False(t, issue2_reopened.IsClosed)
} }