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

Chore: add environment import api client #855

Merged
merged 10 commits into from
May 22, 2024

Conversation

alonnoga
Copy link
Contributor

@alonnoga alonnoga commented May 21, 2024

Issue & Steps to Reproduce / Feature Request

part of #856

Solution

Add environment import CRUD to api client

Copy link
Collaborator

Choose a reason for hiding this comment

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

@alonnoga for which "issue #" is this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, sorry I didn't create one in advance
This one #856

@TomerHeber TomerHeber force-pushed the chore-add-environment-import-resource branch from 9616927 to c708bec Compare May 21, 2024 14:53
@TomerHeber TomerHeber changed the title chore add environment import resource Chore: add environment import resource May 21, 2024
@alonnoga alonnoga changed the title Chore: add environment import resource Chore: add environment import api client May 21, 2024
@alonnoga alonnoga requested a review from TomerHeber May 21, 2024 15:31
Name string `json:"name"`
Value string `json:"value"`
IsSensitive bool `json:"isSensitive"`
Type string `json:"tyoe"` // string or JSON
Copy link
Collaborator

Choose a reason for hiding this comment

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

tyoe to type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

type GitConfig struct {
Path string `json:"path"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

if it's empty and you don't want to pass an empty string you may add omitempty

Copy link
Contributor Author

Choose a reason for hiding this comment

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


type GitConfig struct {
Path string `json:"path"`
Revision string `json:"revision"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

if it's empty and you don't want to pass an empty string you may add omitempty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

result, _ = apiClient.EnvironmentImportGet(mockEnvironmentImport.Id)
})

It("Should get organization id", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

})

It("Should get organization id", func() {
organizationIdCall.Times(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

move the times(1) to the BeforeEach.
This It isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it important to even test this is called? if the mock is missing the test fails

Copy link
Contributor Author

Choose a reason for hiding this comment

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

var result *EnvironmentImport
var mockedResponse EnvironmentImport
BeforeEach(func() {
mockOrganizationIdCall(organizationId)
Copy link
Collaborator

Choose a reason for hiding this comment

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

add times(1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

result, _ = apiClient.EnvironmentImportUpdate(mockEnvironmentImport.Id, &payload)
})

It("Should send PUT request with environment import ID and expected payload", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

add the times(1) to the httpCall... the It can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@TomerHeber TomerHeber left a comment

Choose a reason for hiding this comment

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

LGTM - some minor fixes are required.

@@ -2,44 +2,44 @@ package client

type EnvironmentImport struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

omit empty isn't needed here. This is just a response (doesn't matter to in golang).

Copy link
Contributor Author

Choose a reason for hiding this comment

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


type Variable struct {
Name string `json:"name"`
Value string `json:"value,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

is omitempty needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of what this resource does is create an entity that we'll use to auto fill a form in the UI
So I want them to be able to just specify variables without values ( and leave their value as empty in the UI for them to manually fill in )

This is very unlikely though I can remove it, its not important

@github-actions github-actions bot added ready to merge PR approved - can be merged once the PR owner is ready and removed pending final review labels May 21, 2024
@alonnoga alonnoga merged commit e37247b into main May 22, 2024
6 checks passed
@alonnoga alonnoga deleted the chore-add-environment-import-resource branch May 22, 2024 07:27
sagilaufer1992 added a commit that referenced this pull request Jul 31, 2024
sagilaufer1992 added a commit that referenced this pull request Jul 31, 2024
sagilaufer1992 added a commit that referenced this pull request Jul 31, 2024
* Revert "Feat: add an environment import resource (#858)"

This reverts commit 3a475d6

* Revert "Chore: add environment import api client (#855)"

This reverts commit e37247b

* add sets functions back

* change order

* double stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-client chore ready to merge PR approved - can be merged once the PR owner is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants