backlog 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Rakefile +2 -1
- data/app/controllers/application.rb +55 -8
- data/app/controllers/groups_controller.rb +62 -0
- data/app/controllers/periods_controller.rb +13 -55
- data/app/controllers/tasks_controller.rb +9 -5
- data/app/controllers/works_controller.rb +43 -6
- data/app/helpers/application_helper.rb +20 -2
- data/app/helpers/groups_helper.rb +2 -0
- data/app/models/backlog.rb +19 -10
- data/app/models/estimate.rb +2 -1
- data/app/models/group.rb +11 -0
- data/app/models/party.rb +3 -0
- data/app/models/period.rb +43 -6
- data/app/models/task.rb +27 -14
- data/app/models/user.rb +37 -8
- data/app/models/work.rb +4 -6
- data/app/views/backlogs/_name_list.rhtml +5 -0
- data/app/views/backlogs/show.rhtml +4 -4
- data/app/views/groups/_form.rhtml +7 -0
- data/app/views/groups/edit.rhtml +31 -0
- data/app/views/groups/list.rhtml +27 -0
- data/app/views/groups/new.rhtml +8 -0
- data/app/views/layouts/wide.rhtml +2 -2
- data/app/views/periods/_burn_down_chart.rhtml +1 -1
- data/app/views/periods/_form.rhtml +13 -9
- data/app/views/periods/_show_active.rhtml +6 -12
- data/app/views/periods/_title.rhtml +4 -5
- data/app/views/periods/edit.rhtml +1 -1
- data/app/views/periods/new.rhtml +1 -1
- data/app/views/periods/show.rhtml +10 -6
- data/app/views/tasks/_backlog_header.rhtml +22 -0
- data/app/views/tasks/_description_list.rhtml +5 -0
- data/app/views/tasks/_form.rhtml +26 -7
- data/app/views/tasks/_task.rhtml +4 -4
- data/app/views/tasks/edit.rhtml +2 -3
- data/app/views/tasks/list_started.rhtml +1 -0
- data/app/views/tasks/new.rhtml +2 -2
- data/app/views/works/_buttons.rhtml +3 -0
- data/app/views/works/_form.rhtml +15 -10
- data/app/views/works/daily_work_sheet.rhtml +30 -18
- data/app/views/works/edit.rhtml +4 -4
- data/app/views/works/list.rhtml +2 -2
- data/app/views/works/new.rhtml +3 -2
- data/app/views/works/weekly_work_sheet.rhtml +2 -2
- data/bin/backlog +2 -0
- data/bin/backlog_init.d_kubosch_production +27 -0
- data/bin/copy_production2development.rb +33 -0
- data/config/database.yml +13 -7
- data/config/deploy_kubosch.rb +1 -0
- data/config/environment.rb +2 -0
- data/config/environments/development_mysql.rb +27 -0
- data/config/environments/kubosch_production_mysql.rb +21 -0
- data/config/routes.rb +1 -1
- data/db/migrate/{001_tasks.rb → 001_create_tasks.rb} +1 -1
- data/db/migrate/{002_backlogs.rb → 002_create_backlogs.rb} +2 -2
- data/db/migrate/003_add_estimation_points.rb +1 -1
- data/db/migrate/004_add_period.rb +2 -2
- data/db/migrate/013_create_estimates.rb +1 -1
- data/db/migrate/015_add_user_option.rb +9 -5
- data/db/migrate/017_insert_datek_projects.rb +13 -10
- data/db/migrate/018_create_groups.rb +115 -0
- data/db/schema.rb +72 -12
- data/lang/en.yaml +7 -0
- data/lang/no.yaml +7 -0
- data/lib/big_decimal_yaml_fix.rb +27 -0
- data/lib/class_table_inheritance.rb +163 -0
- data/lib/tasks/backup.rake +92 -0
- data/public/images/person.org.png +0 -0
- data/public/images/person.png +0 -0
- data/public/stylesheets/backlog.css +3 -1
- data/public/stylesheets/mwrt002.css +1 -1
- data/test/fixtures/groups.yml +6 -0
- data/test/fixtures/parties.yml +31 -0
- data/test/fixtures/periods.yml +2 -2
- data/test/fixtures/tasks.yml +2 -0
- data/test/fixtures/users.yml +6 -6
- data/test/functional/backlogs_controller_test.rb +1 -1
- data/test/functional/groups_controller_test.rb +120 -0
- data/test/functional/periods_controller_test.rb +1 -1
- data/test/functional/tasks_controller_test.rb +16 -1
- data/test/functional/user_controller_test.rb +8 -2
- data/test/test_helper.rb +5 -0
- data/test/unit/big_decimal_yaml_fix_test.rb +14 -0
- data/test/unit/estimate_test.rb +1 -1
- data/test/unit/group_test.rb +10 -0
- data/test/unit/user_test.rb +56 -44
- data/tmp/sessions/ruby_sess.22dec3e9df47fb4e +0 -0
- data/tmp/sessions/ruby_sess.8037e0ab58cbcf1a +0 -0
- data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +35 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/vendor/rails/{actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml → railties/configs/empty.log} +0 -0
- metadata +36 -105
- data/backlog.gemspec +0 -21
- data/vendor/rails/actionwebservice/CHANGELOG +0 -265
- data/vendor/rails/actionwebservice/MIT-LICENSE +0 -21
- data/vendor/rails/actionwebservice/README +0 -364
- data/vendor/rails/actionwebservice/Rakefile +0 -171
- data/vendor/rails/actionwebservice/TODO +0 -32
- data/vendor/rails/actionwebservice/examples/googlesearch/README +0 -143
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +0 -57
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +0 -108
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +0 -7
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +0 -58
- data/vendor/rails/actionwebservice/examples/metaWeblog/README +0 -17
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +0 -60
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +0 -34
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +0 -67
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +0 -48
- data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +0 -16
- data/vendor/rails/actionwebservice/install.rb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service.rb +0 -66
- data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +0 -301
- data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +0 -42
- data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +0 -138
- data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +0 -28
- data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +0 -113
- data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +0 -58
- data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +0 -93
- data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +0 -86
- data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +0 -69
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +0 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +0 -207
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +0 -379
- data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +0 -202
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +0 -4
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +0 -112
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +0 -37
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +0 -176
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +0 -235
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +0 -122
- data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +0 -283
- data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +0 -68
- data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +0 -26
- data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +0 -226
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb +0 -65
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb +0 -6
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb +0 -29
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +0 -110
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +0 -9
- data/vendor/rails/actionwebservice/setup.rb +0 -1379
- data/vendor/rails/actionwebservice/test/abstract_client.rb +0 -183
- data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +0 -551
- data/vendor/rails/actionwebservice/test/abstract_unit.rb +0 -45
- data/vendor/rails/actionwebservice/test/api_test.rb +0 -102
- data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +0 -3
- data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +0 -2
- data/vendor/rails/actionwebservice/test/base_test.rb +0 -42
- data/vendor/rails/actionwebservice/test/casting_test.rb +0 -86
- data/vendor/rails/actionwebservice/test/client_soap_test.rb +0 -153
- data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +0 -152
- data/vendor/rails/actionwebservice/test/container_test.rb +0 -73
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +0 -137
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +0 -59
- data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +0 -8
- data/vendor/rails/actionwebservice/test/fixtures/users.yml +0 -12
- data/vendor/rails/actionwebservice/test/gencov +0 -3
- data/vendor/rails/actionwebservice/test/invocation_test.rb +0 -185
- data/vendor/rails/actionwebservice/test/run +0 -6
- data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +0 -146
- data/vendor/rails/actionwebservice/test/struct_test.rb +0 -52
- data/vendor/rails/actionwebservice/test/test_invoke_test.rb +0 -112
@@ -1,45 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
3
|
-
$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
|
4
|
-
$:.unshift(File.dirname(__FILE__) + '/../../actionpack/lib')
|
5
|
-
$:.unshift(File.dirname(__FILE__) + '/../../activerecord/lib')
|
6
|
-
|
7
|
-
require 'test/unit'
|
8
|
-
require 'action_web_service'
|
9
|
-
require 'action_controller'
|
10
|
-
require 'action_controller/test_process'
|
11
|
-
|
12
|
-
# Show backtraces for deprecated behavior for quicker cleanup.
|
13
|
-
ActiveSupport::Deprecation.debug = true
|
14
|
-
|
15
|
-
|
16
|
-
ActionController::Base.logger = Logger.new("debug.log")
|
17
|
-
ActionController::Base.ignore_missing_templates = true
|
18
|
-
|
19
|
-
begin
|
20
|
-
PATH_TO_AR = File.dirname(__FILE__) + '/../../activerecord'
|
21
|
-
require "#{PATH_TO_AR}/lib/active_record" unless Object.const_defined?(:ActiveRecord)
|
22
|
-
require "#{PATH_TO_AR}/lib/active_record/fixtures" unless Object.const_defined?(:Fixtures)
|
23
|
-
rescue LoadError => e
|
24
|
-
fail "\nFailed to load activerecord: #{e}"
|
25
|
-
end
|
26
|
-
|
27
|
-
ActiveRecord::Base.configurations = {
|
28
|
-
'mysql' => {
|
29
|
-
:adapter => "mysql",
|
30
|
-
:username => "rails",
|
31
|
-
:encoding => "utf8",
|
32
|
-
:database => "actionwebservice_unittest"
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
ActiveRecord::Base.establish_connection 'mysql'
|
37
|
-
|
38
|
-
Test::Unit::TestCase.fixture_path = "#{File.dirname(__FILE__)}/fixtures/"
|
39
|
-
|
40
|
-
# restore default raw_post functionality
|
41
|
-
class ActionController::TestRequest
|
42
|
-
def raw_post
|
43
|
-
super
|
44
|
-
end
|
45
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/abstract_unit'
|
2
|
-
|
3
|
-
module APITest
|
4
|
-
class API < ActionWebService::API::Base
|
5
|
-
api_method :void
|
6
|
-
api_method :expects_and_returns, :expects_and_returns => [:string]
|
7
|
-
api_method :expects, :expects => [:int, :bool]
|
8
|
-
api_method :returns, :returns => [:int, [:string]]
|
9
|
-
api_method :named_signature, :expects => [{:appkey=>:int}, {:publish=>:bool}]
|
10
|
-
api_method :string_types, :expects => ['int', 'string', 'bool', 'base64']
|
11
|
-
api_method :class_types, :expects => [TrueClass, Bignum, String]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class TC_API < Test::Unit::TestCase
|
16
|
-
API = APITest::API
|
17
|
-
|
18
|
-
def test_api_method_declaration
|
19
|
-
%w(
|
20
|
-
void
|
21
|
-
expects_and_returns
|
22
|
-
expects
|
23
|
-
returns
|
24
|
-
named_signature
|
25
|
-
string_types
|
26
|
-
class_types
|
27
|
-
).each do |name|
|
28
|
-
name = name.to_sym
|
29
|
-
public_name = API.public_api_method_name(name)
|
30
|
-
assert(API.has_api_method?(name))
|
31
|
-
assert(API.has_public_api_method?(public_name))
|
32
|
-
assert(API.api_method_name(public_name) == name)
|
33
|
-
assert(API.api_methods.has_key?(name))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_signature_canonicalization
|
38
|
-
assert_equal(nil, API.api_methods[:void].expects)
|
39
|
-
assert_equal(nil, API.api_methods[:void].returns)
|
40
|
-
assert_equal([String], API.api_methods[:expects_and_returns].expects.map{|x| x.type_class})
|
41
|
-
assert_equal([String], API.api_methods[:expects_and_returns].returns.map{|x| x.type_class})
|
42
|
-
assert_equal([Integer, TrueClass], API.api_methods[:expects].expects.map{|x| x.type_class})
|
43
|
-
assert_equal(nil, API.api_methods[:expects].returns)
|
44
|
-
assert_equal(nil, API.api_methods[:returns].expects)
|
45
|
-
assert_equal([Integer, [String]], API.api_methods[:returns].returns.map{|x| x.array?? [x.element_type.type_class] : x.type_class})
|
46
|
-
assert_equal([[:appkey, Integer], [:publish, TrueClass]], API.api_methods[:named_signature].expects.map{|x| [x.name, x.type_class]})
|
47
|
-
assert_equal(nil, API.api_methods[:named_signature].returns)
|
48
|
-
assert_equal([Integer, String, TrueClass, ActionWebService::Base64], API.api_methods[:string_types].expects.map{|x| x.type_class})
|
49
|
-
assert_equal(nil, API.api_methods[:string_types].returns)
|
50
|
-
assert_equal([TrueClass, Integer, String], API.api_methods[:class_types].expects.map{|x| x.type_class})
|
51
|
-
assert_equal(nil, API.api_methods[:class_types].returns)
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_not_instantiable
|
55
|
-
assert_raises(NoMethodError) do
|
56
|
-
API.new
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_api_errors
|
61
|
-
assert_raises(ActionWebService::ActionWebServiceError) do
|
62
|
-
klass = Class.new(ActionWebService::API::Base) do
|
63
|
-
api_method :test, :expects => [ActiveRecord::Base]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
klass = Class.new(ActionWebService::API::Base) do
|
67
|
-
allow_active_record_expects true
|
68
|
-
api_method :test2, :expects => [ActiveRecord::Base]
|
69
|
-
end
|
70
|
-
assert_raises(ActionWebService::ActionWebServiceError) do
|
71
|
-
klass = Class.new(ActionWebService::API::Base) do
|
72
|
-
api_method :test, :invalid => [:int]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_parameter_names
|
78
|
-
method = API.api_methods[:named_signature]
|
79
|
-
assert_equal 0, method.expects_index_of(:appkey)
|
80
|
-
assert_equal 1, method.expects_index_of(:publish)
|
81
|
-
assert_equal 1, method.expects_index_of('publish')
|
82
|
-
assert_equal 0, method.expects_index_of('appkey')
|
83
|
-
assert_equal -1, method.expects_index_of('blah')
|
84
|
-
assert_equal -1, method.expects_index_of(:missing)
|
85
|
-
assert_equal -1, API.api_methods[:void].expects_index_of('test')
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_parameter_hash
|
89
|
-
method = API.api_methods[:named_signature]
|
90
|
-
hash = method.expects_to_hash([5, false])
|
91
|
-
assert_equal({:appkey => 5, :publish => false}, hash)
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_api_methods_compat
|
95
|
-
sig = API.api_methods[:named_signature][:expects]
|
96
|
-
assert_equal [{:appkey=>Integer}, {:publish=>TrueClass}], sig
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_to_s
|
100
|
-
assert_equal 'void Expects(int param0, bool param1)', APITest::API.api_methods[:expects].to_s
|
101
|
-
end
|
102
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/abstract_unit'
|
2
|
-
|
3
|
-
module BaseTest
|
4
|
-
class API < ActionWebService::API::Base
|
5
|
-
api_method :add, :expects => [:int, :int], :returns => [:int]
|
6
|
-
api_method :void
|
7
|
-
end
|
8
|
-
|
9
|
-
class PristineAPI < ActionWebService::API::Base
|
10
|
-
inflect_names false
|
11
|
-
|
12
|
-
api_method :add
|
13
|
-
api_method :under_score
|
14
|
-
end
|
15
|
-
|
16
|
-
class Service < ActionWebService::Base
|
17
|
-
web_service_api API
|
18
|
-
|
19
|
-
def add(a, b)
|
20
|
-
end
|
21
|
-
|
22
|
-
def void
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class PristineService < ActionWebService::Base
|
27
|
-
web_service_api PristineAPI
|
28
|
-
|
29
|
-
def add
|
30
|
-
end
|
31
|
-
|
32
|
-
def under_score
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class TC_Base < Test::Unit::TestCase
|
38
|
-
def test_options
|
39
|
-
assert(BaseTest::PristineService.web_service_api.inflect_names == false)
|
40
|
-
assert(BaseTest::Service.web_service_api.inflect_names == true)
|
41
|
-
end
|
42
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/abstract_unit'
|
2
|
-
|
3
|
-
module CastingTest
|
4
|
-
class API < ActionWebService::API::Base
|
5
|
-
api_method :int, :expects => [:int]
|
6
|
-
api_method :str, :expects => [:string]
|
7
|
-
api_method :base64, :expects => [:base64]
|
8
|
-
api_method :bool, :expects => [:bool]
|
9
|
-
api_method :float, :expects => [:float]
|
10
|
-
api_method :time, :expects => [:time]
|
11
|
-
api_method :datetime, :expects => [:datetime]
|
12
|
-
api_method :date, :expects => [:date]
|
13
|
-
|
14
|
-
api_method :int_array, :expects => [[:int]]
|
15
|
-
api_method :str_array, :expects => [[:string]]
|
16
|
-
api_method :bool_array, :expects => [[:bool]]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class TC_Casting < Test::Unit::TestCase
|
21
|
-
include CastingTest
|
22
|
-
|
23
|
-
def test_base_type_casting_valid
|
24
|
-
assert_equal 10000, cast_expects(:int, '10000')[0]
|
25
|
-
assert_equal '10000', cast_expects(:str, 10000)[0]
|
26
|
-
base64 = cast_expects(:base64, 10000)[0]
|
27
|
-
assert_equal '10000', base64
|
28
|
-
assert_instance_of ActionWebService::Base64, base64
|
29
|
-
[1, '1', 'true', 'y', 'yes'].each do |val|
|
30
|
-
assert_equal true, cast_expects(:bool, val)[0]
|
31
|
-
end
|
32
|
-
[0, '0', 'false', 'n', 'no'].each do |val|
|
33
|
-
assert_equal false, cast_expects(:bool, val)[0]
|
34
|
-
end
|
35
|
-
assert_equal 3.14159, cast_expects(:float, '3.14159')[0]
|
36
|
-
now = Time.at(Time.now.tv_sec)
|
37
|
-
casted = cast_expects(:time, now.to_s)[0]
|
38
|
-
assert_equal now, casted
|
39
|
-
now = DateTime.now
|
40
|
-
assert_equal now.to_s, cast_expects(:datetime, now.to_s)[0].to_s
|
41
|
-
today = Date.today
|
42
|
-
assert_equal today, cast_expects(:date, today.to_s)[0]
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_base_type_casting_invalid
|
46
|
-
assert_raises ArgumentError do
|
47
|
-
cast_expects(:int, 'this is not a number')
|
48
|
-
end
|
49
|
-
assert_raises ActionWebService::Casting::CastingError do
|
50
|
-
# neither true or false ;)
|
51
|
-
cast_expects(:bool, 'i always lie')
|
52
|
-
end
|
53
|
-
assert_raises ArgumentError do
|
54
|
-
cast_expects(:float, 'not a float')
|
55
|
-
end
|
56
|
-
assert_raises ArgumentError do
|
57
|
-
cast_expects(:time, '111111111111111111111111111111111')
|
58
|
-
end
|
59
|
-
assert_raises ArgumentError do
|
60
|
-
cast_expects(:datetime, '-1')
|
61
|
-
end
|
62
|
-
assert_raises ArgumentError do
|
63
|
-
cast_expects(:date, '')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_array_type_casting
|
68
|
-
assert_equal [1, 2, 3213992, 4], cast_expects(:int_array, ['1', '2', '3213992', '4'])[0]
|
69
|
-
assert_equal ['one', 'two', '5.0', '200', nil, 'true'], cast_expects(:str_array, [:one, 'two', 5.0, 200, nil, true])[0]
|
70
|
-
assert_equal [true, nil, true, true, false], cast_expects(:bool_array, ['1', nil, 'y', true, 'false'])[0]
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_array_type_casting_failure
|
74
|
-
assert_raises ActionWebService::Casting::CastingError do
|
75
|
-
cast_expects(:bool_array, ['false', 'blahblah'])
|
76
|
-
end
|
77
|
-
assert_raises ArgumentError do
|
78
|
-
cast_expects(:int_array, ['1', '2.021', '4'])
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
private
|
83
|
-
def cast_expects(method_name, *args)
|
84
|
-
API.api_method_instance(method_name.to_sym).cast_expects([*args])
|
85
|
-
end
|
86
|
-
end
|
@@ -1,153 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/abstract_client'
|
2
|
-
|
3
|
-
|
4
|
-
module ClientSoapTest
|
5
|
-
PORT = 8998
|
6
|
-
|
7
|
-
class SoapClientLet < ClientTest::AbstractClientLet
|
8
|
-
def do_POST(req, res)
|
9
|
-
test_request = ActionController::TestRequest.new
|
10
|
-
test_request.request_parameters['action'] = req.path.gsub(/^\//, '').split(/\//)[1]
|
11
|
-
test_request.env['REQUEST_METHOD'] = "POST"
|
12
|
-
test_request.env['HTTP_CONTENTTYPE'] = 'text/xml'
|
13
|
-
test_request.env['HTTP_SOAPACTION'] = req.header['soapaction'][0]
|
14
|
-
test_request.env['RAW_POST_DATA'] = req.body
|
15
|
-
response = ActionController::TestResponse.new
|
16
|
-
@controller.process(test_request, response)
|
17
|
-
res.header['content-type'] = 'text/xml'
|
18
|
-
res.body = response.body
|
19
|
-
rescue Exception => e
|
20
|
-
$stderr.puts e.message
|
21
|
-
$stderr.puts e.backtrace.join("\n")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class ClientContainer < ActionController::Base
|
26
|
-
web_client_api :client, :soap, "http://localhost:#{PORT}/client/api", :api => ClientTest::API
|
27
|
-
web_client_api :invalid, :null, "", :api => true
|
28
|
-
|
29
|
-
def get_client
|
30
|
-
client
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_invalid
|
34
|
-
invalid
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class SoapServer < ClientTest::AbstractServer
|
39
|
-
def create_clientlet(controller)
|
40
|
-
SoapClientLet.new(controller)
|
41
|
-
end
|
42
|
-
|
43
|
-
def server_port
|
44
|
-
PORT
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class TC_ClientSoap < Test::Unit::TestCase
|
50
|
-
include ClientTest
|
51
|
-
include ClientSoapTest
|
52
|
-
|
53
|
-
fixtures :users
|
54
|
-
|
55
|
-
def setup
|
56
|
-
@server = SoapServer.instance
|
57
|
-
@container = @server.container
|
58
|
-
@client = ActionWebService::Client::Soap.new(API, "http://localhost:#{@server.server_port}/client/api")
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_void
|
62
|
-
assert(@container.value_void.nil?)
|
63
|
-
@client.void
|
64
|
-
assert(!@container.value_void.nil?)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_normal
|
68
|
-
assert(@container.value_normal.nil?)
|
69
|
-
assert_equal(5, @client.normal(5, 6))
|
70
|
-
assert_equal([5, 6], @container.value_normal)
|
71
|
-
assert_equal(5, @client.normal("7", "8"))
|
72
|
-
assert_equal([7, 8], @container.value_normal)
|
73
|
-
assert_equal(5, @client.normal(true, false))
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_array_return
|
77
|
-
assert(@container.value_array_return.nil?)
|
78
|
-
new_person = Person.new
|
79
|
-
new_person.firstnames = ["one", "two"]
|
80
|
-
new_person.lastname = "last"
|
81
|
-
assert_equal([new_person], @client.array_return)
|
82
|
-
assert_equal([new_person], @container.value_array_return)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_struct_pass
|
86
|
-
assert(@container.value_struct_pass.nil?)
|
87
|
-
new_person = Person.new
|
88
|
-
new_person.firstnames = ["one", "two"]
|
89
|
-
new_person.lastname = "last"
|
90
|
-
assert_equal(true, @client.struct_pass([new_person]))
|
91
|
-
assert_equal([[new_person]], @container.value_struct_pass)
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_nil_struct_return
|
95
|
-
assert_nil @client.nil_struct_return
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_inner_nil
|
99
|
-
outer = @client.inner_nil
|
100
|
-
assert_equal 'outer', outer.name
|
101
|
-
assert_nil outer.inner
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_client_container
|
105
|
-
assert_equal(50, ClientContainer.new.get_client.client_container)
|
106
|
-
assert(ClientContainer.new.get_invalid.nil?)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_named_parameters
|
110
|
-
assert(@container.value_named_parameters.nil?)
|
111
|
-
assert(@client.named_parameters("key", 5).nil?)
|
112
|
-
assert_equal(["key", 5], @container.value_named_parameters)
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_capitalized_method_name
|
116
|
-
@container.value_normal = nil
|
117
|
-
assert_equal(5, @client.Normal(5, 6))
|
118
|
-
assert_equal([5, 6], @container.value_normal)
|
119
|
-
@container.value_normal = nil
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_model_return
|
123
|
-
user = @client.user_return
|
124
|
-
assert_equal 1, user.id
|
125
|
-
assert_equal 'Kent', user.name
|
126
|
-
assert user.active?
|
127
|
-
assert_kind_of Date, user.created_on
|
128
|
-
assert_equal Date.today, user.created_on
|
129
|
-
assert_equal BigDecimal('12.2'), user.balance
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_with_model
|
133
|
-
with_model = @client.with_model_return
|
134
|
-
assert_equal 'Kent', with_model.user.name
|
135
|
-
assert_equal 2, with_model.users.size
|
136
|
-
with_model.users.each do |user|
|
137
|
-
assert_kind_of User, user
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_scoped_model_return
|
142
|
-
scoped_model = @client.scoped_model_return
|
143
|
-
assert_kind_of Accounting::User, scoped_model
|
144
|
-
assert_equal 'Kent', scoped_model.name
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_multi_dim_return
|
148
|
-
md_struct = @client.multi_dim_return
|
149
|
-
assert_kind_of Array, md_struct.pref
|
150
|
-
assert_equal 2, md_struct.pref.size
|
151
|
-
assert_kind_of Array, md_struct.pref[0]
|
152
|
-
end
|
153
|
-
end
|
@@ -1,152 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/abstract_client'
|
2
|
-
|
3
|
-
|
4
|
-
module ClientXmlRpcTest
|
5
|
-
PORT = 8999
|
6
|
-
|
7
|
-
class XmlRpcClientLet < ClientTest::AbstractClientLet
|
8
|
-
def do_POST(req, res)
|
9
|
-
test_request = ActionController::TestRequest.new
|
10
|
-
test_request.request_parameters['action'] = req.path.gsub(/^\//, '').split(/\//)[1]
|
11
|
-
test_request.env['REQUEST_METHOD'] = "POST"
|
12
|
-
test_request.env['HTTP_CONTENT_TYPE'] = 'text/xml'
|
13
|
-
test_request.env['RAW_POST_DATA'] = req.body
|
14
|
-
response = ActionController::TestResponse.new
|
15
|
-
@controller.process(test_request, response)
|
16
|
-
res.header['content-type'] = 'text/xml'
|
17
|
-
res.body = response.body
|
18
|
-
# puts res.body
|
19
|
-
rescue Exception => e
|
20
|
-
$stderr.puts e.message
|
21
|
-
$stderr.puts e.backtrace.join("\n")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class ClientContainer < ActionController::Base
|
26
|
-
web_client_api :client, :xmlrpc, "http://localhost:#{PORT}/client/api", :api => ClientTest::API
|
27
|
-
|
28
|
-
def get_client
|
29
|
-
client
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class XmlRpcServer < ClientTest::AbstractServer
|
34
|
-
def create_clientlet(controller)
|
35
|
-
XmlRpcClientLet.new(controller)
|
36
|
-
end
|
37
|
-
|
38
|
-
def server_port
|
39
|
-
PORT
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class TC_ClientXmlRpc < Test::Unit::TestCase
|
45
|
-
include ClientTest
|
46
|
-
include ClientXmlRpcTest
|
47
|
-
|
48
|
-
fixtures :users
|
49
|
-
|
50
|
-
def setup
|
51
|
-
@server = XmlRpcServer.instance
|
52
|
-
@container = @server.container
|
53
|
-
@client = ActionWebService::Client::XmlRpc.new(API, "http://localhost:#{@server.server_port}/client/api")
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_void
|
57
|
-
assert(@container.value_void.nil?)
|
58
|
-
@client.void
|
59
|
-
assert(!@container.value_void.nil?)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_normal
|
63
|
-
assert(@container.value_normal.nil?)
|
64
|
-
assert_equal(5, @client.normal(5, 6))
|
65
|
-
assert_equal([5, 6], @container.value_normal)
|
66
|
-
assert_equal(5, @client.normal("7", "8"))
|
67
|
-
assert_equal([7, 8], @container.value_normal)
|
68
|
-
assert_equal(5, @client.normal(true, false))
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_array_return
|
72
|
-
assert(@container.value_array_return.nil?)
|
73
|
-
new_person = Person.new
|
74
|
-
new_person.firstnames = ["one", "two"]
|
75
|
-
new_person.lastname = "last"
|
76
|
-
assert_equal([new_person], @client.array_return)
|
77
|
-
assert_equal([new_person], @container.value_array_return)
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_struct_pass
|
81
|
-
assert(@container.value_struct_pass.nil?)
|
82
|
-
new_person = Person.new
|
83
|
-
new_person.firstnames = ["one", "two"]
|
84
|
-
new_person.lastname = "last"
|
85
|
-
assert_equal(true, @client.struct_pass([new_person]))
|
86
|
-
assert_equal([[new_person]], @container.value_struct_pass)
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_nil_struct_return
|
90
|
-
assert_equal false, @client.nil_struct_return
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_inner_nil
|
94
|
-
outer = @client.inner_nil
|
95
|
-
assert_equal 'outer', outer.name
|
96
|
-
assert_nil outer.inner
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_client_container
|
100
|
-
assert_equal(50, ClientContainer.new.get_client.client_container)
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_named_parameters
|
104
|
-
assert(@container.value_named_parameters.nil?)
|
105
|
-
assert_equal(false, @client.named_parameters("xxx", 7))
|
106
|
-
assert_equal(["xxx", 7], @container.value_named_parameters)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_exception
|
110
|
-
assert_raises(ActionWebService::Client::ClientError) do
|
111
|
-
assert(@client.thrower)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_invalid_signature
|
116
|
-
assert_raises(ArgumentError) do
|
117
|
-
@client.normal
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_model_return
|
122
|
-
user = @client.user_return
|
123
|
-
assert_equal 1, user.id
|
124
|
-
assert_equal 'Kent', user.name
|
125
|
-
assert user.active?
|
126
|
-
assert_kind_of Time, user.created_on
|
127
|
-
assert_equal Time.utc(Time.now.year, Time.now.month, Time.now.day), user.created_on
|
128
|
-
assert_equal BigDecimal('12.2'), user.balance
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_with_model
|
132
|
-
with_model = @client.with_model_return
|
133
|
-
assert_equal 'Kent', with_model.user.name
|
134
|
-
assert_equal 2, with_model.users.size
|
135
|
-
with_model.users.each do |user|
|
136
|
-
assert_kind_of User, user
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_scoped_model_return
|
141
|
-
scoped_model = @client.scoped_model_return
|
142
|
-
assert_kind_of Accounting::User, scoped_model
|
143
|
-
assert_equal 'Kent', scoped_model.name
|
144
|
-
end
|
145
|
-
|
146
|
-
def test_multi_dim_return
|
147
|
-
md_struct = @client.multi_dim_return
|
148
|
-
assert_kind_of Array, md_struct.pref
|
149
|
-
assert_equal 2, md_struct.pref.size
|
150
|
-
assert_kind_of Array, md_struct.pref[0]
|
151
|
-
end
|
152
|
-
end
|