def test_get_filtered_devices_queryset_on_user(self):
        for i in range(0, 3):
            get_user_model().objects.create_user(
                username=i % 'test_user_%d',
                email='test_user_%d@django-pushy.com' % i,
                password=i
            )

        user1 = get_user_model().objects.get(pk=1)
        user2 = get_user_model().objects.get(pk=2)

        # Add 5 devices to user2
        for i in range(0, 5):
            Device.objects.create(
                key='TEST_DEVICE_KEY_{}'.format(i),
                type=Device.DEVICE_TYPE_ANDROID,
                user=user2
            )

        # Check that user2 has 5 devices
        notification = PushNotification.objects.create(
            title='test',
            payload=self.payload,
            active=PushNotification.PUSH_ACTIVE,
            sent=PushNotification.PUSH_NOT_SENT,
            filter_user=user2.id
        )

        devices = get_filtered_devices_queryset(notification)

        self.assertEqual(devices.count(), 5)

        # Check that user 1 has no devices
        notification = PushNotification.objects.create(
            title='test',
            payload=self.payload,
            active=PushNotification.PUSH_ACTIVE,
            sent=PushNotification.PUSH_NOT_SENT,
            filter_user=user1.id
        )

        devices = get_filtered_devices_queryset(notification)

        self.assertEqual(devices.count(), 0)
dataset/ETHPy150Open rakanalh/django-pushy/tests/test_tasks.py/TasksTestCase.test_get_filtered_devices_queryset_on_user/swapped operands of `%`