Commit bf8f560a authored by Loïck Bonniot's avatar Loïck Bonniot

[d] Net is now blocking

parent b647a8ab
Pipeline #2187 passed with stage
......@@ -35,10 +35,10 @@ func (w *Window) AddEvent(e *api.Log) {
var receiver string
var index int
if n, _ := fmt.Sscanf(e.Log, "sent promise to %s", &receiver); n > 0 {
if n, _ := fmt.Sscanf(e.Log, "successfully sent promise to %s", &receiver); n > 0 {
event.Type = PROMISE
event.Receiver = w.scene.identifierToIndex(receiver)
} else if n, _ := fmt.Sscanf(e.Log, "sent signature to %s", &receiver); n > 0 {
} else if n, _ := fmt.Sscanf(e.Log, "successfully sent signature to %s", &receiver); n > 0 {
event.Type = SIGNATURE
event.Receiver = w.scene.identifierToIndex(receiver)
} else if n, _ := fmt.Sscanf(e.Log, "contacting TTP with resolve index %d", &index); n > 0 {
......
......@@ -43,32 +43,6 @@ func TestWrongRegisterRequest(t *testing.T) {
assert.Equal(t, errCode.Code, api.ErrorCode_INVARG)
}
func TestWrongAuthRequest(t *testing.T) {
// Get a client to the invalid server (cert duration is -1)
client := clientTest(t, InvalidServ)
// Invalid mail length
inv := &api.AuthRequest{}
msg, err := client.Auth(context.Background(), inv)
if msg != nil || err == nil {
t.Fatal("The request should have been evaluated as invalid")
}
// Invalid token length
inv.Email = "foo"
msg, err = client.Auth(context.Background(), inv)
if msg != nil || err == nil {
t.Fatal("The request should have been evaluated as invalid")
}
// Invalid certificate validity duration
inv.Token = "foo"
msg, err = client.Auth(context.Background(), inv)
if msg != nil || err == nil {
t.Fatal("The request should have been evaluated as invalid")
}
}
func TestAuthUserNotFound(t *testing.T) {
mail := "wrong@wrong.wrong"
token := "wrong"
......
......@@ -60,6 +60,7 @@ func Connect(addrPort string, cert *x509.Certificate, key *rsa.PrivateKey, ca *x
addrPort,
grpc.WithTransportCredentials(&tlsCreds{config: conf, serverCertHash: serverCertHash}),
grpc.WithTimeout(DefaultTimeout),
grpc.WithBlock(),
)
}
......
......@@ -138,13 +138,7 @@ func TestServerClientBadAuthWrongCertificateHash(t *testing.T) {
cert, _ := auth.PEMToCertificate([]byte(clientCertFixture))
key, _ := auth.PEMToPrivateKey([]byte(clientKeyFixture))
// The connection won't fail immediately, because grpc is connecting in the background
conn, _ := Connect("localhost:9000", cert, key, ca, auth.GetCertificateHash(cert))
// We have to ask for a specific query in order to test the certificate hash
client := pb.NewTestClient(conn)
_, err := client.Ping(context.Background(), &pb.Hop{Id: 1})
_, err := Connect("localhost:9000", cert, key, ca, auth.GetCertificateHash(cert))
if err == nil {
t.Fatal("Successfully connected with bad hash")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment