-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
client/api_client.go
Outdated
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
9616927
to
c708bec
Compare
client/environment_import.go
Outdated
Name string `json:"name"` | ||
Value string `json:"value"` | ||
IsSensitive bool `json:"isSensitive"` | ||
Type string `json:"tyoe"` // string or JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tyoe to type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client/environment_import.go
Outdated
} | ||
|
||
type GitConfig struct { | ||
Path string `json:"path"` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client/environment_import.go
Outdated
|
||
type GitConfig struct { | ||
Path string `json:"path"` | ||
Revision string `json:"revision"` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client/environment_import_test.go
Outdated
result, _ = apiClient.EnvironmentImportGet(mockEnvironmentImport.Id) | ||
}) | ||
|
||
It("Should get organization id", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client/environment_import_test.go
Outdated
}) | ||
|
||
It("Should get organization id", func() { | ||
organizationIdCall.Times(1) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client/environment_import_test.go
Outdated
var result *EnvironmentImport | ||
var mockedResponse EnvironmentImport | ||
BeforeEach(func() { | ||
mockOrganizationIdCall(organizationId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add times(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client/environment_import_test.go
Outdated
result, _ = apiClient.EnvironmentImportUpdate(mockEnvironmentImport.Id, &payload) | ||
}) | ||
|
||
It("Should send PUT request with environment import ID and expected payload", func() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is omitempty needed here?
There was a problem hiding this comment.
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
This reverts commit e37247b
This reverts commit e37247b
Issue & Steps to Reproduce / Feature Request
part of #856
Solution
Add environment import CRUD to api client