def get_context_data(self, **kwargs): board = get_object_or_404(Board, id=self.kwargs['pk']) return super().get_context_data( board=board, graded_cards=board.latest_graded_cards(), result_history=board.result_history(), token=MobileToken().ciphertext, safety_message=SafetyMessage.objects.first(), refresh_timer=settings.HUDDLE_BOARD_REFRESH_TIMER, **kwargs)
def test_token_built_from_random_string_is_invalid(self): some_arbitrary_string = 'AAADDwUCwQcNAA==' token = MobileToken(some_arbitrary_string) assert not token.is_valid()
def test_token_built_from_received_string_is_valid(self, a_token_string): token = MobileToken(a_token_string) assert token.is_valid()
def a_token_string(self): token = MobileToken() return token.ciphertext
def generate_token_from_datetime(self, datetime): with mock.patch('django.utils.timezone.now') as mock_now: mock_now.return_value = datetime token = MobileToken() return token
def a_token(self): return MobileToken()
def test_func(self): token = MobileToken(self.kwargs['token']) return token.is_valid()
def get_context_data(self, **kwargs): board = get_object_or_404(Board, id=self.kwargs['pk']) return super().get_context_data(board=board, token=MobileToken().ciphertext, **kwargs)