~wallyworld/gwacl/fix-request-eof

« back to all changes in this revision

Viewing changes to names_test.go

  • Committer: Gavin Panella
  • Date: 2013-07-12 12:58:03 UTC
  • mfrom: (179 gwacl)
  • mto: This revision was merged to the branch mainline in revision 180.
  • Revision ID: gavin@gromper.net-20130712125803-zaffdjmzukqg9t4h
Merge trunk, resolving one conflict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import (
7
7
    . "launchpad.net/gocheck"
8
8
    "math/rand"
 
9
    "strings"
9
10
)
10
11
 
11
12
type namesSuite struct{}
73
74
func (*namesSuite) TestMakeRandomVirtualNetworkName(c *C) {
74
75
    c.Check(MakeRandomVirtualNetworkName(""), Not(HasLen), 0)
75
76
}
 
77
 
 
78
func assertIsAzureValidPassword(c *C, password string) {
 
79
    c.Check(MakeRandomPassword(), HasLen, passwordSize)
 
80
    if !strings.ContainsAny(password, upperCaseLetters) {
 
81
        c.Errorf("Password %v does not contain a single upper-case letter!", password)
 
82
    }
 
83
    if !strings.ContainsAny(password, letters) {
 
84
        c.Errorf("Password %v does not contain a single lower-case letter!", password)
 
85
    }
 
86
    if !strings.ContainsAny(password, digits) {
 
87
        c.Errorf("Password %v does not contain a single digit!", password)
 
88
    }
 
89
}
 
90
 
 
91
func (*namesSuite) TestMakeRandomPassword(c *C) {
 
92
    for index := 0; index < 100; index += 1 {
 
93
        password := MakeRandomPassword()
 
94
        assertIsAzureValidPassword(c, password)
 
95
    }
 
96
}