-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration_test.go
38 lines (35 loc) · 1.31 KB
/
configuration_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright (c) 2021.
* Marc Concepcion
* marcanthonyconcepcion@gmail.com
*/
package MarcGoRESTAPIDemo
import (
"testing"
)
func TestReadYamlFile(t *testing.T) {
configuration := readConfiguration("resources/MarcGoRESTAPIDemo.yaml")
defer func() {
if fault := recover(); fault != nil {
t.Errorf("Error reading configuration file %s.", fault)
}
}()
if "localhost" != configuration.Database.Host {
t.Errorf("Value %s is NOT the expected database host from the config file.", configuration.Database.Host)
}
if 3306 != configuration.Database.Port {
t.Errorf("Value %d is NOT the expected database port from the config file.", configuration.Database.Port)
}
if "subscribers_database" != configuration.Database.DBName {
t.Errorf("Value %s is NOT the expected database name from the config file.", configuration.Database.DBName)
}
if "user" != configuration.Database.User {
t.Errorf("Value %s is NOT the expected database user from the config file.", configuration.Database.User)
}
if "password" != configuration.Database.Password {
t.Errorf("Value %s is NOT the expected database password from the config file.", configuration.Database.Password)
}
if "subscribers" != configuration.MVC.Resource {
t.Errorf("Value %s is NOT the expected mvc resource from the config file.", configuration.MVC.Resource)
}
}