~juju-qa/ubuntu/yakkety/juju/juju-1.25.8

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/uniter/runner/jujuc/testing/settings.go

  • Committer: Nicholas Skaggs
  • Date: 2016-12-02 17:28:37 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161202172837-jkrbdlyjcxtrii2n
Initial commit of 1.25.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2015 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package testing
 
5
 
 
6
import (
 
7
        "github.com/juju/juju/apiserver/params"
 
8
)
 
9
 
 
10
// Settings is a test double for jujuc.Settings.
 
11
type Settings params.Settings
 
12
 
 
13
// Get implements jujuc.Settings.
 
14
func (s Settings) Get(k string) (interface{}, bool) {
 
15
        v, f := s[k]
 
16
        return v, f
 
17
}
 
18
 
 
19
// Set implements jujuc.Settings.
 
20
func (s Settings) Set(k, v string) {
 
21
        s[k] = v
 
22
}
 
23
 
 
24
// Delete implements jujuc.Settings.
 
25
func (s Settings) Delete(k string) {
 
26
        delete(s, k)
 
27
}
 
28
 
 
29
// Map implements jujuc.Settings.
 
30
func (s Settings) Map() params.Settings {
 
31
        r := params.Settings{}
 
32
        for k, v := range s {
 
33
                r[k] = v
 
34
        }
 
35
        return r
 
36
}