本文整理匯總了Golang中github.com/motain/gocheck.C類的典型用法代碼示例。如果您正苦於以下問題:Golang C類的具體用法?Golang C怎麽用?Golang C使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了C類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestDescribeLoadBalancersBadRequest
func (s *S) TestDescribeLoadBalancersBadRequest(c *gocheck.C) {
testServer.PrepareResponse(400, nil, DescribeLoadBalancersBadRequest)
resp, err := s.elb.DescribeLoadBalancers()
c.Assert(resp, gocheck.IsNil)
c.Assert(err, gocheck.NotNil)
c.Assert(err, gocheck.ErrorMatches, `^Cannot find Load Balancer absentlb \(LoadBalancerNotFound\)$`)
}
示例2: SetUpSuite
func (s *S) SetUpSuite(c *gocheck.C) {
var err error
testServer.Start()
auth := aws.Auth{AccessKey: "abc", SecretKey: "123"}
s.rds, err = rds.New(auth, aws.Region{RDSEndpoint: aws.ServiceInfo{testServer.URL, aws.V2Signature}})
c.Assert(err, gocheck.IsNil)
}
示例3: TestListGroups
func (s *S) TestListGroups(c *gocheck.C) {
testServer.Response(200, nil, ListGroupsExample)
resp, err := s.iam.Groups("/division_abc/")
values := testServer.WaitRequest().URL.Query()
c.Assert(values.Get("Action"), gocheck.Equals, "ListGroups")
c.Assert(values.Get("PathPrefix"), gocheck.Equals, "/division_abc/")
c.Assert(err, gocheck.IsNil)
c.Assert(resp.RequestId, gocheck.Equals, "7a62c49f-347e-4fc4-9331-6e8eEXAMPLE")
expected := []iam.Group{
{
Path: "/division_abc/subdivision_xyz/",
Name: "Admins",
Id: "AGPACKCEVSQ6C2EXAMPLE",
Arn: "arn:aws:iam::123456789012:group/Admins",
},
{
Path: "/division_abc/subdivision_xyz/product_1234/engineering/",
Name: "Test",
Id: "AGP2MAB8DPLSRHEXAMPLE",
Arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/engineering/Test",
},
{
Path: "/division_abc/subdivision_xyz/product_1234/",
Name: "Managers",
Id: "AGPIODR4TAW7CSEXAMPLE",
Arn: "arn:aws:iam::123456789012:group/division_abc/subdivision_xyz/product_1234/Managers",
},
}
c.Assert(resp.Groups, gocheck.DeepEquals, expected)
}
示例4: WaitUntilStatus
func (s *DynamoDBTest) WaitUntilStatus(c *gocheck.C, status string) {
// We should wait until the table is in specified status because a real DynamoDB has some delay for ready
done := make(chan bool)
timeout := time.After(TIMEOUT)
go func() {
for {
select {
case <-done:
return
default:
desc, err := s.table.DescribeTable()
if err != nil {
c.Fatal(err)
}
if desc.TableStatus == status {
done <- true
return
}
time.Sleep(5 * time.Second)
}
}
}()
select {
case <-done:
break
case <-timeout:
c.Errorf("Expect a status to be %s, but timed out", status)
close(done)
}
}
示例5: SetUpSuite
func (s *AmazonServerSuite) SetUpSuite(c *gocheck.C) {
if !*amazon {
c.Skip("AmazonServerSuite tests not enabled")
}
s.srv.SetUp(c)
s.ServerTests.elb = elb.New(s.srv.auth, aws.USEast)
}
示例6: createInstanceAndLB
func (s *ClientTests) createInstanceAndLB(c *gocheck.C) (*elb.CreateLoadBalancer, string) {
options := ec2.RunInstancesOptions{
ImageId: "ami-ccf405a5",
InstanceType: "t1.micro",
AvailabilityZone: "us-east-1c",
}
resp1, err := s.ec2.RunInstances(&options)
c.Assert(err, gocheck.IsNil)
instId := resp1.Instances[0].InstanceId
createLBReq := elb.CreateLoadBalancer{
Name: "testlb",
AvailabilityZones: []string{"us-east-1c"},
Listeners: []elb.Listener{
{
InstancePort: 80,
InstanceProtocol: "http",
LoadBalancerPort: 80,
Protocol: "http",
},
},
}
_, err = s.elb.CreateLoadBalancer(&createLBReq)
c.Assert(err, gocheck.IsNil)
return &createLBReq, instId
}
示例7: SetUp
func (s *LocalServer) SetUp(c *gocheck.C) {
srv, err := elbtest.NewServer()
c.Assert(err, gocheck.IsNil)
c.Assert(srv, gocheck.NotNil)
s.srv = srv
s.region = aws.Region{ELBEndpoint: srv.URL()}
}
示例8: TestDescribeScheduledActions
func (s *S) TestDescribeScheduledActions(c *gocheck.C) {
testServer.Response(200, nil, DescribeScheduledActionsResponse)
st, _ := time.Parse(time.RFC3339, "2014-06-01T00:30:00Z")
request := &DescribeScheduledActionsParams{
AutoScalingGroupName: "ASGTest1",
MaxRecords: 1,
StartTime: st,
}
resp, err := s.as.DescribeScheduledActions(request)
c.Assert(err, gocheck.IsNil)
values := testServer.WaitRequest().PostForm
c.Assert(values.Get("Version"), gocheck.Equals, "2011-01-01")
c.Assert(values.Get("Action"), gocheck.Equals, "DescribeScheduledActions")
c.Assert(resp.RequestId, gocheck.Equals, "0eb4217f-8421-11e3-9233-7100ef811766")
c.Assert(resp.ScheduledUpdateGroupActions, gocheck.DeepEquals, []ScheduledUpdateGroupAction{
{
AutoScalingGroupName: "ASGTest1",
ScheduledActionARN: "arn:aws:autoscaling:us-west-2:193024542802:scheduledUpdateGroupAction:61f68b2c-bde3-4316-9a81-eb95dc246509:autoScalingGroupName/ASGTest1:scheduledActionName/SATest1",
ScheduledActionName: "SATest1",
Recurrence: "30 0 1 1,6,12 *",
MaxSize: 4,
StartTime: st,
Time: st,
},
})
}
示例9: TestExitStandby
func (s *S) TestExitStandby(c *gocheck.C) {
testServer.Response(200, nil, ExitStandbyResponse)
resp, err := s.as.ExitStandby("my-asg", []string{"i-5b73d709"})
c.Assert(err, gocheck.IsNil)
values := testServer.WaitRequest().PostForm
c.Assert(values.Get("Version"), gocheck.Equals, "2011-01-01")
c.Assert(values.Get("Action"), gocheck.Equals, "ExitStandby")
c.Assert(values.Get("AutoScalingGroupName"), gocheck.Equals, "my-asg")
c.Assert(values.Get("InstanceIds.member.1"), gocheck.Equals, "i-5b73d709")
st, _ := time.Parse(time.RFC3339, "2014-06-13T22:43:53.523Z")
expected := &ExitStandbyResult{
RequestId: "321a11c8-f34c-11e3-a434-7f10009d5849",
Activities: []Activity{
{
StatusCode: "PreInService",
Progress: 30,
ActivityId: "dca4efcf-eea6-4844-8064-cab1fecd1aa2",
StartTime: st,
AutoScalingGroupName: "my-asg",
Details: "{\"Availability Zone\":\"us-east-1a\"}",
Cause: "At 2014-06-13T22:43:53Z instance i-5b73d709 was moved out of standby in response to a user request, increasing the capacity from 3 to 4.",
Description: "Moving EC2 instance out of Standby: i-5b73d709",
},
},
}
c.Assert(resp, gocheck.DeepEquals, expected)
}
示例10: SetUp
func (s *AmazonServer) SetUp(c *gocheck.C) {
auth, err := aws.EnvAuth()
if err != nil {
c.Fatal(err.Error())
}
s.auth = auth
}
示例11: SetUpSuite
func (s *AmazonClientSuite) SetUpSuite(c *gocheck.C) {
if !testutil.Amazon {
c.Skip("AmazonClientSuite tests not enabled")
}
s.srv.SetUp(c)
s.iam = iam.New(s.srv.auth, aws.USEast)
}
示例12: SetUpSuite
func (s *AmazonServerSuite) SetUpSuite(c *gocheck.C) {
if !testutil.Amazon {
c.Skip("AmazonServerSuite tests not enabled")
}
s.srv.SetUp(c)
s.ServerTests.ec2 = ec2.NewWithClient(s.srv.auth, aws.USEast, testutil.DefaultClient)
}
示例13: TestEscaping
func (s *S) TestEscaping(c *gocheck.C) {
params := map[string]string{"Nonce": "+ +"}
elb.Sign(testAuth, "GET", "/path", params, "localhost")
c.Assert(params["Nonce"], gocheck.Equals, "+ +")
expected := "bqffDELReIqwjg/W0DnsnVUmfLK4wXVLO4/LuG+1VFA="
c.Assert(params["Signature"], gocheck.Equals, expected)
}
示例14: TestDescribeInstanceHealthBadRequest
func (s *S) TestDescribeInstanceHealthBadRequest(c *gocheck.C) {
testServer.PrepareResponse(400, nil, DescribeInstanceHealthBadRequest)
resp, err := s.elb.DescribeInstanceHealth("testlb", "i-foooo")
c.Assert(err, gocheck.NotNil)
c.Assert(resp, gocheck.IsNil)
c.Assert(err, gocheck.ErrorMatches, ".*i-foooo.*(InvalidInstance).*")
}
示例15: TestGetTemplate
func (s *S) TestGetTemplate(c *gocheck.C) {
testServer.Response(200, nil, GetTemplateResponse)
resp, err := s.cf.GetTemplate("MyStack")
c.Assert(err, gocheck.IsNil)
values := testServer.WaitRequest().PostForm
// Post request test
c.Assert(values.Get("Version"), gocheck.Equals, "2010-05-15")
c.Assert(values.Get("Action"), gocheck.Equals, "GetTemplate")
c.Assert(values.Get("StackName"), gocheck.Equals, "MyStack")
// Response test
templateBody := `{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Simple example",
"Resources" : {
"MySQS" : {
"Type" : "AWS::SQS::Queue",
"Properties" : {
}
}
}
}`
c.Assert(resp.TemplateBody, gocheck.Equals, templateBody)
c.Assert(resp.RequestId, gocheck.Equals, "4af14eec-350e-11e4-b260-EXAMPLE")
}