aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_test.go
diff options
context:
space:
mode:
authorMorgan Bazalgette <git@howl.moe>2017-02-11 11:57:57 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-11 18:57:57 +0800
commit442145dbd348a18915de80faea68f30a9d9309b3 (patch)
tree4d1306edbfa72064ec006b73afd6d2150e507da6 /models/repo_test.go
parenta36a8f4d72bd8d5161f29c2df177ae5a73fe882c (diff)
downloadgitea-442145dbd348a18915de80faea68f30a9d9309b3.tar.gz
gitea-442145dbd348a18915de80faea68f30a9d9309b3.zip
Fix public activity showing private repos (#892)
* Fix public activity showing private repos (#811) Signed-off-by: Morgan Bazalgette <the@howl.moe> * error check after setting is_private to true * Add test for UpdateRepository w/ visibility change
Diffstat (limited to 'models/repo_test.go')
-rw-r--r--models/repo_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/models/repo_test.go b/models/repo_test.go
index db8bd1024e..18da682059 100644
--- a/models/repo_test.go
+++ b/models/repo_test.go
@@ -73,3 +73,22 @@ func TestGetPrivateRepositoryCount(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, int64(2), count)
}
+
+func TestUpdateRepositoryVisibilityChanged(t *testing.T) {
+ assert.NoError(t, PrepareTestDatabase())
+
+ // Get sample repo and change visibility
+ repo, err := GetRepositoryByID(9)
+ repo.IsPrivate = true
+
+ // Update it
+ err = UpdateRepository(repo, true)
+ assert.NoError(t, err)
+
+ // Check visibility of action has become private
+ act := Action{}
+ _, err = x.ID(3).Get(&act)
+
+ assert.NoError(t, err)
+ assert.Equal(t, true, act.IsPrivate)
+}