-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathgithub_app_installation_integration_test.go
47 lines (39 loc) · 1.22 KB
/
github_app_installation_integration_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package tfe
import (
"context"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"os"
"testing"
)
func TestGHAInstallationList(t *testing.T) {
gHAInstallationID := os.Getenv("GITHUB_APP_INSTALLATION_ID")
if gHAInstallationID == "" {
t.Skip("Export a valid GITHUB_APP_INSTALLATION_ID before running this test!")
}
client := testClient(t)
ctx := context.Background()
t.Run("without list options", func(t *testing.T) {
_, err := client.GHAInstallations.List(ctx, nil)
assert.NoError(t, err)
})
}
func TestGHAInstallationRead(t *testing.T) {
gHAInstallationID := os.Getenv("GITHUB_APP_INSTALLATION_ID")
if gHAInstallationID == "" {
t.Skip("Export a valid GITHUB_APP_INSTALLATION_ID before running this test!")
}
var GHAInstallationID = string(gHAInstallationID)
client := testClient(t)
ctx := context.Background()
t.Run("when installation id exists", func(t *testing.T) {
ghais, err := client.GHAInstallations.Read(ctx, GHAInstallationID)
require.NoError(t, err)
assert.NotEmpty(t, ghais.InstallationID)
assert.NotEmpty(t, ghais.ID)
assert.NotEmpty(t, ghais.Name)
assert.Equal(t, *ghais.ID, gHAInstallationID)
})
}