gitlyx / config / loader_test.v
22 lines · 18 sloc · 639 bytes · 31b1cb297e0cd7893d102dbf7410a58b89a2cf54
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 assert conf.usdt_wallet == ''
22}
23