Commit 416431c8 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

test: move all nonlocal tests to test files excluded by --tags=local_tests

parent b1c78e0e
......@@ -120,11 +120,6 @@ func TestPostgresDBLoginToken(t *testing.T) {
}, cand)
}
var (
str15 = "15"
strEmpty = ""
)
func TestPostgresDBUserInfo(t *testing.T) {
SetupDatabase(t)
defer TeardownDatabase(t)
......
......@@ -21,8 +21,13 @@ func init() {
irma.Logger.SetLevel(logrus.FatalLevel)
}
var (
str15 = "15"
strEmpty = ""
)
func TestServerInvalidMessage(t *testing.T) {
myirmaServer, httpServer := StartMyIrmaServer(t, newMemoryDB(), "localhost:1025")
myirmaServer, httpServer := StartMyIrmaServer(t, newMemoryDB(), "")
defer StopMyIrmaServer(t, myirmaServer, httpServer)
test.HTTPGet(t, nil, "http://localhost:8080/user", nil, 400, nil)
......
package tasks
import (
"path/filepath"
"testing"
irma "github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/test"
"github.com/privacybydesign/irmago/server/keyshare"
"github.com/stretchr/testify/assert"
)
func TestConfiguration(t *testing.T) {
testdataPath := test.FindTestdataFolder(t)
err := processConfiguration(&Configuration{Logger: irma.Logger})
assert.NoError(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
DefaultLanguage: "en",
},
DeleteExpiredAccountFiles: map[string]string{
"en": filepath.Join(testdataPath, "emailtemplate.html"),
},
DeleteExpiredAccountSubjects: map[string]string{
"en": "testsubject",
},
Logger: irma.Logger,
})
assert.NoError(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
},
DeleteExpiredAccountFiles: map[string]string{
"en": filepath.Join(testdataPath, "emailtemplate.html"),
},
DeleteExpiredAccountSubjects: map[string]string{
"en": "testsubject",
},
Logger: irma.Logger,
})
assert.Error(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
DefaultLanguage: "en",
},
DeleteExpiredAccountSubjects: map[string]string{
"en": "testsubject",
},
Logger: irma.Logger,
})
assert.Error(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
DefaultLanguage: "en",
},
DeleteExpiredAccountFiles: map[string]string{
"en": filepath.Join(testdataPath, "emailtemplate.html"),
},
Logger: irma.Logger,
})
assert.Error(t, err)
}
......@@ -128,6 +128,70 @@ func TestExpireAccounts(t *testing.T) {
assert.Equal(t, 1, countRows(t, db, "users", "delete_on IS NOT NULL"))
}
func TestConfiguration(t *testing.T) {
testdataPath := test.FindTestdataFolder(t)
err := processConfiguration(&Configuration{Logger: irma.Logger})
assert.NoError(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
DefaultLanguage: "en",
},
DeleteExpiredAccountFiles: map[string]string{
"en": filepath.Join(testdataPath, "emailtemplate.html"),
},
DeleteExpiredAccountSubjects: map[string]string{
"en": "testsubject",
},
Logger: irma.Logger,
})
assert.NoError(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
},
DeleteExpiredAccountFiles: map[string]string{
"en": filepath.Join(testdataPath, "emailtemplate.html"),
},
DeleteExpiredAccountSubjects: map[string]string{
"en": "testsubject",
},
Logger: irma.Logger,
})
assert.Error(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
DefaultLanguage: "en",
},
DeleteExpiredAccountSubjects: map[string]string{
"en": "testsubject",
},
Logger: irma.Logger,
})
assert.Error(t, err)
err = processConfiguration(&Configuration{
EmailConfiguration: keyshare.EmailConfiguration{
EmailServer: "localhost:1025",
EmailFrom: "test@test.com",
DefaultLanguage: "en",
},
DeleteExpiredAccountFiles: map[string]string{
"en": filepath.Join(testdataPath, "emailtemplate.html"),
},
Logger: irma.Logger,
})
assert.Error(t, err)
}
func SetupDatabase(t *testing.T) {
test.RunScriptOnDB(t, "../cleanup.sql", true)
test.RunScriptOnDB(t, "../schema.sql", false)
......
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