mirror

Mirror free and open-source projects you like with minimal effort
git clone git://git.server.ky/slackcoder/mirror
Log | Files | Refs | README

mirror_test.go (633B)


      1 package service
      2 
      3 import (
      4 	"testing"
      5 
      6 	"git.server.ky/slackcoder/mirror/internal"
      7 	"github.com/BurntSushi/toml"
      8 	"github.com/stretchr/testify/require"
      9 )
     10 
     11 func TestMirrorUnmarshalTOML(t *testing.T) {
     12 	str := internal.MustTOML(map[string]interface{}{
     13 		"method": "git",
     14 		"from":   "https://git.taler.net/merchant.git",
     15 		"to":     "/mirror/merchant",
     16 	})
     17 
     18 	exp := Mirror{
     19 		Method: "git",
     20 		From:   internal.MustURL("https://git.taler.net/merchant.git"),
     21 		To:     internal.MustURL("/mirror/merchant"),
     22 	}
     23 
     24 	var s Mirror
     25 
     26 	err := toml.Unmarshal([]byte(str), &s)
     27 
     28 	require.NoError(t, err)
     29 	require.Equal(t, exp.String(), s.String())
     30 }