ECS 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ require 'test/unit'
4
+ require "#{File.expand_path( File.dirname( __FILE__ ) )}/../unit_test_setup"
5
+
6
+ class ECSOperationsTest < Test::Unit::TestCase
7
+ def setup
8
+ @@initial_operations = {} ; ECS::Operations.each { |ideal,actual| @@initial_operations[ideal] = actual }
9
+ ECS::Operations.clear
10
+ end
11
+ def teardown
12
+ @@initial_operations.each { |ideal,actual| ECS::Operations[ideal] = actual }
13
+ end
14
+
15
+ def test_exists
16
+ assert_nothing_raised do
17
+ ECS::Operations
18
+
19
+ end
20
+ end
21
+
22
+ def test_add
23
+ assert_equal nil, ECS::Operations[:AKlass]
24
+ assert_nothing_raised do
25
+ ECS::Operations['AKlass'] = Fixnum
26
+ end
27
+ assert_equal Fixnum, ECS::Operations[:AKlass]
28
+ assert_equal Fixnum, ECS::Operations['AKlass']
29
+ end
30
+
31
+
32
+ def test_clear
33
+ assert_equal 0, ECS::Operations.size
34
+ ECS::Operations['A'] = Fixnum
35
+ ECS::Operations['B'] = String
36
+ ECS::Operations['C'] = File
37
+
38
+ assert_equal 3, ECS::Operations.size
39
+ assert_nothing_raised do
40
+ ECS::Operations.clear
41
+ end
42
+ assert_equal 0, ECS::Operations.size
43
+ end
44
+
45
+ def test_each
46
+ ECS::Operations['A'] = Fixnum
47
+ ECS::Operations['B'] = String
48
+ ECS::Operations['C'] = File
49
+ assert_equal 3, ECS::Operations.size
50
+ ECS::Operations.each do |ideal,actual|
51
+ assert [ :A, :B, :C ].include?( ideal )
52
+ assert_equal Class, actual.class
53
+ end
54
+ end
55
+
56
+
57
+ def test_actual_class
58
+ ECS::Operations['A'] = "Fixnum"
59
+ assert_equal String, ECS::Operations[:A]
60
+ assert_equal String, ECS::Operations['A']
61
+
62
+ ECS::Operations['A'] = Fixnum
63
+ assert_equal Fixnum, ECS::Operations['A']
64
+ end
65
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ require 'test/unit'
4
+ require "#{File.expand_path( File.dirname( __FILE__ ) )}/../unit_test_setup"
5
+
6
+ class ECSResponseGroupsTest < Test::Unit::TestCase
7
+ def setup
8
+ end
9
+ def teardown
10
+ end
11
+
12
+ def test_inheritance
13
+ assert ECS::ResponseGroups.ancestors.include?( ECS::Operations )
14
+ end
15
+ end
@@ -0,0 +1,80 @@
1
+ #!/usr/local/bin/ruby
2
+
3
+ require 'test/unit'
4
+ require "#{File.expand_path( File.dirname( __FILE__ ) )}/../unit_test_setup"
5
+
6
+ ##NOTE
7
+ #
8
+ # Most of the assert_in_deltas below are bound by disk IO
9
+ # Adjust accordingly on your system.
10
+
11
+
12
+ class ECSTimeManagementTest < Test::Unit::TestCase
13
+ def setup
14
+ ECS::TimeManagement.time_file = File.join( ECStest.default_test_cache_directory, 'time_file' )
15
+ end
16
+ def teardown
17
+ ECS::TimeManagement.kill_time_file
18
+ end
19
+
20
+
21
+ def test_time_file
22
+ old_time_file = ECS::TimeManagement.time_file
23
+ f = File.expand_path( File.join( File.dirname( __FILE__ ), 'new_time_file' ) )
24
+ assert_nothing_raised do
25
+ ECS::TimeManagement.time_file = f
26
+ end
27
+
28
+ assert_equal f, ECS::TimeManagement.time_file
29
+
30
+ assert_raises RuntimeError do
31
+ ECS::TimeManagement.time_file = '/a/path/you/should/not/have/access/to'
32
+ end
33
+
34
+ File.unlink( f )
35
+ ECS::TimeManagement.time_file = old_time_file
36
+
37
+ assert !File.exist?( f )
38
+ assert ECS::TimeManagement.prepare_time_file( f )
39
+ assert File.exist?( f )
40
+ File.unlink( f )
41
+
42
+ assert !ECS::TimeManagement.prepare_time_file( '/a/path/you/should/not/have/access/to' )
43
+ end
44
+
45
+ def test_sleep_duration
46
+ t = Time.now.to_f
47
+ ECS::TimeManagement.next_available_timeslot = t + 10.0
48
+ n_ext = ECS::TimeManagement.next_available_timeslot
49
+ assert_in_delta ECS::TimeManagement.sleep_duration( false ), 10.0, 0.01
50
+
51
+ t = Time.now.to_f
52
+ ECS::TimeManagement.next_available_timeslot = t + 10.0
53
+ n_ext = ECS::TimeManagement.next_available_timeslot
54
+ assert_in_delta ECS::TimeManagement.sleep_duration( true ), 11.0, 0.01
55
+
56
+ t = Time.now.to_f
57
+ ECS::TimeManagement.next_available_timeslot = t + 10.0
58
+ assert_in_delta ECS::TimeManagement.sleep_duration, 11.0, 0.01
59
+ end
60
+
61
+ def test_next_available_timeslot
62
+ t = Time.now.to_f
63
+ assert_in_delta ECS::TimeManagement.next_available_timeslot, t, 0.01
64
+ assert_nothing_raised do
65
+ ECS::TimeManagement.next_available_timeslot = t + 10.0
66
+ end
67
+ assert_in_delta ECS::TimeManagement.next_available_timeslot - t, 10, 0.01
68
+ assert_nothing_raised do
69
+ ECS::TimeManagement.next_available_timeslot = t - 10.0
70
+ end
71
+ assert_in_delta t - ECS::TimeManagement.next_available_timeslot, 10, 0.01
72
+ end
73
+
74
+
75
+ def test_kill_time_file
76
+ assert_nothing_raised do
77
+ ECS::TimeManagement.kill_time_file
78
+ end
79
+ end
80
+ end
@@ -142,7 +142,7 @@ class ECSTest < Test::Unit::TestCase
142
142
  end
