Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements tests for http endpoints in server module #152

Closed
salamonpavel opened this issue Jan 30, 2024 · 1 comment · Fixed by #162
Closed

Implements tests for http endpoints in server module #152

salamonpavel opened this issue Jan 30, 2024 · 1 comment · Fixed by #162
Assignees
Labels
tests QA/test-specific

Comments

@salamonpavel
Copy link
Collaborator

salamonpavel commented Jan 30, 2024

Background

Implement unit tests for http endpoints in server module. Depends on #151

Below is a piece of unfinished code. It requires dependency which is not compiled for Java 8.

lazy val tapirStubServer = tapirOrg %% "tapir-sttp-stub-server" % Versions.tapir % Test
package za.co.absa.atum.server.api.http

import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
import sttp.client3._
import sttp.client3.testing.SttpBackendStub
import sttp.tapir.server.stub.TapirStubInterpreter
import za.co.absa.atum.server.api.TestData

class EndpointsSpec extends AnyFunSpec with Matchers with Endpoints with TestData {

  describe("CreateCheckpointEndpoint"){
    describe("When success response configured"){
      it("Should produce Right with CheckpointDTO"){
        val createCheckpointBackendStub =
          TapirStubInterpreter(SttpBackendStub.synchronous)
            .whenEndpoint(createCheckpointEndpoint)
            .thenRespond(checkpointDTO1)
            .backend()

        val response = basicRequest
          .post(uri"http://test.com/api/v1/createCheckpoint")
          .send(createCheckpointBackendStub)

        println(response.body)

        assert(response.body == 0)
      }
    }
  }

}
@salamonpavel salamonpavel added the enhancement New feature or request label Jan 30, 2024
@benedeki benedeki added the dependent The item depends on some other open item (Issue or PR) label Jan 30, 2024
@benedeki benedeki added tests QA/test-specific and removed enhancement New feature or request labels Feb 6, 2024
@benedeki benedeki added this to the Next major Atum release milestone Feb 6, 2024
@benedeki benedeki removed the dependent The item depends on some other open item (Issue or PR) label Feb 13, 2024
@benedeki
Copy link
Contributor

@salamonpavel salamonpavel self-assigned this Feb 21, 2024
@github-project-automation github-project-automation bot moved this from 🆕 To groom to ✅ Done in CPS small repos project Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests QA/test-specific
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants