Adding API tests that verifies recently changed code bevaviour

This commit is contained in:
Denis Makogon
2017-09-21 02:25:36 +03:00
parent 830c86efe7
commit f4699ea0ba
3 changed files with 20 additions and 1 deletions

View File

@@ -14,6 +14,9 @@ import (
func CheckAppResponseError(t *testing.T, e error) {
if e != nil {
switch err := e.(type) {
case *apps.DeleteAppsAppNotFound:
t.Errorf("Unexpected error occurred: %v Original Location: %s", err.Payload.Error.Message, MyCaller())
t.FailNow()
case *apps.DeleteAppsAppDefault:
t.Errorf("Unexpected error occurred: %v. Status code: %v Orig Location: %s", err.Payload.Error.Message, err.Code(), MyCaller())
t.FailNow()

View File

@@ -11,6 +11,20 @@ import (
func TestApps(t *testing.T) {
t.Run("delete-app-not-found-test", func(t *testing.T) {
t.Parallel()
s := SetupDefaultSuite()
cfg := &apps.DeleteAppsAppParams{
App: "missing-app",
Context: s.Context,
}
cfg.WithTimeout(time.Second * 60)
_, err := s.Client.Apps.DeleteAppsApp(cfg)
if err == nil {
t.Errorf("Error during app delete: we should get HTTP 404, but got: %s", err.Error())
}
})
t.Run("app-not-found-test", func(t *testing.T) {
t.Parallel()
s := SetupDefaultSuite()