143
143
 
144
144
  def test_cache_directory
145
- testdir = File.expand_path( File.join( File.dirname( __FILE__ ), 'test' ) )
145
+ testdir = ECS.cache_directory + 'test'
146
146
 
147
147
  assert !File.exist?( testdir )
148
148
  assert_nothing_raised do
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ECS
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.5
7
- date: 2007-03-17 00:00:00 -07:00
6
+ version: 0.1.6
7
+ date: 2007-03-22 00:00:00 -07:00
8
8
  summary: A Ruby interface to Amazon's E-Commerce Service.
9
9
  require_paths:
10
10
  - lib
@@ -42,6 +42,12 @@ files:
42
42
  - test/unit/libxml_additions_test.rb
43
43
  - test/unit/string_additions_test.rb
44
44
  - test/unit/unit_test_setup.rb
45
+ - test/unit/ecs/help_response_group_test.rb
46
+ - test/unit/ecs/help_test.rb
47
+ - test/unit/ecs/operations_test.rb
48
+ - test/unit/ecs/response_groups_test.rb
49
+ - test/unit/ecs/time_management_test.rb
50
+ - test/unit/AWSECommerceService.wsdl
45
51
  - README
46
52
  - MIT-LICENSE
47
53
  - CHANGELOG
@@ -51,6 +57,12 @@ test_files:
51
57
  - test/unit/libxml_additions_test.rb
52
58
  - test/unit/string_additions_test.rb
53
59
  - test/unit/unit_test_setup.rb
60
+ - test/unit/ecs/help_response_group_test.rb
61
+ - test/unit/ecs/help_test.rb
62
+ - test/unit/ecs/operations_test.rb
63
+ - test/unit/ecs/response_groups_test.rb
64
+ - test/unit/ecs/time_management_test.rb
65
+ - test/unit/AWSECommerceService.wsdl
54
66
  rdoc_options: []
55
67
 
56
68
  extra_rdoc_files: