github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/api/agent/uniter/export_test.go (about)

     1  // Copyright 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package uniter
     5  
     6  import (
     7  	"github.com/juju/names/v5"
     8  
     9  	"github.com/juju/juju/core/life"
    10  	"github.com/juju/juju/rpc/params"
    11  )
    12  
    13  var (
    14  	NewSettings = newSettings
    15  )
    16  
    17  // CreateUnit creates uniter.Unit for tests.
    18  func CreateUnit(st *State, tag names.UnitTag) *Unit {
    19  	return &Unit{
    20  		st:           st,
    21  		tag:          tag,
    22  		life:         life.Alive,
    23  		resolvedMode: params.ResolvedNone,
    24  	}
    25  }
    26  
    27  // CreateRelation creates uniter.Relation for tests.
    28  func CreateRelation(st *State, tag names.RelationTag) *Relation {
    29  	return &Relation{
    30  		st:  st,
    31  		tag: tag,
    32  		id:  666,
    33  	}
    34  }
    35  
    36  // CreateRelationUnit creates uniter.RelationUnit for tests.
    37  func CreateRelationUnit(st *State, relationTag names.RelationTag, unitTag names.UnitTag) *RelationUnit {
    38  	return &RelationUnit{
    39  		st:       st,
    40  		unitTag:  unitTag,
    41  		relation: &Relation{tag: relationTag},
    42  	}
    43  }