Skip to content

Commit 746acae

Browse files
authored
chore: fix tests (#20)
1 parent 8c23074 commit 746acae

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

internal/provider/example_data_source.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package provider
66
import (
77
"context"
88
"fmt"
9-
"net/http"
109

1110
"github.com/hashicorp/terraform-plugin-framework/datasource"
1211
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
@@ -23,7 +22,7 @@ func NewExampleDataSource() datasource.DataSource {
2322

2423
// ExampleDataSource defines the data source implementation.
2524
type ExampleDataSource struct {
26-
client *http.Client
25+
data *CoderdProviderData
2726
}
2827

2928
// ExampleDataSourceModel describes the data source data model.
@@ -60,18 +59,18 @@ func (d *ExampleDataSource) Configure(ctx context.Context, req datasource.Config
6059
return
6160
}
6261

63-
client, ok := req.ProviderData.(*http.Client)
62+
client, ok := req.ProviderData.(*CoderdProviderData)
6463

6564
if !ok {
6665
resp.Diagnostics.AddError(
6766
"Unexpected Data Source Configure Type",
68-
fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
67+
fmt.Sprintf("Expected *CoderdProviderData, got: %T. Please report this issue to the provider developers.", req.ProviderData),
6968
)
7069

7170
return
7271
}
7372

74-
d.client = client
73+
d.data = client
7574
}
7675

7776
func (d *ExampleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {

internal/provider/example_data_source_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func TestAccExampleDataSource(t *testing.T) {
2626
}
2727

2828
const testAccExampleDataSourceConfig = `
29+
provider coderd {
30+
url = "https://dev.coder.com"
31+
token = "iamnotarealtoken"
32+
}
33+
2934
data "coderd_example" "test" {
3035
configurable_attribute = "example"
3136
}

internal/provider/user_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (r *UserResource) Configure(ctx context.Context, req resource.ConfigureRequ
135135
if !ok {
136136
resp.Diagnostics.AddError(
137137
"Unexpected Resource Configure Type",
138-
fmt.Sprintf("Expected *codersdk.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
138+
fmt.Sprintf("Expected *CoderdProviderData, got: %T. Please report this issue to the provider developers.", req.ProviderData),
139139
)
140140

141141
return

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy