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

api: add Integration test cases #43

Merged
merged 9 commits into from
Dec 21, 2024
Merged

api: add Integration test cases #43

merged 9 commits into from
Dec 21, 2024

Conversation

ashwiniag
Copy link
Member

@ashwiniag ashwiniag commented Dec 20, 2024

closes #44

Introduces

  • fixes on API responses, it returns
    a. list of integration objects only
    b. returns updated objects as response on PUT instead of key word updated
  • improves error handling
  • adds test cases

As follows

GET /integrations/{id}

Test Case Description Adds Error Handling
Valid ID Verifies response for a valid integration ID. ✅  
Invalid UUID Format Ensures malformed UUIDs return appropriate error. ✅ 400 Bad Request ✅
Non-existent ID Ensures non-existent IDs return appropriate error. ✅ 404 Not Found ✅

GET /integrations

Test Case Description Adds Error Handling
Valid Request Verifies all integrations are listed correctly. ✅  
Empty Database Verifies response when no integrations exist. ✅  

POST /integrations

Test Case Description Adds Error Handling
Valid Input Ensures integration is created successfully. ✅  
Missing Fields Verifies name or type is required. ✅ 400 Bad Request ✅
Duplicate Name Ensures duplicates return appropriate error. ✅ 409 Conflict ✅
Invalid Type Verifies validation for non-existent integration types. ✅ Pending implementation for later, post IntegrationTypes
Empty Config Ensures creation works with an empty configuration. ✅  To be changed later

PUT /integrations/{id}

Test Case Description Adds Error Handling
Valid Update Ensures integration is updated successfully. ✅  
Partial Update Verifies update works when only one field is provided. ✅  
Invalid UUID Format Ensures malformed UUIDs return appropriate error. 400 Bad Request ✅
Non-existent ID Ensures non-existent IDs return appropriate error. ✅ 404 Not Found ✅
No Changes Verifies no update when no fields are provided. ✅  

Copy link
Member

@scriptnull scriptnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of organising tests like

├── get.go
├── post.go
├── put.go
└── tests
    ├── get_test.go
    ├── post_test.go
    └── put_test.go

Let us organise it like

├── get.go
├── get_test.go
├── post.go
├── post_test.go
├── put.go
└── put_test.go

In Go, it is usually preferred to have tests side by side with a _test.go suffix.

@scriptnull scriptnull changed the title api tests: Integration test cases api: add Integration test cases Dec 21, 2024
ashwiniag and others added 5 commits December 21, 2024 12:24
* fix: correct go version in dockerfile

* ci: run build and push image on PRs

* run go test command

* readme: show the build badge instead of lint
@ashwiniag ashwiniag merged commit 477ca73 into main Dec 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api: add tests for integrations route
2 participants