github.com/go-kivik/kivik/v4@v4.3.2/couchdb/test/couchdb22.go (about) 1 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 // use this file except in compliance with the License. You may obtain a copy of 3 // the License at 4 // 5 // http://www.apache.org/licenses/LICENSE-2.0 6 // 7 // Unless required by applicable law or agreed to in writing, software 8 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 // License for the specific language governing permissions and limitations under 11 // the License. 12 13 package test 14 15 import ( 16 "net/http" 17 18 kivik "github.com/go-kivik/kivik/v4" 19 "github.com/go-kivik/kivik/v4/kiviktest" 20 "github.com/go-kivik/kivik/v4/kiviktest/kt" 21 ) 22 23 // nolint:gomnd 24 func registerSuiteCouch22() { 25 kiviktest.RegisterSuite(kiviktest.SuiteCouch22, kt.SuiteConfig{ 26 "Options": httpClient(), 27 "AllDBs.expected": []string{"_global_changes", "_replicator", "_users"}, 28 29 "CreateDB/RW/NoAuth.status": http.StatusUnauthorized, 30 "CreateDB/RW/Admin/Recreate.status": http.StatusPreconditionFailed, 31 32 "DestroyDB/RW/NoAuth.status": http.StatusUnauthorized, 33 "DestroyDB/RW/Admin/NonExistantDB.status": http.StatusNotFound, 34 35 "AllDocs.databases": []string{"chicken", "_duck"}, 36 "AllDocs/Admin/_replicator.offset": 0, 37 "AllDocs/Admin/chicken.status": http.StatusNotFound, 38 "AllDocs/Admin/_duck.status": http.StatusNotFound, 39 "AllDocs/NoAuth/_replicator.status": http.StatusUnauthorized, 40 "AllDocs/NoAuth/chicken.status": http.StatusNotFound, 41 "AllDocs/NoAuth/_duck.status": http.StatusUnauthorized, 42 43 "Find.databases": []string{"chicken", "_duck"}, 44 "Find/Admin/chicken.status": http.StatusNotFound, 45 "Find/Admin/_duck.status": http.StatusNotFound, 46 "Find/NoAuth/chicken.status": http.StatusNotFound, 47 "Find/NoAuth/_duck.status": http.StatusUnauthorized, 48 "Find/RW/group/Admin/Warning.warning": "no matching index found, create an index to optimize query time", 49 "Find/RW/group/NoAuth/Warning.warning": "no matching index found, create an index to optimize query time", 50 51 "Explain.databases": []string{"chicken", "_duck"}, 52 "Explain/Admin/chicken.status": http.StatusNotFound, 53 "Explain/Admin/_duck.status": http.StatusNotFound, 54 "Explain/NoAuth/chicken.status": http.StatusNotFound, 55 "Explain/NoAuth/_duck.status": http.StatusUnauthorized, 56 "Explain.plan": &kivik.QueryPlan{ 57 Index: map[string]interface{}{ 58 "ddoc": nil, 59 "name": "_all_docs", 60 "type": "special", 61 "def": map[string]interface{}{"fields": []interface{}{map[string]string{"_id": "asc"}}}, 62 }, 63 Selector: map[string]interface{}{"_id": map[string]interface{}{"$gt": nil}}, 64 Options: map[string]interface{}{ 65 "bookmark": "nil", 66 "conflicts": false, 67 "execution_stats": false, 68 "r": []int{49}, 69 "sort": map[string]interface{}{}, 70 "use_index": []interface{}{}, 71 "stable": false, 72 "stale": false, 73 "update": true, 74 "skip": 0, 75 "limit": 25, 76 "fields": "all_fields", 77 }, 78 Range: nil, 79 Limit: 25, 80 }, 81 82 "DBExists.databases": []string{"_users", "chicken", "_duck"}, 83 "DBExists/Admin/_users.exists": true, 84 "DBExists/Admin/chicken.exists": false, 85 "DBExists/Admin/_duck.exists": false, 86 "DBExists/NoAuth/_users.exists": true, 87 "DBExists/NoAuth/chicken.exists": false, 88 "DBExists/NoAuth/_duck.status": http.StatusUnauthorized, 89 "DBExists/RW/group/Admin.exists": true, 90 "DBExists/RW/group/NoAuth.exists": true, 91 92 // "DBsStats/NoAuth.status": http.StatusUnauthorized, 93 94 // "AllDBsStats/NoAuth.status": http.StatusUnauthorized, 95 96 "Log.skip": true, // This was removed in CouchDB 2.0 97 98 "Version.version": `^2\.2\.`, 99 "Version.vendor": `^The Apache Software Foundation$`, 100 "Version.vendor_version": ``, // CouchDB 2.0+ no longer has a vendor version 101 102 "Get/RW/group/Admin/bogus.status": http.StatusNotFound, 103 "Get/RW/group/NoAuth/bogus.status": http.StatusNotFound, 104 105 "GetRev/RW/group/Admin/bogus.status": http.StatusNotFound, 106 "GetRev/RW/group/NoAuth/bogus.status": http.StatusNotFound, 107 108 "Flush.databases": []string{"_users", "chicken", "_duck"}, 109 "Flush/NoAuth/chicken/DoFlush.status": http.StatusNotFound, 110 "Flush/Admin/chicken/DoFlush.status": http.StatusNotFound, 111 // "Flush/Admin/_duck/DoFlush.status": http.StatusNotFound, // Possible bug: https://github.com/apache/couchdb/issues/1585 112 "Flush/NoAuth/_duck/DoFlush.status": http.StatusUnauthorized, 113 114 "Delete/RW/Admin/group/MissingDoc.status": http.StatusNotFound, 115 "Delete/RW/Admin/group/InvalidRevFormat.status": http.StatusBadRequest, 116 "Delete/RW/Admin/group/WrongRev.status": http.StatusConflict, 117 "Delete/RW/NoAuth/group/MissingDoc.status": http.StatusNotFound, 118 "Delete/RW/NoAuth/group/InvalidRevFormat.status": http.StatusBadRequest, 119 "Delete/RW/NoAuth/group/WrongRev.status": http.StatusConflict, 120 "Delete/RW/NoAuth/group/DesignDoc.status": http.StatusUnauthorized, 121 122 "Session/Get/Admin.info.authentication_handlers": "cookie,default", 123 "Session/Get/Admin.info.authentication_db": "_users", 124 "Session/Get/Admin.info.authenticated": "cookie", 125 "Session/Get/Admin.userCtx.roles": "_admin", 126 "Session/Get/Admin.ok": "true", 127 "Session/Get/NoAuth.info.authentication_handlers": "cookie,default", 128 "Session/Get/NoAuth.info.authentication_db": "_users", 129 "Session/Get/NoAuth.info.authenticated": "", 130 "Session/Get/NoAuth.userCtx.roles": "", 131 "Session/Get/NoAuth.ok": "true", 132 133 "Session/Post/EmptyJSON.status": http.StatusBadRequest, 134 "Session/Post/BogusTypeJSON.status": http.StatusBadRequest, 135 "Session/Post/BogusTypeForm.status": http.StatusBadRequest, 136 "Session/Post/EmptyForm.status": http.StatusBadRequest, 137 "Session/Post/BadJSON.status": http.StatusBadRequest, 138 "Session/Post/BadForm.status": http.StatusBadRequest, 139 "Session/Post/MeaninglessJSON.status": http.StatusInternalServerError, 140 "Session/Post/MeaninglessForm.status": http.StatusBadRequest, 141 "Session/Post/GoodJSON.status": http.StatusUnauthorized, 142 "Session/Post/BadQueryParam.status": http.StatusUnauthorized, 143 "Session/Post/BadCredsJSON.status": http.StatusUnauthorized, 144 "Session/Post/BadCredsForm.status": http.StatusUnauthorized, 145 "Session/Post/GoodCredsJSONRemoteRedirAbsolute.status": http.StatusBadRequest, // As of 2.1.1 all redirect paths must begin with '/' 146 "Session/Post/GoodCredsJSONRedirEmpty.status": http.StatusBadRequest, // As of 2.1.1 all redirect paths must begin with '/' 147 "Session/Post/GoodCredsJSONRedirRelativeNoSlash.status": http.StatusBadRequest, // As of 2.1.1 all redirect paths must begin with '/' 148 "Session/Post/GoodCredsJSONRemoteRedirHeaderInjection.skip": true, // CouchDB allows header injection 149 "Session/Post/GoodCredsJSONRemoteRedirInvalidURL.skip": true, // CouchDB doesn't sanitize the Location value, so sends unparseable headers. 150 151 "Stats.databases": []string{"_users", "chicken", "_duck"}, 152 "Stats/Admin/chicken.status": http.StatusNotFound, 153 "Stats/Admin/_duck.status": http.StatusNotFound, 154 "Stats/NoAuth/chicken.status": http.StatusNotFound, 155 "Stats/NoAuth/_duck.status": http.StatusUnauthorized, 156 157 "Compact.skip": false, 158 "Compact/RW/NoAuth.status": http.StatusUnauthorized, 159 160 "Security.databases": []string{"_replicator", "_users", "_global_changes", "chicken", "_duck"}, 161 "Security/Admin/chicken.status": http.StatusNotFound, 162 "Security/Admin/_duck.status": http.StatusNotFound, 163 "Security/NoAuth/_global_changes.status": http.StatusUnauthorized, 164 "Security/NoAuth/chicken.status": http.StatusNotFound, 165 "Security/NoAuth/_duck.status": http.StatusUnauthorized, 166 "Security/RW/group/NoAuth.status": http.StatusUnauthorized, 167 168 "SetSecurity/RW/Admin/NotExists.status": http.StatusNotFound, 169 "SetSecurity/RW/NoAuth/NotExists.status": http.StatusNotFound, 170 "SetSecurity/RW/NoAuth/Exists.status": http.StatusInternalServerError, // Can you say WTF? 171 172 "DBUpdates/RW/NoAuth.status": http.StatusUnauthorized, 173 174 "BulkDocs/RW/NoAuth/group/Mix/Conflict.status": http.StatusConflict, 175 "BulkDocs/RW/Admin/group/Mix/Conflict.status": http.StatusConflict, 176 177 "GetAttachment/RW/group/Admin/foo/NotFound.status": http.StatusNotFound, 178 "GetAttachment/RW/group/NoAuth/foo/NotFound.status": http.StatusNotFound, 179 180 "GetAttachmentMeta/RW/group/Admin/foo/NotFound.status": http.StatusNotFound, 181 "GetAttachmentMeta/RW/group/NoAuth/foo/NotFound.status": http.StatusNotFound, 182 183 "PutAttachment/RW/group/Admin/Conflict.status": http.StatusConflict, 184 "PutAttachment/RW/group/NoAuth/Conflict.status": http.StatusConflict, 185 "PutAttachment/RW/group/NoAuth/UpdateDesignDoc.status": http.StatusUnauthorized, 186 "PutAttachment/RW/group/NoAuth/CreateDesignDoc.status": http.StatusUnauthorized, 187 188 // "DeleteAttachment/RW/group/Admin/NotFound.status": http.StatusNotFound, // COUCHDB-3362 189 // "DeleteAttachment/RW/group/NoAuth/NotFound.status": http.StatusNotFound, // COUCHDB-3362 190 "DeleteAttachment/RW/group/Admin/NoDoc.status": http.StatusConflict, 191 "DeleteAttachment/RW/group/NoAuth/NoDoc.status": http.StatusConflict, 192 "DeleteAttachment/RW/group/NoAuth/DesignDoc.status": http.StatusUnauthorized, 193 194 "Put/RW/Admin/group/LeadingUnderscoreInID.status": http.StatusBadRequest, 195 "Put/RW/Admin/group/Conflict.status": http.StatusConflict, 196 "Put/RW/NoAuth/group/LeadingUnderscoreInID.status": http.StatusBadRequest, 197 "Put/RW/NoAuth/group/DesignDoc.status": http.StatusUnauthorized, 198 "Put/RW/NoAuth/group/Conflict.status": http.StatusConflict, 199 200 "CreateIndex/RW/Admin/group/EmptyIndex.status": http.StatusBadRequest, 201 "CreateIndex/RW/Admin/group/BlankIndex.status": http.StatusBadRequest, 202 "CreateIndex/RW/Admin/group/InvalidIndex.status": http.StatusBadRequest, 203 "CreateIndex/RW/Admin/group/NilIndex.status": http.StatusBadRequest, 204 "CreateIndex/RW/Admin/group/InvalidJSON.status": http.StatusBadRequest, 205 "CreateIndex/RW/NoAuth/group/EmptyIndex.status": http.StatusBadRequest, 206 "CreateIndex/RW/NoAuth/group/BlankIndex.status": http.StatusBadRequest, 207 "CreateIndex/RW/NoAuth/group/InvalidIndex.status": http.StatusBadRequest, 208 "CreateIndex/RW/NoAuth/group/NilIndex.status": http.StatusBadRequest, 209 "CreateIndex/RW/NoAuth/group/InvalidJSON.status": http.StatusBadRequest, 210 "CreateIndex/RW/NoAuth/group/Valid.status": http.StatusInternalServerError, // COUCHDB-3374 211 212 "GetIndexes.databases": []string{"_replicator", "_users", "_global_changes", "chicken", "_duck"}, 213 "GetIndexes/Admin/_replicator.indexes": []kivik.Index{kt.AllDocsIndex}, 214 "GetIndexes/Admin/_users.indexes": []kivik.Index{kt.AllDocsIndex}, 215 "GetIndexes/Admin/_global_changes.indexes": []kivik.Index{kt.AllDocsIndex}, 216 "GetIndexes/Admin/chicken.status": http.StatusNotFound, 217 "GetIndexes/Admin/_duck.status": http.StatusNotFound, 218 "GetIndexes/NoAuth/_replicator.indexes": []kivik.Index{kt.AllDocsIndex}, 219 "GetIndexes/NoAuth/_users.indexes": []kivik.Index{kt.AllDocsIndex}, 220 "GetIndexes/NoAuth/_global_changes.status": http.StatusUnauthorized, 221 "GetIndexes/NoAuth/chicken.status": http.StatusNotFound, 222 "GetIndexes/NoAuth/_duck.status": http.StatusUnauthorized, 223 "GetIndexes/RW.indexes": []kivik.Index{ 224 kt.AllDocsIndex, 225 { 226 DesignDoc: "_design/foo", 227 Name: "bar", 228 Type: "json", 229 Definition: map[string]interface{}{ 230 "fields": []map[string]string{ 231 {"foo": "asc"}, 232 }, 233 "partial_filter_selector": map[string]string{}, 234 }, 235 }, 236 }, 237 238 "DeleteIndex/RW/Admin/group/NotFoundDdoc.status": http.StatusNotFound, 239 "DeleteIndex/RW/Admin/group/NotFoundName.status": http.StatusNotFound, 240 "DeleteIndex/RW/NoAuth/group/NotFoundDdoc.status": http.StatusNotFound, 241 "DeleteIndex/RW/NoAuth/group/NotFoundName.status": http.StatusNotFound, 242 243 "GetReplications/NoAuth.status": http.StatusUnauthorized, 244 245 "Replicate.NotFoundDB": "http://localhost:5984/foo", 246 "Replicate.timeoutSeconds": 60, 247 "Replicate.prefix": "http://localhost:5984/", 248 "Replicate/RW/NoAuth.status": http.StatusForbidden, 249 "Replicate/RW/Admin/group/MissingSource/Results.status": http.StatusNotFound, 250 "Replicate/RW/Admin/group/MissingTarget/Results.status": http.StatusNotFound, 251 252 "Query/RW/group/Admin/WithoutDocs/ScanDoc.status": http.StatusBadRequest, 253 "Query/RW/group/NoAuth/WithoutDocs/ScanDoc.status": http.StatusBadRequest, 254 255 "ViewCleanup/RW/NoAuth.status": http.StatusUnauthorized, 256 257 "Changes/Continuous.options": kivik.Params(map[string]interface{}{ 258 "feed": "continuous", 259 "since": "now", 260 "heartbeat": 6000, 261 }), 262 }) 263 }