Skip to content

Commit

Permalink
Merge pull request #56 from MiguelFerreira18/Quick_Fix_
Browse files Browse the repository at this point in the history
fix: quick fix in the delivery
  • Loading branch information
P0RTW0N authored Jun 9, 2024
2 parents 7358540 + dd4eaa0 commit 05a3d02
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class EncomendaDTOSaveRequest {
@Positive
private Long pacoteId;
@NotNull
@Positive
private String userId;

private Estado estado;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers("/tipoPacote/**").authenticated()
.requestMatchers("/encomenda/**").authenticated()
.requestMatchers("/user/info/**").authenticated()
.requestMatchers("/encomenda/**").authenticated()
.requestMatchers("/user/delete/data").authenticated()
.requestMatchers("/tipoReceita/**").authenticated()
.requestMatchers("/receita/**").authenticated()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import isep.ipp.pt.api.desofs.Model.TipoPacote;
import isep.ipp.pt.api.desofs.Model.UserModel.Role;
import isep.ipp.pt.api.desofs.Model.UserModel.User;
import isep.ipp.pt.api.desofs.Repository.Interface.EncomendaServiceRepo;
import isep.ipp.pt.api.desofs.Repository.Interface.PacoteServiceRepo;
import isep.ipp.pt.api.desofs.Repository.Interface.TipoPacoteServiceRepo;
import isep.ipp.pt.api.desofs.Repository.Interface.UserServiceRepo;
import isep.ipp.pt.api.desofs.Repository.Interface.*;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
Expand Down Expand Up @@ -49,9 +46,16 @@ public class EncomendaServiceImpltest {
@Autowired
private EncomendaService encomendaService;

@Autowired
private ReviewServiceRepo reviewServiceRepo;
@Autowired
private ReceitaServiceRepo receitaServiceRepo;

private Validator validator;
@BeforeEach
public void populate() {
receitaServiceRepo.deleteAll();
reviewServiceRepo.deleteAll();
encomendaRepo.deleteAll();
pacoteRepo.deleteAll();
userRepo.deleteAll();
Expand All @@ -68,14 +72,6 @@ public void populate() {
validator = validatorFactory.getValidator();
}

@AfterEach
public void clean() {
encomendaRepo.deleteAll();
pacoteRepo.deleteAll();
userRepo.deleteAll();
tipoPacoteRepo.deleteAll();
}

@ParameterizedTest
@CsvSource({
"1, 5, 10, pacote, REGISTADO, [email protected],2024-05-07T08:30:00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,4 @@ public void testSecurityVulnerabilitiesForPacoteID(Long pacoteId) {
assertFalse(violations.isEmpty());
}

@ParameterizedTest
@CsvSource(textBlock =
"""
0
-6
-1
-3
-7
-8
-9
-996
-1325
""")
@DisplayName("Test security vulnerabilities for User ID")
public void testSecurityVulnerabilitiesForUserId(String userId) {
EncomendaDTOSaveRequest response = new EncomendaDTOSaveRequest(2, 2, 2, LocalDateTime.now(),1L, Estado.REGISTADO, userId);
Set<ConstraintViolation<EncomendaDTOSaveRequest>> violations = validator.validate(response);
assertFalse(violations.isEmpty());
}

}

0 comments on commit 05a3d02

Please sign in to comment.