def test_poll_list_use_case(sent, m_repo): m_repo.list.return_value = sent.entities_list uc = use_cases.PollListUseCase(m_repo) resp = uc.execute() assert resp == sent.entities_list m_repo.list.assert_called_once_with()
def list_polls(): uc = use_cases.PollListUseCase(repo_instances.poll_repo) polls = uc.execute() print('##') for question in polls: print('name:', question.name) print('choices:', [(ch.text, ch.votes) for ch in question.choices])
def poll_list(request): uc = use_cases.PollListUseCase(repo_instances.poll_repo) questions = uc.execute() return JsonResponse([q.dict() for q in questions], safe=False)
def polls_list(): uc = use_cases.PollListUseCase(repo_instances.poll_repo) questions = [q for q in uc.execute()] return jsonify(questions)
def list_polls() -> List[adapters.QuestionAdapter]: uc = use_cases.PollListUseCase(repo_instances.poll_repo) questions = uc.execute() return [adapters.QuestionAdapter.from_entity(q) for q in questions]