func setSettings(c *C, ru *state.RelationUnit, settings map[string]interface{}) { node, err := ru.Settings() c.Assert(err, IsNil) for _, k := range node.Keys() { node.Delete(k) } node.Update(settings) _, err = node.Write() c.Assert(err, IsNil) }
func changeSettings(c *C, ru *state.RelationUnit) *state.Settings { node, err := ru.Settings() c.Assert(err, IsNil) value, _ := node.Get("value") v, _ := value.(int) node.Set("value", v+1) _, err = node.Write() c.Assert(err, IsNil) return node }