(t *testing.T)
| 98 | } |
| 99 | |
| 100 | func TestCanWriteContentIgnoringUserPerms(t *testing.T) { |
| 101 | tests := []struct { |
| 102 | name string |
| 103 | meta *model.Meta |
| 104 | path string |
| 105 | want bool |
| 106 | reason string |
| 107 | }{ |
| 108 | { |
| 109 | name: "nil meta", |
| 110 | meta: nil, |
| 111 | path: "/any", |
| 112 | want: false, |
| 113 | reason: "nil meta should deny write", |
| 114 | }, |
| 115 | { |
| 116 | name: "meta.Write=false", |
| 117 | meta: &model.Meta{ |
| 118 | Path: "/folder", |
| 119 | Write: false, |
| 120 | }, |
| 121 | path: "/folder", |
| 122 | want: false, |
| 123 | reason: "Write=false should deny write", |
| 124 | }, |
| 125 | { |
| 126 | name: "exact path match with WSub=false", |
| 127 | meta: &model.Meta{ |
| 128 | Path: "/folder", |
| 129 | Write: true, |
| 130 | WSub: false, |
| 131 | }, |
| 132 | path: "/folder", |
| 133 | want: true, |
| 134 | reason: "exact path match should allow write", |
| 135 | }, |
| 136 | { |
| 137 | name: "sub path with WSub=true", |
| 138 | meta: &model.Meta{ |
| 139 | Path: "/folder", |
| 140 | Write: true, |
| 141 | WSub: true, |
| 142 | }, |
| 143 | path: "/folder/subfolder", |
| 144 | want: true, |
| 145 | reason: "sub path with WSub=true should allow write", |
| 146 | }, |
| 147 | { |
| 148 | name: "sub path with WSub=false (BEHAVIOR CHANGE)", |
| 149 | meta: &model.Meta{ |
| 150 | Path: "/folder", |
| 151 | Write: true, |
| 152 | WSub: false, |
| 153 | }, |
| 154 | path: "/folder/subfolder", |
| 155 | want: false, |
| 156 | reason: "sub path with WSub=false should deny write (fixed bug)", |
| 157 | }, |
nothing calls this directly
no test coverage detected