Checkpoint audio-only Skald fork work
This commit is contained in:
+19
-19
@@ -59,12 +59,12 @@ func TestEmptyJSON(t *testing.T) {
|
||||
var descJSON = `
|
||||
{
|
||||
"max-history-age": 10,
|
||||
"auto-subgroups": true,
|
||||
"auto-subhalls": true,
|
||||
"users": {
|
||||
"jch": {"password": "topsecret", "permissions": "op"},
|
||||
"john": {"password": "secret", "permissions": "present"},
|
||||
"james": {"password": "secret2", "permissions": "message"},
|
||||
"peter": {"password": "secret4"}
|
||||
"user1": {"password": "topsecret", "permissions": "op"},
|
||||
"user2": {"password": "secret", "permissions": "present"},
|
||||
"user3": {"password": "secret2", "permissions": "message"},
|
||||
"user4": {"password": "secret4"}
|
||||
},
|
||||
"wildcard-user":
|
||||
{"permissions": "message", "password": {"type":"wildcard"}}
|
||||
@@ -95,15 +95,15 @@ func TestDescriptionJSON(t *testing.T) {
|
||||
|
||||
var obsoleteJSON = `
|
||||
{
|
||||
"op": [{"username": "jch","password": "topsecret"}],
|
||||
"op": [{"username": "user1","password": "topsecret"}],
|
||||
"max-history-age": 10,
|
||||
"allow-subgroups": true,
|
||||
"allow-subhalls": true,
|
||||
"presenter": [
|
||||
{"username": "john", "password": "secret"}
|
||||
{"username": "user2", "password": "secret"}
|
||||
],
|
||||
"other": [
|
||||
{"username": "james", "password": "secret2"},
|
||||
{"username": "peter", "password": "secret4"},
|
||||
{"username": "user3", "password": "secret2"},
|
||||
{"username": "user4", "password": "secret4"},
|
||||
{}
|
||||
]
|
||||
}`
|
||||
@@ -124,9 +124,9 @@ func TestUpgradeDescription(t *testing.T) {
|
||||
t.Fatalf("upgradeDescription: %v", err)
|
||||
}
|
||||
|
||||
if d1.AutoSubgroups != d2.AutoSubgroups ||
|
||||
d1.AllowSubgroups != d2.AllowSubgroups {
|
||||
t.Errorf("AllowSubgroups not upgraded correctly")
|
||||
if d1.AutoSubhalls != d2.AutoSubhalls ||
|
||||
d1.AllowSubhalls != d2.AllowSubhalls {
|
||||
t.Errorf("AllowSubhalls not upgraded correctly")
|
||||
}
|
||||
|
||||
if d2.Op != nil || d2.Presenter != nil || d2.Other != nil {
|
||||
@@ -139,7 +139,7 @@ func TestUpgradeDescription(t *testing.T) {
|
||||
}
|
||||
|
||||
for k, v1 := range d1.Users {
|
||||
if k == "peter" {
|
||||
if k == "user4" {
|
||||
// not representable in the old format
|
||||
continue
|
||||
}
|
||||
@@ -176,13 +176,13 @@ func setupTest(dir, datadir string, writable bool) error {
|
||||
defer f.Close()
|
||||
conf := `{}`
|
||||
if writable {
|
||||
conf = `{"writableGroups": true}`
|
||||
conf = `{"writableHalls": true}`
|
||||
}
|
||||
_, err = f.WriteString(conf)
|
||||
return err
|
||||
}
|
||||
|
||||
func TestNonWritableGroups(t *testing.T) {
|
||||
func TestNonWritableHalls(t *testing.T) {
|
||||
err := setupTest(t.TempDir(), t.TempDir(), false)
|
||||
if err != nil {
|
||||
t.Fatalf("setupTest: %v", err)
|
||||
@@ -200,7 +200,7 @@ func TestNonWritableGroups(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWritableGroups(t *testing.T) {
|
||||
func TestWritableHalls(t *testing.T) {
|
||||
err := setupTest(t.TempDir(), t.TempDir(), true)
|
||||
if err != nil {
|
||||
t.Fatalf("setupTest: %v", err)
|
||||
@@ -259,7 +259,7 @@ func TestWritableGroups(t *testing.T) {
|
||||
nil, "Test", err, desc.AllowAnonymous,
|
||||
)
|
||||
}
|
||||
testUser(t, "jch", false)
|
||||
testUser(t, "user1", false)
|
||||
testUser(t, "", true)
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ func testUser(t *testing.T, username string, wildcard bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubGroup(t *testing.T) {
|
||||
func TestSubHall(t *testing.T) {
|
||||
err := setupTest(t.TempDir(), t.TempDir(), true)
|
||||
if err != nil {
|
||||
t.Fatalf("setupTest: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user