Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sample GET Implementation:





The sample API above was created using the swagger.yaml below.

swagger.yml

...

languageyml
themeFadeToGrey

...

Proposed Usage

Proposed sample command to GET all binary images

...

#after the upload, the image_offset is now the same as image_length and upload_complete changed to true
#if upload was incomplete

...

Resumable upload -PATCH

#this is the current resumable upload mechanism

...

Here is the ImageClient type that the method GetDirPath is defined on.:

Code Block
languagetext
themeFadeToGrey
type ImageClient struct {
	storeName string
	tagMeta   string
}

...

Code Block
languagetext
themeFadeToGrey
package app

import (
  "fmt"
  "os/user"
  "testing"

  "github.com/stretchr/testify/mock"
)

type mockImports struct {
  mock.Mock
}

func (m *mockImports) GetCurrentUser() (*user.User, error) {
  fmt.Println("Mocked Get User")
  args := m.Called()

  return args.Get(0).(*user.User), args.Error(1)
}

func TestService(t *testing.T) {
  fakeUser := &user.User{}

  myImports := new(mockImports)

  myImports.On("GetCurrentUser").Return(&fakeUser, nil)

  imageClient := ImageClient{myImports, "test_image", "test_meta"}
  _, dir, err := imageClient.GetDirPath("test")
  if err != nil {
    t.Errorf("Path was incorrect, got: %q, want: %q.", dir, "some_path")
  }
}

...