app-service-registration_test.go (895B)
1 package registration 2 3 import "testing" 4 5 var data = NewAppServiceRegistration("localhost") 6 7 func TestSettingData(t *testing.T) { 8 if data.Url != "localhost" { 9 t.Error("AppServiceUrl did not get set on init!") 10 } 11 12 AsToken := GenerateToken() 13 data.SetAppServiceToken(AsToken) 14 if data.AsToken != AsToken { 15 t.Error("AsToken did not get set!") 16 } 17 18 HsToken := GenerateToken() 19 data.SetHomeserverToken(HsToken) 20 if data.HsToken != HsToken { 21 t.Error("HsToken did not get set!") 22 } 23 24 ID := GenerateToken() 25 data.SetID(ID) 26 if data.Id != ID { 27 t.Error("ID did not get set!") 28 } 29 30 data.SetAppServiceUrl("localhost1") 31 if data.Url != "localhost1" { 32 t.Error("AppServiceUrl did not get changed!") 33 } 34 35 data.SetSenderLocalpart("bot") 36 if data.SenderLocalpart != "bot" { 37 t.Error("SenderLocalpart did not get changed!") 38 } 39 } 40 41 func TestExportingData(t *testing.T) { 42 data.OutputAsYaml("test.yaml") 43 }