|
| 1 | +// Vikunja is a to-do list application to facilitate your life. |
| 2 | +// Copyright 2018-present Vikunja and contributors. All rights reserved. |
| 3 | +// |
| 4 | +// This program is free software: you can redistribute it and/or modify |
| 5 | +// it under the terms of the GNU Affero General Public License as published by |
| 6 | +// the Free Software Foundation, either version 3 of the License, or |
| 7 | +// (at your option) any later version. |
| 8 | +// |
| 9 | +// This program is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +// GNU Affero General Public License for more details. |
| 13 | +// |
| 14 | +// You should have received a copy of the GNU Affero General Public License |
| 15 | +// along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | +package doctor |
| 18 | + |
| 19 | +import ( |
| 20 | + "bytes" |
| 21 | + "testing" |
| 22 | + |
| 23 | + "github.com/stretchr/testify/assert" |
| 24 | +) |
| 25 | + |
| 26 | +func TestPrintGroup(t *testing.T) { |
| 27 | + var buf bytes.Buffer |
| 28 | + |
| 29 | + PrintHeader(&buf) |
| 30 | + PrintGroup(&buf, CheckGroup{ |
| 31 | + Name: "Files (s3)", |
| 32 | + Results: []CheckResult{ |
| 33 | + {Name: "Endpoint", Passed: true, Value: "http://localhost:9000"}, |
| 34 | + {Name: "Initialization", Passed: false, Error: "S3 endpoint http://localhost:9000 did not respond within 12s"}, |
| 35 | + {Name: "CORS", Passed: true, Value: "2 origins", Lines: []string{"a", "b"}}, |
| 36 | + }, |
| 37 | + }) |
| 38 | + |
| 39 | + assert.Equal(t, `Vikunja Doctor |
| 40 | +============== |
| 41 | +
|
| 42 | +Files (s3) |
| 43 | + ✓ Endpoint: http://localhost:9000 |
| 44 | + ✗ Initialization: S3 endpoint http://localhost:9000 did not respond within 12s |
| 45 | + ✓ CORS: 2 origins |
| 46 | + a |
| 47 | + b |
| 48 | +
|
| 49 | +`, buf.String()) |
| 50 | +} |
0 commit comments