def increment(self, event, count, timestamp=None):
     tsdb.record(
         tsdb.models.users_affected_by_group,
         event.group_id,
         [next(self.sequence) for _ in xrange(0, count)],
         timestamp=timestamp
     )
Beispiel #2
0
    def test_user_rate_reached(self, mock_now):
        mock_now.return_value = datetime(2016, 8, 1, 0, 0, 0, 0, tzinfo=timezone.utc)

        snooze = GroupSnooze.objects.create(
            group=self.group,
            user_count=100,
            user_window=60,
        )
        tsdb.record(
            tsdb.models.users_affected_by_group,
            self.group.id,
            [next(self.sequence) for _ in xrange(0, 101)],
        )
        assert not snooze.is_valid(test_rates=True)
Beispiel #3
0
    def test_user_rate_reached(self, mock_now):
        mock_now.return_value = datetime(2016, 8, 1, 0, 0, 0, 0, tzinfo=timezone.utc)

        snooze = GroupSnooze.objects.create(
            group=self.group,
            user_count=100,
            user_window=60,
        )
        tsdb.record(
            tsdb.models.users_affected_by_group,
            self.group.id,
            [next(self.sequence) for _ in xrange(0, 101)],
        )
        assert not snooze.is_valid(test_rates=True)
 def increment(self, event, count, environment_id, timestamp=None):
     tsdb.record(tsdb.models.users_affected_by_group,
                 event.group_id,
                 [next(self.sequence) for _ in xrange(0, count)],
                 environment_id=environment_id,
                 timestamp=timestamp)