Skip to content

Commit

Permalink
Merge pull request #197 from zscaler/zia-#196-more-integration-tests
Browse files Browse the repository at this point in the history
fix: Included additional zia and zpa integration tests
  • Loading branch information
willguibr authored Dec 8, 2023
2 parents 151d3e9 + 94dbe21 commit 5df060e
Show file tree
Hide file tree
Showing 53 changed files with 1,787 additions and 942 deletions.
52 changes: 52 additions & 0 deletions zia/services/adminuserrolemgmt/admins/admin_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,55 @@ func tryRetrieveResource(s *Service, id int) (*AdminUsers, error) {

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetAdminUsers(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.DeleteAdminUser(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.UpdateAdminUser(0, AdminUsers{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetAdminByUsername("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,55 @@ func tryRetrieveResource(s *Service, id int) (*DLPEngines, error) {

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Get(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Delete(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, _, err = service.Update(0, &DLPEngines{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetByName("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,55 @@ func tryRetrieveResource(s *Service, id int) (*DlpNotificationTemplates, error)

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Get(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Delete(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, _, err = service.Update(0, &DlpNotificationTemplates{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetByName("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,55 @@ func tryRetrieveResource(s *Service, id int) (*WebDLPRules, error) {

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Get(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Delete(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Update(0, &WebDLPRules{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetByName("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,55 @@ func tryRetrieveResource(s *Service, id int) (*DlpDictionary, error) {

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Get(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.DeleteDlpDictionary(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, _, err = service.Update(0, &DlpDictionary{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetByName("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,55 @@ func tryRetrieveResource(s *Service, id int) (*FirewallFilteringRules, error) {

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Get(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Delete(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Update(0, &FirewallFilteringRules{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetByName("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,55 @@ func tryRetrieveResource(s *Service, id int) (*IPDestinationGroups, error) {

return nil, err
}

func TestRetrieveNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Get(0)
if err == nil {
t.Error("Expected error retrieving non-existent resource, but got nil")
}
}

func TestDeleteNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.Delete(0)
if err == nil {
t.Error("Expected error deleting non-existent resource, but got nil")
}
}

func TestUpdateNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, _, err = service.Update(0, &IPDestinationGroups{})
if err == nil {
t.Error("Expected error updating non-existent resource, but got nil")
}
}

func TestGetByNameNonExistentResource(t *testing.T) {
client, err := tests.NewZiaClient()
if err != nil {
t.Fatalf("Error creating client: %v", err)
}
service := New(client)

_, err = service.GetByName("non-existent-name")
if err == nil {
t.Error("Expected error retrieving resource by non-existent name, but got nil")
}
}
Loading

0 comments on commit 5df060e

Please sign in to comment.