-
  Give the access rights of Event user to organize an event and also do registration.
-
  !context
    uid: 'res_users_eventuser'
-
  I want to organize an event, into this conference I should create two registration.
  One confirmed and attended the event and the other cancelled.

  I create an event
-
  !record {model: event.event, id: event_event}:
    name: event
    date_begin: 2012-01-01 19:05:15
    date_end: 2012-01-01 20:05:15
    seats_max: 10
-
  I create a registration for the event
-
  !record {model: event.registration, id: event_registration1}:
    event_id: event_event
    name: test_confirm
    nb_register: 10
-
  I create a second registration for the same event
-
  !record {model: event.registration, id: event_registration2}:
    event_id: event_event
    name: test_cancel
    nb_register: 5
-
  I check if the number of draft registrations in the event view is correct
-
  !assert {model: event.event, id: event_event, string: 'the number of draft registration is not correct'}:
    - seats_unconfirmed == 15.00
-
  I confirm the registration1
-
  !python {model: event.registration, id: event_registration1}: |
    self.registration_open()
-
  I check that registration is "confirmed"
-
  !assert {model: event.registration, id: event_registration1}:
    - state == 'open', "registration should be confirmed."
-
  I check if the number of confirmed registration is correct
-
  !assert {model: event.event, id: event_event,string: 'the number of confirmed registration is not correct'}:
    - seats_reserved == 10.00
-
  I close the registration
-
  !python {model: event.registration, id: event_registration1}: |
    self.button_reg_close()
-
  I check if registration is correctly finnished
-
  !assert {model: event.registration, id: event_registration1}:
    - state == 'done'
-
  I check if attended registration is correct
-
  !assert {model: event.event, id: event_event, string: 'the number of registration that attended the event is not correct'}:
    - seats_used == 10.00
-
  I cancel the second registration
-
  !python {model: event.registration, id: event_registration2}: |
    self.button_reg_cancel()
-
  I Check that registration is cancelled
-
  !assert {model: event.registration, id: event_registration2}:
    - state == 'cancel', "Registration should be cancelled."
-
  I confirm the event
-
  !python {model: event.event, id: event_event}: |
    self.button_confirm()
-
  I check that event is in "confirmed" state.
-
  !assert {model: event.event, id: event_event}:
    - state == 'confirm', "event should be confirmed."
-
  I close the event
-
  !python {model: event.event, id: event_event}: |
    self.button_done()
-
  Check that event is in "close" state.
-
  !assert {model: event.event, id: event_event}:
    - state == 'done', "Event should be Closed."
-
  I reset event to draft
-
  !python {model: event.event, id: event_event}: |
    self.button_draft()
-
  In order to test the cancellation of the event, I create a second event
-
  !record {model: event.event, id: event_event1}:
    name: event_cancel
    date_begin: 2012-01-01 19:05:15
    date_end: 2012-01-01 20:05:15
-
  I create a registration for the event
-
  !record {model: event.registration, id: event_registration_cancel}:
    event_id: event_event1
    name: test_confirm_again
    nb_register: 5
-
  Now I cancel this event
-
  !python {model: event.event, id: event_event1}: |
    self.button_cancel()
-
  I check if the event is cancelled
-
  !assert {model: event.event, id: event_event1}:
    - state == 'cancel', "Event should be cancelled."
-
  I check if its registrations are cancelled too
-
  !assert {model: event.registration, id: event_registration_cancel}:
    - state == 'cancel', "Registration should be cancelled."
