1package machineid 2 3import "testing" 4 5func TestID(t *testing.T) { 6 got, err := ID() 7 if err != nil { 8 t.Error(err) 9 } 10 if got == "" { 11 t.Error("Got empty machine id") 12 } 13} 14 15func TestProtectedID(t *testing.T) { 16 id, err := ID() 17 if err != nil { 18 t.Error(err) 19 } 20 hash, err := ProtectedID("app.id") 21 if err != nil { 22 t.Error(err) 23 } 24 if hash == "" { 25 t.Error("Got empty machine id hash") 26 } 27 if id == hash { 28 t.Error("id and hashed id are the same") 29 } 30} 31