github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/internal/getproviders/legacy_lookup_test.go (about)

     1  package getproviders
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/addrs"
     7  )
     8  
     9  func TestLookupLegacyProvider(t *testing.T) {
    10  	source, _, close := testRegistrySource(t)
    11  	defer close()
    12  
    13  	got, err := LookupLegacyProvider(
    14  		addrs.NewLegacyProvider("legacy"),
    15  		source,
    16  	)
    17  	if err != nil {
    18  		t.Fatalf("unexpected error: %s", err)
    19  	}
    20  
    21  	want := addrs.Provider{
    22  		Hostname:  defaultRegistryHost,
    23  		Namespace: "legacycorp",
    24  		Type:      "legacy",
    25  	}
    26  	if got != want {
    27  		t.Errorf("wrong result\ngot:  %#v\nwant: %#v", got, want)
    28  	}
    29  }