Skip to content

Commit 3ee12ce

Browse files
pieternnfx
authored andcommitted
Similar DELETE test for all new SQLA resources
1 parent b9be159 commit 3ee12ce

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

sqlanalytics/resource_query_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,5 @@ func TestQueryDelete(t *testing.T) {
383383
}.Apply(t)
384384

385385
assert.NoError(t, err, err)
386-
387-
// Delete doesn't touch schema.ResourceData, so the ID should survive.
388-
assert.Equal(t, "foo", d.Id())
386+
assert.Equal(t, "foo", d.Id(), "Resource ID should not be empty")
389387
}

sqlanalytics/resource_visualization_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,5 @@ func TestVisualizationDelete(t *testing.T) {
238238
}.Apply(t)
239239

240240
assert.NoError(t, err, err)
241-
242-
// Delete doesn't touch schema.ResourceData, so the ID should survive.
243-
assert.Equal(t, "12345", d.Id())
241+
assert.Equal(t, "12345", d.Id(), "Resource ID should not be empty")
244242
}

sqlanalytics/resource_widget_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,20 @@ func TestWidgetCreateWithParamValue(t *testing.T) {
152152
assert.Equal(t, "12345", d.Id(), "Resource ID should not be empty")
153153
assert.Equal(t, "678", d.Get("visualization_id"))
154154
}
155+
156+
func TestWidgetDelete(t *testing.T) {
157+
d, err := qa.ResourceFixture{
158+
Fixtures: []qa.HTTPFixture{
159+
{
160+
Method: "DELETE",
161+
Resource: "/api/2.0/preview/sql/widgets/12345",
162+
},
163+
},
164+
Resource: ResourceWidget(),
165+
Delete: true,
166+
ID: "12345",
167+
}.Apply(t)
168+
169+
assert.NoError(t, err, err)
170+
assert.Equal(t, "12345", d.Id(), "Resource ID should not be empty")
171+
}

0 commit comments

Comments
 (0)