Exemple #1
0
// Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package charmrepo_test

import (
	jc "github.com/juju/testing/checkers"
	gc "gopkg.in/check.v1"
	"gopkg.in/juju/charm.v6-unstable"

	"gopkg.in/juju/charmrepo.v0"
	"gopkg.in/juju/charmrepo.v0/csclient"
	charmtesting "gopkg.in/juju/charmrepo.v0/testing"
)

var TestCharms = charmtesting.NewRepo("internal/test-charm-repo", "quantal")

type inferRepoSuite struct{}

var _ = gc.Suite(&inferRepoSuite{})

var inferRepositoryTests = []struct {
	url           string
	localRepoPath string
	err           string
}{{
	url: "cs:trusty/django",
}, {
	url: "local:precise/wordpress",
	err: "path to local repository not specified",
}, {
Exemple #2
0
	"github.com/juju/utils"
	gc "gopkg.in/check.v1"
	"gopkg.in/errgo.v1"
	"gopkg.in/juju/charm.v6-unstable"
	"gopkg.in/juju/charmstore.v5-unstable"
	"gopkg.in/macaroon-bakery.v1/bakery/checkers"
	"gopkg.in/macaroon-bakery.v1/bakerytest"
	"gopkg.in/macaroon-bakery.v1/httpbakery"
	"gopkg.in/mgo.v2"

	"gopkg.in/juju/charmrepo.v0/csclient"
	"gopkg.in/juju/charmrepo.v0/csclient/params"
	charmtesting "gopkg.in/juju/charmrepo.v0/testing"
)

var charmRepo = charmtesting.NewRepo("../internal/test-charm-repo", "quantal")

// Define fake attributes to be used in tests.
var fakeReader, fakeHash, fakeSize = func() (io.ReadSeeker, string, int64) {
	content := []byte("fake content")
	h := sha512.New384()
	h.Write(content)
	return bytes.NewReader(content), fmt.Sprintf("%x", h.Sum(nil)), int64(len(content))
}()

type suite struct {
	jujutesting.IsolatedMgoSuite
	client       *csclient.Client
	srv          *httptest.Server
	handler      charmstore.HTTPCloseHandler
	serverParams charmstore.ServerParams