mirror of https://github.com/writeas/writefreely
commit
b3dd06c79b
@ -1,28 +0,0 @@ |
||||
[server] |
||||
hidden_host = |
||||
port = 8080 |
||||
|
||||
[database] |
||||
type = mysql |
||||
username = root |
||||
password = changeme |
||||
database = writefreely |
||||
host = db |
||||
port = 3306 |
||||
tls = false |
||||
|
||||
[app] |
||||
site_name = WriteFreely Example Blog! |
||||
host = http://localhost:8080 |
||||
theme = write |
||||
disable_js = false |
||||
webfonts = true |
||||
single_user = true |
||||
open_registration = false |
||||
min_username_len = 3 |
||||
max_blogs = 1 |
||||
federation = true |
||||
public_stats = true |
||||
private = false |
||||
update_checks = true |
||||
|
@ -1,32 +1,47 @@ |
||||
version: "3" |
||||
|
||||
volumes: |
||||
web-keys: |
||||
db-data: |
||||
|
||||
networks: |
||||
external_writefreely: |
||||
internal_writefreely: |
||||
internal: true |
||||
|
||||
services: |
||||
web: |
||||
build: . |
||||
writefreely-web: |
||||
container_name: "writefreely-web" |
||||
image: "writefreely:latest" |
||||
|
||||
volumes: |
||||
- "web-data:/go/src/app" |
||||
- "./config.ini.example:/go/src/app/config.ini" |
||||
- "web-keys:/go/keys" |
||||
- "./config.ini:/go/config.ini" |
||||
|
||||
networks: |
||||
- "internal_writefreely" |
||||
- "external_writefreely" |
||||
|
||||
ports: |
||||
- "8080:8080" |
||||
networks: |
||||
- writefreely |
||||
|
||||
depends_on: |
||||
- db |
||||
- "writefreely-db" |
||||
|
||||
restart: unless-stopped |
||||
db: |
||||
|
||||
writefreely-db: |
||||
container_name: "writefreely-db" |
||||
image: "mariadb:latest" |
||||
|
||||
volumes: |
||||
- "./schema.sql:/tmp/schema.sql" |
||||
- db-data:/var/lib/mysql/data |
||||
- "db-data:/var/lib/mysql/data" |
||||
|
||||
networks: |
||||
- writefreely |
||||
- "internal_writefreely" |
||||
|
||||
environment: |
||||
- MYSQL_DATABASE=writefreely |
||||
- MYSQL_ROOT_PASSWORD=changeme |
||||
restart: unless-stopped |
||||
|
||||
volumes: |
||||
web-data: |
||||
db-data: |
||||
|
||||
networks: |
||||
writefreely: |
||||
restart: unless-stopped |
||||
|
@ -0,0 +1,35 @@ |
||||
package writefreely_test |
||||
|
||||
import ( |
||||
"testing" |
||||
|
||||
"github.com/guregu/null/zero" |
||||
"github.com/stretchr/testify/assert" |
||||
"github.com/writeas/writefreely" |
||||
) |
||||
|
||||
func TestPostSummary(t *testing.T) { |
||||
testCases := map[string]struct { |
||||
given writefreely.Post |
||||
expected string |
||||
}{ |
||||
"no special chars": {givenPost("Content."), "Content."}, |
||||
"HTML content": {givenPost("Content <p>with a</p> paragraph."), "Content with a paragraph."}, |
||||
"content with escaped char": {givenPost("Content's all OK."), "Content's all OK."}, |
||||
"multiline content": {givenPost(`Content |
||||
in |
||||
multiple |
||||
lines.`), "Content in multiple lines."}, |
||||
} |
||||
|
||||
for name, test := range testCases { |
||||
t.Run(name, func(t *testing.T) { |
||||
actual := test.given.Summary() |
||||
assert.Equal(t, test.expected, actual) |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func givenPost(content string) writefreely.Post { |
||||
return writefreely.Post{Title: zero.StringFrom("Title"), Content: content} |
||||
} |
Loading…
Reference in new issue