Fixing tests

This commit is contained in:
Denis Makogon
2017-08-09 15:09:48 +03:00
parent b057903feb
commit 426772592b
2 changed files with 4 additions and 13 deletions

View File

@@ -72,7 +72,7 @@ func CreateApp(t *testing.T, ctx context.Context, fnclient *client.Functions, ap
} }
} }
func UpdateApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string, config map[string]string) *apps.PatchAppsAppOK { func CreateUpdateApp(t *testing.T, ctx context.Context, fnclient *client.Functions, appName string, config map[string]string) *apps.PatchAppsAppOK {
CreateApp(t, ctx, fnclient, appName, map[string]string{"A": "a"}) CreateApp(t, ctx, fnclient, appName, map[string]string{"A": "a"})
cfg := &apps.PatchAppsAppParams{ cfg := &apps.PatchAppsAppParams{
App: appName, App: appName,

View File

@@ -65,16 +65,7 @@ func TestApps(t *testing.T) {
"A": "a", "A": "a",
} }
CreateApp(t, s.Context, s.Client, s.AppName, config) appUpdatePayload := CreateUpdateApp(t, s.Context, s.Client, s.AppName, config)
cfg := &apps.GetAppsAppParams{
Context: s.Context,
App: s.AppName,
}
_, err := s.Client.Apps.GetAppsApp(cfg)
CheckAppResponseError(t, err)
appUpdatePayload := UpdateApp(t, s.Context, s.Client, s.AppName, config)
_, ok := appUpdatePayload.Payload.App.Config["A"] _, ok := appUpdatePayload.Payload.App.Config["A"]
if !ok { if !ok {
t.Error("Error during app update: config map misses required entity `A` with value `a`.") t.Error("Error during app update: config map misses required entity `A` with value `a`.")
@@ -89,7 +80,7 @@ func TestApps(t *testing.T) {
config := map[string]string{ config := map[string]string{
"A": "b", "A": "b",
} }
appPayload := UpdateApp(t, s.Context, s.Client, s.AppName, config) appPayload := CreateUpdateApp(t, s.Context, s.Client, s.AppName, config)
val, ok := appPayload.Payload.App.Config["A"] val, ok := appPayload.Payload.App.Config["A"]
if !ok { if !ok {
t.Error("Error during app config inspect: config map misses required entity `A` with value `a`.") t.Error("Error during app config inspect: config map misses required entity `A` with value `a`.")
@@ -106,7 +97,7 @@ func TestApps(t *testing.T) {
config := map[string]string{ config := map[string]string{
"B": "b", "B": "b",
} }
appPayload := UpdateApp(t, s.Context, s.Client, s.AppName, config) appPayload := CreateUpdateApp(t, s.Context, s.Client, s.AppName, config)
val, ok := appPayload.Payload.App.Config["B"] val, ok := appPayload.Payload.App.Config["B"]
if !ok { if !ok {
t.Error("Error during app config inspect: config map misses required entity `B` with value `b`.") t.Error("Error during app config inspect: config map misses required entity `B` with value `b`.")