def test_get_context_data_deve_ter_breadcrumb(self, create, get_context_data): get_context_data.return_value = {} view = views.ResultadoInscricaoView() view.inscricao = mock.Mock() self.assertEqual(create.return_value, view.get_context_data()["breadcrumb"])
def test_has_permission_deve_ser_falso_se_nao_tiver_grupo_permissao_candidato_psct( self, has_permission): view = views.ResultadoInscricaoView() view.request = mock.Mock() view.inscricao = mock.Mock() has_permission.return_value = False view.inscricao.pode_ver_resultado_preliminar = True view.inscricao.is_owner.return_value = True self.assertFalse(view.has_permission())
def test_has_permission_deve_ser_verdadeiro_se_candidato_pode_ver_resultado_preliminar( self, has_permission): view = views.ResultadoInscricaoView() view.request = mock.Mock() view.inscricao = mock.Mock() has_permission.return_value = True view.inscricao.pode_ver_resultado_preliminar = True view.inscricao.is_owner.return_value = True self.assertTrue(view.has_permission())
def test_get_context_data_deve_ter_pontuacao(self, get_context_data): get_context_data.return_value = {} view = views.ResultadoInscricaoView() view.inscricao = mock.Mock() self.assertEqual(view.inscricao.get_extrato_pontuacao.return_value, view.get_context_data()["pontuacao"])
def test_setup_deve_lancar_404_se_id_resultado_nao_existe(self): view = views.ResultadoInscricaoView() request = mock.Mock() with self.assertRaises(Http404): view.setup(request, pk=999)
def test_setup_deveria_criar_atributo_inscricao_a_partir_do_pk( self, get_object_or_404): view = views.ResultadoInscricaoView() request = mock.Mock() view.setup(request, pk=1) self.assertEqual(get_object_or_404.return_value, view.inscricao)