/
fake.go
47 lines (34 loc) · 920 Bytes
/
fake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
/* This file is meant for generating test data */
import (
"github.com/BetaBugish/se-poc/lib/people"
"github.com/icrowley/fake"
"log"
)
func main() {
log.Print("Generating fake data")
for i := 0; i < 10; i++ {
p := people.GetNewPerson()
p.FirstName = fake.FirstName()
p.LastName = fake.LastName()
// Fake accounts
for j := 0; j < 3; j++ {
a := people.GetNewAccount()
a.Password = fake.SimplePassword()
a.UserName = fake.UserName()
p.Accounts = append(p.Accounts, *a)
}
// Fake addresses
for j := 0; j < 3; j++ {
a := people.GetNewAddress()
a.Streetname = fake.Street()
a.City = fake.City()
a.State = fake.State()
a.Housenumber = fake.DigitsN(2)
a.Postal = fake.Zip()
p.Addresses = append(p.Addresses, *a)
}
people.SavePerson(p)
}
log.Print("Done generating fake data")
}