コード例 #1
0
    def test_extra_data(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)
        props1 = ObjectProperties("A-1", extra_data={"foo": "bar"})
        props2 = ObjectProperties("A-2", extra_data={"foo": "baz"})

        self.client.events.change_object_status(event.key, [props1, props2],
                                                "status_foo")

        assert_that(
            self.client.events.retrieve_object_info(
                event.key, "A-1").extra_data).is_equal_to({"foo": "bar"})
        assert_that(
            self.client.events.retrieve_object_info(
                event.key, "A-2").extra_data).is_equal_to({"foo": "baz"})
コード例 #2
0
    def test_quantity(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)
        props1 = ObjectProperties("GA1", quantity=5)
        props2 = ObjectProperties("GA2", quantity=10)

        self.client.events.change_object_status(event.key, [props1, props2],
                                                "status_foo")

        assert_that(
            self.client.events.retrieve_object_info(
                event.key, "GA1").num_booked).is_equal_to(5)
        assert_that(
            self.client.events.retrieve_object_info(
                event.key, "GA2").num_booked).is_equal_to(10)
コード例 #3
0
    def test_tickettype(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)
        props1 = ObjectProperties("A-1", ticket_type="Ticket Type 1")
        props2 = ObjectProperties("A-2", ticket_type="Ticket Type 2")

        self.client.events.change_object_status(event.key, [props1, props2],
                                                "status_foo")

        status1 = self.client.events.retrieve_object_info(event.key, "A-1")
        assert_that(status1.status).is_equal_to("status_foo")
        assert_that(status1.ticket_type).is_equal_to("Ticket Type 1")

        status2 = self.client.events.retrieve_object_info(event.key, "A-2")
        assert_that(status2.status).is_equal_to("status_foo")
        assert_that(status2.ticket_type).is_equal_to("Ticket Type 2")
コード例 #4
0
    def test_keepExtraData(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)
        extra_data = {"foo": "bar"}
        self.client.events.book(
            event.key, [ObjectProperties("A-1", extra_data=extra_data)])

        self.client.events.release(event.key, ["A-1"], keep_extra_data=True)

        object_info = self.client.events.retrieve_object_info(event.key, "A-1")
        assert_that(object_info.extra_data).is_equal_to(extra_data)
コード例 #5
0
    def test_deepSummaryByChannel(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)

        self.client.events.book(event.key, [ObjectProperties("A-1", ticket_type="tt1")], order_id="order1")

        report = self.client.events.reports.deep_summary_by_channel(event.key)

        assert_that(report.get("NO_CHANNEL").get("count")).is_equal_to(232)
        assert_that(report.get("NO_CHANNEL").get("byCategoryLabel").get("Cat1").get("count")).is_equal_to(116)
        assert_that(report.get("NO_CHANNEL").get("byCategoryLabel").get("Cat1").get("bySection").get("NO_SECTION")).is_equal_to(116)
コード例 #6
0
    def test_deepSummaryByStatus(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)

        self.client.events.book(event.key, [ObjectProperties("A-1", ticket_type="tt1")], order_id="order1")

        report = self.client.events.reports.deep_summary_by_status(event.key)

        assert_that(report.get("booked").get("count")).is_equal_to(1)
        assert_that(report.get("booked").get("bySection").get("NO_SECTION").get("count")).is_equal_to(1)
        assert_that(report.get("booked").get("bySection").get("NO_SECTION").get("byAvailability").get("not_available")).is_equal_to(1)
コード例 #7
0
 def __normalize_objects(self, object_or_objects):
     if isinstance(object_or_objects, list):
         if len(object_or_objects) == 0:
             return []
         if isinstance(object_or_objects[0], ObjectProperties):
             return object_or_objects
         if isinstance(object_or_objects[0], basestring):
             result = []
             for o in object_or_objects:
                 result.append(ObjectProperties(o))
             return result
         else:
             raise Exception("Unsupported type " +
                             str(type(object_or_objects[0])))
     return self.__normalize_objects([object_or_objects])
コード例 #8
0
    def test_summaryBySection(self):
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)

        self.client.events.book(event.key, [ObjectProperties("A-1", ticket_type="tt1")], order_id="order1")

        report = self.client.events.reports.summary_by_section(event.key)

        assert_that(report.get("NO_SECTION").get("count")).is_equal_to(232)
        assert_that(report.get("NO_SECTION").get("byStatus").get("booked")).is_equal_to(1)
        assert_that(report.get("NO_SECTION").get("byStatus").get("free")).is_equal_to(231)
        assert_that(report.get("NO_SECTION").get("byCategoryKey").get("9")).is_equal_to(116)
        assert_that(report.get("NO_SECTION").get("byCategoryKey").get("10")).is_equal_to(116)
        assert_that(report.get("NO_SECTION").get("byCategoryLabel").get("Cat1")).is_equal_to(116)
        assert_that(report.get("NO_SECTION").get("byCategoryLabel").get("Cat2")).is_equal_to(116)
        assert_that(report.get("NO_SECTION").get("byChannel").get("NO_CHANNEL")).is_equal_to(232)
コード例 #9
0
    def test_propertiesOfStatusChange(self):
        now = datetime.utcnow()
        chart_key = self.create_test_chart()
        event = self.client.events.create(chart_key)
        object_properties = ObjectProperties("A-1", {"foo": "bar"})
        self.client.events.change_object_status(event.key,
                                                object_properties,
                                                "status1",
                                                order_id="order1")

        status_changes = self.client.events.status_changes(event.key).list()
        status_change = status_changes[0]

        assert_that(status_change.id).is_not_zero()
        assert_that(status_change.date).is_between_now_minus_and_plus_minutes(
            now, 1)
        assert_that(status_change.status).is_equal_to("status1")
        assert_that(status_change.object_label).is_equal_to("A-1")
        assert_that(status_change.event_id).is_equal_to(event.id)
        assert_that(status_change.extra_data).is_equal_to({"foo": "bar"})
        assert_that(status_change.origin.type).is_equal_to("API_CALL")
        assert_that(status_change.origin.ip).is_not_none()
        assert_that(status_change.is_present_on_chart).is_true()
        assert_that(status_change.not_present_on_chart_reason).is_none()