Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions src/mango/test/13-stable-update-test.py

This file was deleted.

3 changes: 3 additions & 0 deletions test/elixir/test/config/suite.elixir
Original file line number Diff line number Diff line change
Expand Up @@ -735,5 +735,8 @@
],
"IgnoreDesignDocsForAllDocsIndexTests": [
"should not return design docs"
],
"SupportStableAndUpdate": [
"update updates view when specified"
]
}
52 changes: 52 additions & 0 deletions test/elixir/test/mango/13_stable_update_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

defmodule SupportStableAndUpdate do
use CouchTestCase

@db_name "supports-stable-and-update"
@docs1 [
%{
"_id" => "54af50626de419f5109c962f",
"user_id" => 0,
"age" => 10,
"name" => "Jimi",
"location" => "UK",
"number" => 4,
},
%{
"_id" => "54af50622071121b25402dc3",
"user_id" => 1,
"age" => 12,
"name" => "Eddie",
"location" => "ZAR",
"number" => 2,
},
]

setup do
MangoDatabase.recreate(@db_name)
# Hack to prevent auto-indexer from foiling update=False test
# https://github.com/apache/couchdb/issues/2313
MangoDatabase.save_doc(@db_name, %{"_id" => "_design/foo", "language" => "query", "autoupdate" => false})
MangoDatabase.create_index(@db_name, ["name"], ddoc: "foo")
MangoDatabase.save_docs(@db_name, @docs1)
:ok
end

test "update updates view when specified" do
{:ok, docs} = MangoDatabase.find(@db_name, %{"name" => "Eddie"}, update: false)
assert Enum.empty?(docs)
{:ok, docs} = MangoDatabase.find(@db_name, %{"name" => "Eddie"}, update: true)
assert length(docs) == 1
end
end
1 change: 1 addition & 0 deletions test/elixir/test/support/mango_database.ex
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ defmodule MangoDatabase do
|> put_if_set("fields", options, :fields)
|> put_if_set("execution_stats", options, :executionStats)
|> put_if_set("allow_fallback", options, :allow_fallback)
|> put_if_set("update", options, :update)
)

case {(options[:explain] or options[:return_raw]), resp.status_code} do
Expand Down