// UpdateFromMetadata updates the result with the information in the // metadata value. func (r *BackupsMetadataResult) UpdateFromMetadata(meta *metadata.Metadata) { r.ID = meta.ID() r.Started = meta.Started() if meta.Finished() != nil { r.Finished = *(meta.Finished()) } r.Checksum = meta.Checksum() r.ChecksumFormat = meta.ChecksumFormat() r.Size = meta.Size() r.Stored = meta.Stored() r.Notes = meta.Notes() origin := meta.Origin() r.Environment = origin.Environment() r.Machine = origin.Machine() r.Hostname = origin.Hostname() r.Version = origin.Version() }
func (s *backupSuite) checkMetadata( c *gc.C, metadata, expected *metadata.Metadata, id string, ) { if id != "" { c.Check(metadata.ID(), gc.Equals, id) } c.Check(metadata.Notes(), gc.Equals, expected.Notes()) c.Check(metadata.Timestamp().Unix(), gc.DeepEquals, expected.Timestamp().Unix()) c.Check(metadata.Checksum(), gc.Equals, expected.Checksum()) c.Check(metadata.ChecksumFormat(), gc.Equals, expected.ChecksumFormat()) c.Check(metadata.Size(), gc.Equals, expected.Size()) c.Check(metadata.Origin(), gc.DeepEquals, expected.Origin()) c.Check(metadata.Stored(), gc.DeepEquals, expected.Stored()) }