You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_collaboration_test.go 873B

12345678910111213141516171819202122232425262728
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package models
  4. import (
  5. "testing"
  6. "code.gitea.io/gitea/models/db"
  7. repo_model "code.gitea.io/gitea/models/repo"
  8. "code.gitea.io/gitea/models/unittest"
  9. "github.com/stretchr/testify/assert"
  10. )
  11. func TestRepository_DeleteCollaboration(t *testing.T) {
  12. assert.NoError(t, unittest.PrepareTestDatabase())
  13. repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 4})
  14. assert.NoError(t, repo.GetOwner(db.DefaultContext))
  15. assert.NoError(t, DeleteCollaboration(repo, 4))
  16. unittest.AssertNotExistsBean(t, &repo_model.Collaboration{RepoID: repo.ID, UserID: 4})
  17. assert.NoError(t, DeleteCollaboration(repo, 4))
  18. unittest.AssertNotExistsBean(t, &repo_model.Collaboration{RepoID: repo.ID, UserID: 4})
  19. unittest.CheckConsistencyFor(t, &repo_model.Repository{ID: repo.ID})
  20. }