1// Copyright 2019 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Code generated by gapic-generator. DO NOT EDIT.
16
17package language
18
19import (
20	"context"
21	"fmt"
22	"strconv"
23	"testing"
24	"time"
25
26	"cloud.google.com/go/internal/testutil"
27	"google.golang.org/api/iterator"
28	"google.golang.org/api/option"
29	languagepb "google.golang.org/genproto/googleapis/cloud/language/v1"
30)
31
32var _ = fmt.Sprintf
33var _ = iterator.Done
34var _ = strconv.FormatUint
35var _ = time.Now
36
37func TestLanguageServiceSmoke(t *testing.T) {
38	if testing.Short() {
39		t.Skip("skipping smoke test in short mode")
40	}
41	ctx := context.Background()
42	ts := testutil.TokenSource(ctx, DefaultAuthScopes()...)
43	if ts == nil {
44		t.Skip("Integration tests skipped. See CONTRIBUTING.md for details")
45	}
46
47	projectId := testutil.ProjID()
48	_ = projectId
49
50	c, err := NewClient(ctx, option.WithTokenSource(ts))
51	if err != nil {
52		t.Fatal(err)
53	}
54
55	var content string = "Hello, world!"
56	var type_ languagepb.Document_Type = languagepb.Document_PLAIN_TEXT
57	var document = &languagepb.Document{
58		Source: &languagepb.Document_Content{
59			Content: content,
60		},
61		Type: type_,
62	}
63	var request = &languagepb.AnalyzeSentimentRequest{
64		Document: document,
65	}
66
67	if _, err := c.AnalyzeSentiment(ctx, request); err != nil {
68		t.Error(err)
69	}
70}
71