Issue #103 - Integration tests for sign up resource#128
Issue #103 - Integration tests for sign up resource#128omatheusmesmo wants to merge 7 commits intomcruzdev:mainfrom
Conversation
|
Thanks for this pull request @omatheusmesmo, looks great, could you check the pipeline issue? I think it is related to the code style |
db1f22e to
c404aa9
Compare
@mcruzdev , I fixed the code style issue, could you check again? Thanks. |
|
Hi @omatheusmesmo could you rebase and to solve the imports? |
eb4a159 to
80ec451
Compare
Hi, could you check again please? Thanks. |
|
The pipeline error is related to the code style. Try to execute the following goal: net.revelc.code:impsort-maven-plugin:1.12.0:sort |
767a9e3 to
83c334b
Compare
|
Thanks for the support @mcruzdev , I correct the imports order and added a test for phone number too. Could you please approve the workflows runs again? |
|
cc: @omatheusmesmo, Hello Matheus, All very well? Well, if you'll allow me... This error in the pipeline is related to OpenAPI, even though the test class hasn't been modified. The simplest way is to put, I believe, this: quarkus.langchain4j.openai.enabled=false We should have a standard for this, to guarantee good testing standards, since there can be various test cases, test containers, etc., an isolated database for testing, possibly containing a src/test/resources/application.properties file. |
Hello, @mcruzdev, I hope you are doing well. Could you please share your thoughts on @matheusandre1 's message? |
|
Sorry for delays guys, I was so busy in the last weeks. I agree with @matheusandre1 about to disable the But the better approach is to run ollama locally during integration tests on Github Actions (we should do it in another issue/PR), for now I think we can disable it through |
|
I created the issue. If you want, feel free to try it after this one @omatheusmesmo :) |
|
@omatheusmesmo Can you rebase this? |
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
# Conflicts: # timeless-api/src/main/java/dev/matheuscruz/presentation/SignUpResource.java diff --git c/timeless-api/src/main/java/dev/matheuscruz/presentation/SignUpResource.java i/timeless-api/src/main/java/dev/matheuscruz/presentation/SignUpResource.java index 224eec6..8b42abb 100644 --- c/timeless-api/src/main/java/dev/matheuscruz/presentation/SignUpResource.java +++ i/timeless-api/src/main/java/dev/matheuscruz/presentation/SignUpResource.java @@ -4,10 +4,9 @@ import dev.matheuscruz.domain.User; import dev.matheuscruz.domain.UserRepository; import dev.matheuscruz.infra.security.AESAdapter; import dev.matheuscruz.infra.security.BCryptAdapter; -import dev.matheuscruz.presentation.data.ProblemResponse; +import dev.matheuscruz.presentation.data.Problem; import io.quarkus.logging.Log; import io.quarkus.narayana.jta.QuarkusTransaction; -import jakarta.annotation.security.PermitAll; import jakarta.validation.Valid; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; @@ -17,7 +16,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.core.Response; @path("/api/sign-up") -@permitAll public class SignUpResource { UserRepository userRepository; @@ -35,11 +33,10 @@ public class SignUpResource { boolean exists = this.userRepository.existsByEmail(req.email()); if (exists) { return Response.status(Response.Status.CONFLICT) - .entity(new ProblemResponse("Este nome de usuário já foi usado. Tente outro.")).build(); + .entity(new Problem("Este nome de usuário já foi usado. Tente outro.")).build(); } - User user = User.create(req.email(), BCryptAdapter.encrypt(req.password()), req.firstName(), req.lastName(), - req.phoneNumber()); + User user = User.create(req.email(), BCryptAdapter.encrypt(req.password()), req.firstName(), req.lastName()); QuarkusTransaction.requiringNew().run(() -> { this.userRepository.persist(user); @@ -49,8 +46,8 @@ public class SignUpResource { .build(); } - public record SignUpRequest(@Email String email, @notblank @SiZe(min = 8, max = 32) String password, - @notblank String firstName, @notblank String lastName, @notblank String phoneNumber) { + public record SignUpRequest(@notblank @Email String email, @notblank @SiZe(min = 8, max = 32) String password, + @notblank String firstName, @notblank String lastName) { } public record SignUpResponse(String id, String email) { Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
diff --git c/timeless-api/src/main/resources/application.properties i/timeless-api/src/main/resources/application.properties index f7cc93b..ab0eae2 100644 --- c/timeless-api/src/main/resources/application.properties +++ i/timeless-api/src/main/resources/application.properties @@ -33,4 +33,19 @@ quarkus.quinoa.build-dir=dist/timeless/browser # jwt mp.jwt.verify.publickey=${JWT_PUBLIC_KEY} mp.jwt.verify.issuer=https://timelessapp.platformoon.com/issuer -smallrye.jwt.sign.key=${JWT_PRIVATE_KEY} \ No newline at end of file +smallrye.jwt.sign.key=${JWT_PRIVATE_KEY} + +# Test Profile +%test.security.sensible.secret=YS0xNi1ieXRlLXNlY3JldA== +%test.whatsapp.incoming-messages.queue-url=test-incoming-queue +%test.whatsapp.messages-processed.queue-url=test-processed-queue + +%test.quarkus.sqs.aws.credentials.static-provider.access-key-id=test +%test.quarkus.sqs.aws.credentials.static-provider.secret-access-key=test +%test.quarkus.sqs.aws.credentials.type=STATIC +%test.quarkus.sqs.aws.region=us-east-1 +%test.quarkus.sqs.endpoint-override=http://127.0.0.1:4566 + +%quarkus.test.arg-line=--add-opens java.base/java.lang=ALL-UNNAMED + +%test.quarkus.scheduler.enabled=false Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
…umber in SignUpRequest Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
…n.properties Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
…nd responses Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
…efault placeholder for API key Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
83c334b to
0772d59
Compare
|
Hi @matheusandre1, thanks for the suggestion! I added |
Hello,
I have followed the guidelines outlined in CONTRIBUTING.md.
Please let me know if any modifications are required.
This pull request fixes #103.