Skip to content

Config — SecurityConfigTest: implementar tests de seguridad #62

@alopezdeharo

Description

@alopezdeharo

SecurityConfigTest.java existe pero está vacío (solo tiene el TODO).

Añadir @SpringBootTest, @AutoConfigureMockMvc y @Transactional. Inyectar MockMvc.

Tests a implementar:

  • GET /movies sin autenticar → status 200 (es pública)
  • GET /sessions sin autenticar → status 200 (es pública)
  • GET /salas sin autenticar → redirección al login (es de admin)
  • GET /movies/new sin autenticar → redirección al login
  • GET /movies/new con ROLE_ADMIN → status 200
  • GET /movies/new con ROLE_USER → status 403
  • GET /tickets sin autenticar → redirección al login (requiere autenticación)
  • GET /tickets con ROLE_USER → status 200

Usar @WithMockUser y .with(user(...).roles(...)) según el caso.
Referencia: ver MovieControllerTest y SecurityConfig.java.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingrelacionados con test y pruebas

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions