launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/names/user_test.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package names_test 5 6 import ( 7 gc "launchpad.net/gocheck" 8 9 "launchpad.net/juju-core/names" 10 jc "launchpad.net/juju-core/testing/checkers" 11 ) 12 13 type userSuite struct{} 14 15 var _ = gc.Suite(&userSuite{}) 16 17 func (s *userSuite) TestUserTag(c *gc.C) { 18 c.Assert(names.UserTag("admin"), gc.Equals, "user-admin") 19 } 20 21 func (s *userSuite) TestIsUser(c *gc.C) { 22 c.Assert(names.IsUser("admin"), jc.IsTrue) 23 c.Assert(names.IsUser("foo42"), jc.IsTrue) 24 c.Assert(names.IsUser("not/valid"), jc.IsFalse) 25 c.Assert(names.IsUser(""), jc.IsFalse) 26 }