Skip to content

Commit

Permalink
[api] fix pre&post check regression, they did suddenly run once, it s…
Browse files Browse the repository at this point in the history
…eems class name instead of file name does matter now
  • Loading branch information
adrianschroeter committed Mar 30, 2012
1 parent eaa1437 commit c77bb2b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/api/test/functional/aaa_pre_consistency_test.rb

This file was deleted.

10 changes: 10 additions & 0 deletions src/api/test/functional/aaa_pre_consistency_test.rb
@@ -0,0 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + "/..") + "/test_consistency_helper"

class AAAPreConsistency < ActionController::IntegrationTest
fixtures :all

def test_resubmit_fixtures
resubmit_all_fixtures
end
end

1 change: 0 additions & 1 deletion src/api/test/functional/zzz_post_consistency_test.rb

This file was deleted.

10 changes: 10 additions & 0 deletions src/api/test/functional/zzz_post_consistency_test.rb
@@ -0,0 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + "/..") + "/test_consistency_helper"

class ZZZPostConsistency < ActionController::IntegrationTest
fixtures :all

def test_resubmit_fixtures
resubmit_all_fixtures
end
end

59 changes: 27 additions & 32 deletions src/api/test/test_consistency_helper.rb
@@ -1,51 +1,46 @@
require File.expand_path(File.dirname(__FILE__) + "/..") + "/test_helper"
require File.expand_path(File.dirname(__FILE__) + "/..") + "/test/test_helper"
require 'source_controller'

#
# Add all kind of data consistency checks here. It runs before and after all functional tests
# to detect any kind of data corruption due to some other code
#

class Consistency < ActionController::IntegrationTest
fixtures :all
def resubmit_all_fixtures
# this just reads and writes again the meta data. 1st run the fixtures and on 2nd all left
# overs from other other tests
prepare_request_with_user "king", "sunflower"
# projects
get "/source"
assert_response :success
node = ActiveXML::XMLNode.new(@response.body)
node.each_entry do |e|
get "/source/#{e.name}/_meta"
assert_response :success
r = @response.body
# FIXME: add some more validation checks here
put "/source/#{e.name}/_meta", r.dup
assert_response :success
get "/source/#{e.name}/_meta"
assert_response :success
assert_not_nil r
assert_equal r, @response.body

def test_resubmit_fixtures
# this just reads and writes again the meta data. 1st run the fixtures and on 2nd all left
# overs from other other tests
prepare_request_with_user "king", "sunflower"
# projects
get "/source"
# packages
get "/source/#{e.name}"
assert_response :success
node = ActiveXML::XMLNode.new(@response.body)
node.each_entry do |e|
get "/source/#{e.name}/_meta"
packages = ActiveXML::XMLNode.new(@response.body)
packages.each_entry do |p|
get "/source/#{e.name}/#{p.name}/_meta"
assert_response :success
r = @response.body
# FIXME: add some more validation checks here
put "/source/#{e.name}/_meta", r.dup
put "/source/#{e.name}/#{p.name}/_meta", r.dup
assert_response :success
get "/source/#{e.name}/_meta"
get "/source/#{e.name}/#{p.name}/_meta"
assert_response :success
assert_not_nil r
assert_equal r, @response.body

# packages
get "/source/#{e.name}"
assert_response :success
packages = ActiveXML::XMLNode.new(@response.body)
packages.each_entry do |p|
get "/source/#{e.name}/#{p.name}/_meta"
assert_response :success
r = @response.body
# FIXME: add some more validation checks here
put "/source/#{e.name}/#{p.name}/_meta", r.dup
assert_response :success
get "/source/#{e.name}/#{p.name}/_meta"
assert_response :success
assert_not_nil r
assert_equal r, @response.body
end
end
end
end

0 comments on commit c77bb2b

Please sign in to comment.