Example #1
0
    def test_filter_feedback_multiple_latest_not_received(self):
        now = timezone.now()

        FeedbackFactory.create(
            _signal=self.signals[0],
            is_satisfied=True,
            submitted_at=now - timedelta(days=1)
        )

        feedback_negative = FeedbackFactory.create(
            _signal=self.signals[0]
        )

        params = {'feedback': 'not_satisfied'}
        result_ids = self._request_filter_signals(params)
        self.assertEqual(0, len(result_ids))

        params = {'feedback': 'satisfied'}
        result_ids = self._request_filter_signals(params)
        self.assertEqual(0, len(result_ids))

        params = {'feedback': 'not_received'}
        result_ids = self._request_filter_signals(params)

        self.assertEqual(1, len(result_ids))
        self.assertEqual(feedback_negative._signal_id, result_ids[0])
Example #2
0
 def setUp(self):
     self.signal = SignalFactory.create()
     self.feedback_submitted = FeedbackFactory.create(
         _signal=self.signal,
         created_at=datetime(2019, 4, 9, 12, 0, tzinfo=pytz.UTC),
         submitted_at=datetime(2019, 4, 9, 18, 0, 0, tzinfo=pytz.UTC),
         text='Tevreden want mooi weer',
         text_extra='Waarom? Daarom!')
     self.feedback_requested = FeedbackFactory.create(
         _signal=self.signal,
         created_at=datetime(2019, 4, 9, 12, 0, 0),
     )
     self.csv_tmp_dir = tempfile.mkdtemp()
Example #3
0
    def test_filter_feedback_not_received(self):
        feedback = FeedbackFactory.create(_signal=self.signals[0])

        params = {'feedback': 'not_received'}
        result_ids = self._request_filter_signals(params)

        self.assertEqual(1, len(result_ids))
        self.assertEqual(feedback._signal_id, result_ids[0])
Example #4
0
    def test_filter_feedback_negative_feedback(self):
        feedback = FeedbackFactory.create(_signal=self.signals[0],
                                          is_satisfied=False,
                                          submitted_at=timezone.now())

        params = {'feedback': 'not_satisfied'}
        result_ids = self._request_filter_signals(params)

        self.assertEqual(1, len(result_ids))
        self.assertEqual(feedback._signal_id, result_ids[0])