def test_unique_arguments_extracted(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertDictEqual(grabber.last.unique_arguments, {
            'unique_arg_key': 'unique_arg_value',
        })
    def test_event_parsed(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertEqual(len(grabber.events), 1)
    def test_empty_categories_is_empty_list(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne(category=None))
        psw.receive_events(request)

        self.assertEqual(grabber.last.categories, [])
    def test_multiple_categories_are_unchanged(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne(category=['c1', 'c2']))
        psw.receive_events(request)

        self.assertEqual(grabber.last.category, grabber.last.categories)
    def test_single_category_is_list_wrapped(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertEqual([grabber.last.category], grabber.last.categories)
    def test_correct_subclass(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertIsInstance(grabber.last, events.BounceEvent)
    def test_timestamp_parsed(self):
        grabber = self._createGrabber()
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertEqual(grabber.last.dt, self._create_dt())
    def test_unspecified_event_ignored(self):
        grabber = self._createGrabber(events.DeferredEvent)
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertEqual(len(grabber.events), 0)
    def test_specific_event_caught(self):
        grabber = self._createGrabber(events.BounceEvent)
        request = self._createRequest(self._makeOne())
        psw.receive_events(request)

        self.assertEqual(len(grabber.events), 1)