reverting last change, which included posgres config specific things

This commit is contained in:
Shaun McDonald 2009-04-13 00:10:37 +00:00
parent 2c52b06716
commit 90ec90f13d
5 changed files with 23 additions and 29 deletions

View file

@ -1,12 +1,12 @@
class Acl < ActiveRecord::Base
def self.find_by_address(address, options)
self.with_scope(:find => {:conditions => ["? & netmask = address", address]}) do
self.with_scope(:find => {:conditions => ["inet_aton(?) & netmask = address", address]}) do
return self.find(:first, options)
end
end
def self.find_all_by_address(address, options)
self.with_scope(:find => {:conditions => ["? & netmask = address", address]}) do
self.with_scope(:find => {:conditions => ["inet_aton(?) & netmask = address", address]}) do
return self.find(:all, options)
end
end

View file

@ -11,26 +11,26 @@
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: postgresql
adapter: mysql
database: openstreetmap
username: shaunmcdonald
password: postgres
#host: localhost
username: openstreetmap
password: openstreetmap
host: localhost
encoding: utf8
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
adapter: postgresql
adapter: mysql
database: osm_test
username: shaunmcdonald
password: postgres
#host: localhost
username: osm_test
password: osm_test
host: localhost
encoding: utf8
production:
adapter: postgresql
adapter: mysql
database: osm
username: osm
password: osm

View file

@ -1,2 +1,2 @@
# Use the MySQL interface for SqlSessionStore
SqlSessionStore.session_class = PostgresqlSession
SqlSessionStore.session_class = MysqlSession

View file

@ -7,8 +7,8 @@ class AddEndTimeToChangesets < ActiveRecord::Migration
# it appears that execute will only accept string arguments, so
# this is an ugly, ugly hack to get some sort of mysql/postgres
# independence. now i have to go wash my brain with bleach.
#execute("update changesets set closed_at=(now()-'1 hour') where open=(1=0)")
#execute("update changesets set closed_at=(now()+'1 hour') where open=(1=1)")
execute("update changesets set closed_at=(now()-'1 hour') where open=(1=0)")
execute("update changesets set closed_at=(now()+'1 hour') where open=(1=1)")
# remove the open column as it is unnecessary now and denormalises
# the table.

View file

@ -4,6 +4,14 @@ require 'changeset_controller'
class ChangesetControllerTest < ActionController::TestCase
api_fixtures
def basic_authorization(user, pass)
@request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
end
def content(c)
@request.env["RAW_POST_DATA"] = c.to_s
end
# -----------------------
# Test simple changeset creation
# -----------------------
@ -40,18 +48,6 @@ class ChangesetControllerTest < ActionController::TestCase
assert_response :bad_request, "creating a invalid changeset should fail"
end
def test_create_invalid_no_content
basic_authorization "test@openstreetmap.org", "test"
put :create
assert_response :bad_request, "creating a changeset with no content should fail"
end
def test_create_wrong_method
basic_authorization "test@openstreetmap.org", "test"
get :create
assert_response :method_not_allowed
end
##
# check that the changeset can be read and returns the correct
# document structure.
@ -252,9 +248,7 @@ EOF
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
assert_difference('Changeset.count', 1) do
put :create
end
put :create
assert_response :success
changeset_id = @response.body.to_i
end