1e8b482c23
In turn, this allows us to identify as ooniprobe-cli v3.0.0-rc.5. Closes #41.
30 lines
567 B
Go
30 lines
567 B
Go
package ooni
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"path"
|
|
"testing"
|
|
)
|
|
|
|
func TestInit(t *testing.T) {
|
|
ooniHome, err := ioutil.TempDir("", "oonihome")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer os.RemoveAll(ooniHome)
|
|
|
|
ctx := NewContext("", ooniHome)
|
|
swName := "ooniprobe-cli-tests"
|
|
swVersion := "3.0.0-alpha"
|
|
if err := ctx.Init(swName, swVersion); err != nil {
|
|
t.Error(err)
|
|
t.Fatal("failed to init the context")
|
|
}
|
|
|
|
configPath := path.Join(ooniHome, "config.json")
|
|
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
|
t.Fatal("config file was not created")
|
|
}
|
|
}
|