1
1
mirror of https://github.com/openziti/zrok.git synced 2025-07-15 13:45:18 +02:00

ephemeral/non-ephemeral environments (, )

This commit is contained in:
Michael Quigley
2022-11-17 13:27:57 -05:00
parent b9dca57dfa
commit f193976a50

@ -27,3 +27,34 @@ func TestEphemeralEnvironment(t *testing.T) {
assert.NotNil(t, env)
assert.Nil(t, env.AccountId)
}
func TestEnvironment(t *testing.T) {
str, err := Open(&Config{Path: ":memory:", Type: "sqlite3"})
assert.Nil(t, err)
assert.NotNil(t, str)
tx, err := str.Begin()
assert.Nil(t, err)
assert.NotNil(t, tx)
acctId, err := str.CreateAccount(&Account{
Email: "test@test.com",
Password: "password",
Token: "token",
}, tx)
assert.Nil(t, err)
envId, err := str.CreateEnvironment(acctId, &Environment{
Description: "description",
Host: "host",
Address: "address",
ZId: "zId0",
}, tx)
assert.Nil(t, err)
env, err := str.GetEnvironment(envId, tx)
assert.Nil(t, err)
assert.NotNil(t, env)
assert.NotNil(t, env.AccountId)
assert.Equal(t, acctId, *env.AccountId)
}