Skip to content

Commit

Permalink
Merge pull request #90 from digitalocean/add-tag-to-droplet
Browse files Browse the repository at this point in the history
Add tags to droplets
  • Loading branch information
bryanl committed Apr 19, 2016
2 parents 859ab8f + 3bd6277 commit d5eb351
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 61 deletions.
3 changes: 2 additions & 1 deletion droplets.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ type Droplet struct {
Status string `json:"status,omitempty"`
Networks *Networks `json:"networks,omitempty"`
Created string `json:"created_at,omitempty"`
Kernel *Kernel `json:"kernel, omitempty"`
Kernel *Kernel `json:"kernel,omitempty"`
Tags []string `json:"tags,ommitempty"`
}

// PublicIPv4 returns the public IPv4 address for the Droplet.
Expand Down
60 changes: 0 additions & 60 deletions droplets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,66 +408,6 @@ func TestNetworkV6_String(t *testing.T) {
}
}

func TestDroplet_String(t *testing.T) {

region := &Region{
Slug: "region",
Name: "Region",
Sizes: []string{"1", "2"},
Available: true,
}

image := &Image{
ID: 1,
Name: "Image",
Type: "snapshot",
Distribution: "Ubuntu",
Slug: "image",
Public: true,
Regions: []string{"one", "two"},
MinDiskSize: 20,
Created: "2013-11-27T09:24:55Z",
}

size := &Size{
Slug: "size",
PriceMonthly: 123,
PriceHourly: 456,
Regions: []string{"1", "2"},
}
network := &NetworkV4{
IPAddress: "192.168.1.2",
Netmask: "255.255.255.0",
Gateway: "192.168.1.1",
}
networks := &Networks{
V4: []NetworkV4{*network},
}

droplet := &Droplet{
ID: 1,
Name: "droplet",
Memory: 123,
Vcpus: 456,
Disk: 789,
Region: region,
Image: image,
Size: size,
BackupIDs: []int{1},
SnapshotIDs: []int{1},
Locked: false,
Status: "active",
Networks: networks,
SizeSlug: "1gb",
}

stringified := droplet.String()
expected := `godo.Droplet{ID:1, Name:"droplet", Memory:123, Vcpus:456, Disk:789, Region:godo.Region{Slug:"region", Name:"Region", Sizes:["1" "2"], Available:true}, Image:godo.Image{ID:1, Name:"Image", Type:"snapshot", Distribution:"Ubuntu", Slug:"image", Public:true, Regions:["one" "two"], MinDiskSize:20, Created:"2013-11-27T09:24:55Z"}, Size:godo.Size{Slug:"size", Memory:0, Vcpus:0, Disk:0, PriceMonthly:123, PriceHourly:456, Regions:["1" "2"], Available:false, Transfer:0}, SizeSlug:"1gb", BackupIDs:[1], SnapshotIDs:[1], Locked:false, Status:"active", Networks:godo.Networks{V4:[godo.NetworkV4{IPAddress:"192.168.1.2", Netmask:"255.255.255.0", Gateway:"192.168.1.1", Type:""}]}, Created:""}`
if expected != stringified {
t.Errorf("Droplet.String returned %+v, expected %+v", stringified, expected)
}
}

func TestDroplets_IPMethods(t *testing.T) {
var d Droplet

Expand Down

0 comments on commit d5eb351

Please sign in to comment.