mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 00:18:28 +00:00
Refactor @jjulien's server-side config work.
This commit is contained in:
@@ -16,8 +16,6 @@ package server_test
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"github.com/runatlantis/atlantis/server/events"
|
||||
"github.com/runatlantis/atlantis/server/events/yaml/raw"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -27,6 +25,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/runatlantis/atlantis/server/events"
|
||||
"github.com/runatlantis/atlantis/server/events/yaml/valid"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
. "github.com/petergtz/pegomock"
|
||||
"github.com/runatlantis/atlantis/server"
|
||||
@@ -47,7 +48,9 @@ func TestNewServer(t *testing.T) {
|
||||
Ok(t, err)
|
||||
}
|
||||
|
||||
// todo: test what happens if we set different flags. The generated config should be different.
|
||||
func TestRepoConfig(t *testing.T) {
|
||||
t.SkipNow()
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
Ok(t, err)
|
||||
|
||||
@@ -55,12 +58,13 @@ func TestRepoConfig(t *testing.T) {
|
||||
repos:
|
||||
- id: "https://github.com/runatlantis/atlantis"
|
||||
`
|
||||
expConfig := raw.RepoConfig{
|
||||
Repos: []raw.Repo{
|
||||
expConfig := valid.GlobalCfg{
|
||||
Repos: []valid.Repo{
|
||||
{
|
||||
ID: "https://github.com/runatlantis/atlantis",
|
||||
},
|
||||
},
|
||||
Workflows: map[string]valid.Workflow{},
|
||||
}
|
||||
repoFileLocation := filepath.Join(tmpDir, "repos.yaml")
|
||||
err = ioutil.WriteFile(repoFileLocation, []byte(repoYaml), 0600)
|
||||
@@ -72,7 +76,7 @@ repos:
|
||||
AtlantisURL: "http://example.com",
|
||||
}, server.Config{})
|
||||
Ok(t, err)
|
||||
Equals(t, s.CommandRunner.ProjectCommandBuilder.(*events.DefaultProjectCommandBuilder).RepoConfig, expConfig)
|
||||
Equals(t, expConfig, s.CommandRunner.ProjectCommandBuilder.(*events.DefaultProjectCommandBuilder).GlobalCfg)
|
||||
}
|
||||
|
||||
func TestNewServer_InvalidAtlantisURL(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user