Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Oct 18, 2024
1 parent bd64fdf commit 07642c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/seatsio/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def put_up_for_resale(event_key_or_keys, object_or_objects)
end

def change_object_status(event_key_or_keys, object_or_objects, status, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil, allowed_previous_statuses: nil, rejected_previous_statuses: nil)
request = create_change_object_status_request(CHANGE_STATUS_TO, object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses)
request = create_change_object_status_request(Seatsio::StatusChangeType::CHANGE_STATUS_TO, object_or_objects, status, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, allowed_previous_statuses, rejected_previous_statuses)
request[:params] = {
:expand => 'objects'
}
Expand Down Expand Up @@ -117,7 +117,7 @@ def hold_best_available(key, number, hold_token, categories: nil, order_id: nil,
end

def release(event_key_or_keys, object_or_objects, hold_token: nil, order_id: nil, keep_extra_data: nil, ignore_channels: nil, channel_keys: nil)
request = create_change_object_status_request(RELEASE, object_or_objects, nil, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, nil, nil)
request = create_change_object_status_request(Seatsio::StatusChangeType::RELEASE, object_or_objects, nil, hold_token, order_id, event_key_or_keys, keep_extra_data, ignore_channels, channel_keys, nil, nil)
request[:params] = {
:expand => 'objects'
}
Expand Down
2 changes: 1 addition & 1 deletion lib/seatsio/events/change_object_status_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def create_change_object_status_request(type, object_or_objects, status, hold_to
result[:type] = type
result[:objects] = normalize(object_or_objects)
result[:type] = type
result[:status] = status if type != RELEASE
result[:status] = status if type != Seatsio::StatusChangeType::RELEASE
result[:holdToken] = hold_token if hold_token != nil
result[:orderId] = order_id if order_id != nil
if event_key_or_keys.is_a? Array
Expand Down
8 changes: 6 additions & 2 deletions test/events/change_object_status_in_batch_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ def test_change_object_status_in_batch
chart_key2 = create_test_chart
event2 = @seatsio.events.create chart_key: chart_key2

res = @seatsio.events.change_object_status_in_batch([{ :event => event1.key, :objects => ['A-1'], :status => 'foo' }, { :event => event2.key, :objects => ['A-2'], :status => 'fa' }])
res = @seatsio.events.change_object_status_in_batch(
[
{ :type => Seatsio::StatusChangeType::CHANGE_STATUS_TO, :event => event1.key, :objects => ['A-1'], :status => 'foo' },
{ :event => event2.key, :objects => ['A-2'], :status => 'fa' }
])

assert_equal('foo', res[0].objects['A-1'].status)
assert_equal('foo', @seatsio.events.retrieve_object_info(key: event1.key, label: 'A-1').status)
Expand Down Expand Up @@ -85,7 +89,7 @@ def release_in_batch
event = @seatsio.events.create chart_key: chart_key
@seatsio.events.book(event.key, ['A-1'])

res = @seatsio.events.change_object_status_in_batch([{ :type => RELEASE, :event => event.key, :objects => ['A-1'] }])
res = @seatsio.events.change_object_status_in_batch([{ :type => Seatsio::StatusChangeType::RELEASE, :event => event.key, :objects => ['A-1'] }])

assert_equal(Seatsio::EventObjectInfo::FREE, res[0].objects['A-1'].status)
assert_equal(Seatsio::EventObjectInfo::FREE, @seatsio.events.retrieve_object_info(key: event.key, label: 'A-1').status)
Expand Down

0 comments on commit 07642c4

Please sign in to comment.