Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Fix several issues causing self test to fail in various places #727

Merged
merged 1 commit into from
Jan 31, 2017
Merged
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
2 changes: 1 addition & 1 deletion deploy/lib/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def xquery_safe
end

def xquery_unsafe
REXML::Text::unnormalize(self).gsub(/\{\{/, '{').gsub(/\}\}/, '}')
REXML::Text::unnormalize(self)
end

end
Expand Down
8 changes: 4 additions & 4 deletions deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -2603,8 +2603,8 @@ declare function setup:add-phrase-throughs(
for $pt in $db-config/db:phrase-throughs/db:phrase-through
return
admin:database-phrase-through(
$pt/db:namespace-uri,
$pt/db:localname
$pt/db:namespace-uri/string(),
$pt/db:localname/string()
)
)
};
Expand Down Expand Up @@ -2638,8 +2638,8 @@ declare function setup:add-phrase-arounds(
for $pa in $db-config/db:phrase-arounds/db:phrase-around
return
admin:database-phrase-around(
$pa/db:namespace-uri,
$pa/db:collation
$pa/db:namespace-uri/string(),
$pa/db:localname/string()
)
)
};
Expand Down
41 changes: 10 additions & 31 deletions deploy/test/test_server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,50 +139,29 @@
end
end

describe "test_credentials" do
describe "test_ml_server_missing" do

before do
ARGV << "local"
end

test_env = "blah"
it "should raise exception about missing ml.server definition" do
test_env = "doesnotexist"
properties = ServerConfig.properties

properties["environment"] = test_env
properties["ml.environment"] = test_env

@s = ServerConfig.new({
:config_file => File.expand_path(properties["ml.config.file"], __FILE__),
:properties => properties,
:logger => Logger.new(STDOUT)
})

filename = "#{test_env}.properties"
path = ServerConfig.path
@properties_file = ServerConfig.expand_path("#{path}/#{filename}")
end

it "should prompt the user for credentials" do
File.exists?(@properties_file).must_equal false

with_stdin do |user|
user.puts "bob"
user.puts "smith"
@s.credentials
assert_raises RuntimeError do
ServerConfig.new({
:config_file => File.expand_path(properties["ml.config.file"], __FILE__),
:properties => properties,
:logger => Logger.new(STDOUT)
})
end

File.exists?(@properties_file).must_equal true

props_data = File.read(@properties_file)

user = $1 if props_data =~ /user=(\w+)/
password = $1 if props_data =~ /password=(\w+)/

user.must_equal 'bob'
password.must_equal 'smith'
end

after do
File.delete(@properties_file)
@s = nil
end

Expand Down