Beispiel #1
0
def grant_daily_free_stickers(user, force=False, count=knobs.DAILY_FREE_STICKERS):
    from canvas.notifications.actions import Actions

    if not user.is_authenticated():
        return

    if not force and not eligible_for_daily_free_stickers(user):
        return

    user.kv.daily_free_timestamp.set(time.time())
    user.kv.has_unseen_daily_free_stickers.set(True)

    user.kv.stickers.currency.increment(count)
    Actions.daily_free_stickers(user, count)
Beispiel #2
0
 def test_user_receives(self):
     user = utils.create_user()
     pn = Actions.daily_free_stickers(user, 5)
     ex = expander.get_expander(pn)()
     recipients = ex.decide_recipients(pn)
     self.assertEqual(len(recipients), 1)
     self.assertIn(user, recipients)
Beispiel #3
0
 def test_user_receives(self):
     user = utils.create_user()
     pn = Actions.daily_free_stickers(user, 5)
     ex = expander.get_expander(pn)()
     recipients = ex.decide_recipients(pn)
     self.assertEqual(len(recipients), 1)
     self.assertIn(user, recipients)