github.com/wit-ai/wit-go/v2@v2.0.2/export_test.go (about)

     1  // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
     2  
     3  package witai
     4  
     5  import (
     6  	"net/http"
     7  	"net/http/httptest"
     8  	"testing"
     9  )
    10  
    11  func TestExport(t *testing.T) {
    12  	testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
    13  		res.Write([]byte(`{"uri": "https://download"}`))
    14  	}))
    15  	defer func() { testServer.Close() }()
    16  
    17  	c := NewClient(unitTestToken)
    18  	c.APIBase = testServer.URL
    19  	uri, _ := c.Export()
    20  
    21  	if uri != "https://download" {
    22  		t.Fatalf("wrong download uri, got: %s", uri)
    23  	}
    24  }