Fixing identity tests and adding them to travis

This commit is contained in:
Sarah Jamie Lewis 2018-01-13 15:35:48 -05:00
parent 88d32191f7
commit 5d9f2ce9e3
2 changed files with 11 additions and 7 deletions

View File

@ -1,12 +1,15 @@
package identity
import (
"github.com/s-rah/go-ricochet/identity"
"testing"
)
func TestIdentity(t *testing.T) {
id := identity.Init("../testing/private_key")
id := Init("../testing/private_key")
if id.Initialized() == false {
t.Errorf("Identity should be initialized")
}
if id.Hostname() != "kwke2hntvyfqm7dr" {
t.Errorf("Expected %v as Hostname() got: %v", "kwke2hntvyfqm7dr", id.Hostname())
}

View File

@ -2,11 +2,12 @@
set -e
pwd
go test -coverprofile=main.cover.out -v .
go test -coverprofile=utils.cover.out -v ./utils
go test -coverprofile=channels.cover.out -v ./channels
go test -coverprofile=connection.cover.out -v ./connection
go test -coverprofile=policies.cover.out -v ./policies
go test ${1} -coverprofile=main.cover.out -v .
go test ${1} -coverprofile=utils.cover.out -v ./utils
go test ${1} -coverprofile=channels.cover.out -v ./channels
go test ${1} -coverprofile=connection.cover.out -v ./connection
go test ${1} -coverprofile=policies.cover.out -v ./policies
go test ${1} -coverprofile=policies.cover.out -v ./identity
echo "mode: set" > coverage.out && cat *.cover.out | grep -v mode: | sort -r | \
awk '{if($1 != last) {print $0;last=$1}}' >> coverage.out
rm -rf *.cover.out