Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Jul 22, 2019
2 parents 1d901c4 + 76f63ec commit e338863
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 21 deletions.
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
dist: xenial
sudo: required
dist: trusty
language: go

env:
- GO111MODULE=on GOFLAGS='-mod vendor'
global:
- GOX_FLAGS="-arch amd64"
- TRAVIS_GO_VERSION=$(cat .go-version)

go_import_path: github.com/srinandan/apigeecli

go:
- 1.12.x
git:
depth: 1

install: true

notifications:
email: false

Expand Down
101 changes: 84 additions & 17 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,56 +65,123 @@ func TestGetEnv(t *testing.T) {

// developers test
func TestCreateDeveloper(t *testing.T) {
email := "[email protected]"
first := "frstname"
last := "lastname"
user := "username"
cmd := exec.Command(apigeecli, "developers", "create", "-o", org, "-n", email, "-f", first, "-s", last, "-u", user, "-t", token)
email := "[email protected]"
first := "frstname"
last := "lastname"
user := "username"

cmd := exec.Command(apigeecli, "developers", "create", "-o", org, "-n", email, "-f", first, "-s", last, "-u", user, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestGetDeveloper(t *testing.T) {
email := "[email protected]"
cmd := exec.Command(apigeecli, "developers", "get", "-o", org, "-n", email, "-t", token)
email := "[email protected]"

cmd := exec.Command(apigeecli, "developers", "get", "-o", org, "-n", email, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestListDeveloper(t *testing.T) {
cmd := exec.Command(apigeecli, "developers", "list", "-o", org, "-t", token)

cmd := exec.Command(apigeecli, "developers", "list", "-o", org, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestListExpandDeveloper(t *testing.T) {
expand := "true"
cmd := exec.Command(apigeecli, "developers", "list", "-o", org, "-x", expand, "-t", token)
expand := "true"

cmd := exec.Command(apigeecli, "developers", "list", "-o", org, "-x", expand, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestDeleteDeveloper(t *testing.T) {
email := "[email protected]"
cmd := exec.Command(apigeecli, "developers", "delete", "-o", org, "-n", email, "-t", token)
email := "[email protected]"

cmd := exec.Command(apigeecli, "developers", "delete", "-o", org, "-n", email, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

// kvm test
func TestCreateKVM(t *testing.T) {
name := "test"

cmd := exec.Command(apigeecli, "kvms", "create", "-o", org, "-e", env, "-n", name, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestCreateEncKVM(t *testing.T) {
name := "testEnc"
enc := "true"

cmd := exec.Command(apigeecli, "kvms", "create", "-o", org, "-e", env, "-n", name, "-c", enc, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestListKVM(t *testing.T) {

cmd := exec.Command(apigeecli, "kvms", "list", "-o", org, "-e", env, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestDeleteKVM(t *testing.T) {
name := "test"

cmd := exec.Command(apigeecli, "kvms", "create", "-o", org, "-e", env, "-n", name, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestDeleteEnvKVM(t *testing.T) {
name := "testEnc"

cmd := exec.Command(apigeecli, "kvms", "create", "-o", org, "-e", env, "-n", name, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

// sync tests
func TestGetSync(t *testing.T) {

cmd := exec.Command(apigeecli, "sync", "get", "-o", org, "-t", token)
err := cmd.Run()
if err != nil {
t.Fatal(err)
}
}

func TestSetSync(t *testing.T) {
ity := "[email protected]"
cmd := exec.Command(apigeecli, "sync", "set", "-o", org, "-i", ity, "-t", token)
err := cmd.Run()
if err == nil {
t.Fatal("Invalid identity test should have failed")
}
}

0 comments on commit e338863

Please sign in to comment.