plz / config / loader_test.v
21 lines · 17 sloc · 608 bytes · a638a16af00f82797f0d324a6f6be16b576b0a3c
Raw
1module config
2
3import os
4
5fn test_read_config_uses_database_defaults() {
6 path := os.join_path(os.temp_dir(), 'gitly_config_defaults_${os.getpid()}.json')
7 os.write_file(path,
8 '{"repo_storage_path":"./repos","archive_path":"./archives","avatars_path":"./avatars","hostname":"gitly.test","ci_service_url":"http://localhost:8081"}')!
9 defer {
10 os.rm(path) or {}
11 }
12
13 conf := read_config(path)!
14
15 assert conf.pg.host == 'localhost'
16 assert conf.pg.port == 5432
17 assert conf.pg.dbname == 'gitly'
18 assert conf.pg.user == 'gitly'
19 assert conf.pg.password == 'gitly'
20 assert conf.sqlite.path == 'gitly.sqlite'
21}
22