From 6a382db2d38139337682faa66a531b7654aa5076 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Thu, 20 Jun 2024 20:35:27 +0530 Subject: [PATCH 01/10] integration tests --- test/integration/account_invoice_test.go | 65 +++++++++++++++ test/integration/account_settings_test.go | 69 ++++++++++++++++ test/integration/account_transfer_test.go | 33 ++++++++ .../fixtures/TestAccountSettings.yaml | 51 ++++++++++++ .../fixtures/TestAccountTransfer_Get.yaml | 79 +++++++++++++++++++ .../fixtures/TestInvoiceItems_List.yaml | 20 +++++ .../integration/fixtures/TestInvoice_Get.yaml | 20 +++++ .../fixtures/TestInvoice_List.yaml | 20 +++++ 8 files changed, 357 insertions(+) create mode 100644 test/integration/account_invoice_test.go create mode 100644 test/integration/account_settings_test.go create mode 100644 test/integration/account_transfer_test.go create mode 100644 test/integration/fixtures/TestAccountSettings.yaml create mode 100644 test/integration/fixtures/TestAccountTransfer_Get.yaml create mode 100644 test/integration/fixtures/TestInvoiceItems_List.yaml create mode 100644 test/integration/fixtures/TestInvoice_Get.yaml create mode 100644 test/integration/fixtures/TestInvoice_List.yaml diff --git a/test/integration/account_invoice_test.go b/test/integration/account_invoice_test.go new file mode 100644 index 000000000..b6539139b --- /dev/null +++ b/test/integration/account_invoice_test.go @@ -0,0 +1,65 @@ +package integration + +import ( + "context" + "testing" +) + +func TestInvoice_List(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestInvoice_List") + defer teardown() + + invoices, err := client.ListInvoices(context.Background(), nil) + if err != nil { + t.Fatalf("Error getting Invoices, expected struct, got error %v", err) + } + + if len(invoices) == 0 { + t.Fatalf("Expected to see invoices returned.") + } +} + +func TestInvoice_Get(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestInvoice_Get") + defer teardown() + + invoice, err := client.GetInvoice(context.Background(), 123) + if err != nil { + t.Fatalf("Error getting Invoice, expected struct, got error %v", err) + } + + if invoice.ID != 123 { + t.Fatalf("Expected Invoice ID to be 123, got %v", invoice.ID) + } + + if invoice.Label != "Invoice" { + t.Fatalf("Expected Invoice Label to be 'Invoice', got %v", invoice.Label) + } + + if invoice.Total != 132.5 { + t.Fatalf("Expected Invoice Total to be 132.5, got %v", invoice.Total) + } +} + +func TestInvoiceItems_List(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestInvoiceItems_List") + defer teardown() + + items, err := client.ListInvoiceItems(context.Background(), 123, nil) + if err != nil { + t.Fatalf("Error getting Invoice Items, expected struct, got error %v", err) + } + + if len(items) == 0 { + t.Fatalf("Expected to see invoice items returned.") + } + + item := items[0] + if item.Label != "Linode 2GB" { + t.Fatalf("Expected item label to be 'Linode 2GB', got %v", item.Label) + } + + if item.Amount != 10 { + t.Fatalf("Expected item amount to be 10, got %v", item.Amount) + } +} \ No newline at end of file diff --git a/test/integration/account_settings_test.go b/test/integration/account_settings_test.go new file mode 100644 index 000000000..a27099b54 --- /dev/null +++ b/test/integration/account_settings_test.go @@ -0,0 +1,69 @@ +package integration + +import ( + "context" + "testing" + + "github.com/linode/linodego" +) + +func TestAccountSettings_Get(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestAccountSettings") + defer teardown() + + settings, err := client.GetAccountSettings(context.Background()) + if err != nil { + t.Fatalf("Error getting Account Settings, expected struct, got error %v", err) + } + + if settings.BackupsEnabled != true { + t.Fatalf("Expected BackupsEnabled to be true, got %v", settings.BackupsEnabled) + } + + if settings.Managed != true { + t.Fatalf("Expected Managed to be true, got %v", settings.Managed) + } + + if settings.NetworkHelper != true { + t.Fatalf("Expected NetworkHelper to be true, got %v", settings.NetworkHelper) + } + + if settings.LongviewSubscription == nil || *settings.LongviewSubscription != "longview-3" { + t.Fatalf("Expected LongviewSubscription to be 'longview-3', got %v", settings.LongviewSubscription) + } + + if settings.ObjectStorage == nil || *settings.ObjectStorage != "active" { + t.Fatalf("Expected ObjectStorage to be 'active', got %v", settings.ObjectStorage) + } +} + +func TestAccountSettings_Update(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestAccountSettings") + defer teardown() + + opts := linodego.AccountSettingsUpdateOptions{ + BackupsEnabled: Bool(false), + LongviewSubscription: String("longview-10"), + NetworkHelper: Bool(false), + } + + settings, err := client.UpdateAccountSettings(context.Background(), opts) + if err != nil { + t.Fatalf("Error updating Account Settings, expected struct, got error %v", err) + } + + if settings.BackupsEnabled != false { + t.Fatalf("Expected BackupsEnabled to be false, got %v", settings.BackupsEnabled) + } + + if settings.NetworkHelper != false { + t.Fatalf("Expected NetworkHelper to be false, got %v", settings.NetworkHelper) + } + + if settings.LongviewSubscription == nil || *settings.LongviewSubscription != "longview-10" { + t.Fatalf("Expected LongviewSubscription to be 'longview-10', got %v", settings.LongviewSubscription) + } +} + +func Bool(v bool) *bool { return &v } +func String(v string) *string { return &v } diff --git a/test/integration/account_transfer_test.go b/test/integration/account_transfer_test.go new file mode 100644 index 000000000..b605d3607 --- /dev/null +++ b/test/integration/account_transfer_test.go @@ -0,0 +1,33 @@ +package integration + +import ( + "context" + "testing" +) + +func TestAccountTransfer_Get(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestAccountTransfer_Get") + defer teardown() + + transfer, err := client.GetAccountTransfer(context.Background()) + if err != nil { + t.Fatalf("Error getting Account Transfer, expected struct, got error %v", err) + } + + if transfer.Billable == 0 && transfer.Quota == 0 && transfer.Used == 0 { + t.Fatalf("Expected non-zero values for Billable, Quota, and Used.") + } + + if len(transfer.RegionTransfers) == 0 { + t.Fatalf("Expected to see region transfers.") + } + + for _, regionTransfer := range transfer.RegionTransfers { + if regionTransfer.ID == "" { + t.Errorf("Expected region ID to be non-empty.") + } + if regionTransfer.Billable == 0 && regionTransfer.Quota == 0 && regionTransfer.Used == 0 { + t.Errorf("Expected non-zero values for Billable, Quota, and Used in region %s.", regionTransfer.ID) + } + } +} diff --git a/test/integration/fixtures/TestAccountSettings.yaml b/test/integration/fixtures/TestAccountSettings.yaml new file mode 100644 index 000000000..3f789524c --- /dev/null +++ b/test/integration/fixtures/TestAccountSettings.yaml @@ -0,0 +1,51 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/account/settings + method: GET + response: + body: '{ + "backups_enabled": true, + "managed": true, + "network_helper": true, + "longview_subscription": "longview-3", + "object_storage": "active" + }' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" + +- request: + body: '{"backups_enabled":false,"longview_subscription":"longview-10","network_helper":false}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/account/settings + method: PUT + response: + body: '{ + "backups_enabled": false, + "managed": true, + "network_helper": false, + "longview_subscription": "longview-10", + "object_storage": "active" + }' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" diff --git a/test/integration/fixtures/TestAccountTransfer_Get.yaml b/test/integration/fixtures/TestAccountTransfer_Get.yaml new file mode 100644 index 000000000..8b5cf938e --- /dev/null +++ b/test/integration/fixtures/TestAccountTransfer_Get.yaml @@ -0,0 +1,79 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/account/transfer + method: GET + response: + body: '{ + "billable": 100, + "quota": 1000, + "used": 200, + "region_transfers": [ + { + "id": "us-east", + "billable": 50, + "quota": 500, + "used": 100 + }, + { + "id": "us-west", + "billable": 50, + "quota": 500, + "used": 100 + } + ] + }' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "287" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Tue, 16 Apr 2024 20:58:13 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - account:read_only + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Oauth-Scopes: + - account:read_write + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" diff --git a/test/integration/fixtures/TestInvoiceItems_List.yaml b/test/integration/fixtures/TestInvoiceItems_List.yaml new file mode 100644 index 000000000..28d24c20e --- /dev/null +++ b/test/integration/fixtures/TestInvoiceItems_List.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/account/invoices/123/items + method: GET + response: + body: '{"data": [{"label": "Linode 2GB", "type": "linode", "unitprice": 10, "quantity": 1, "amount": 10, "tax": 0.6, "region": "us-east", "from": "2018-01-01T00:00:00", "to": "2018-01-31T23:59:59"}], "page": 1, "pages": 1, "results": 1}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" diff --git a/test/integration/fixtures/TestInvoice_Get.yaml b/test/integration/fixtures/TestInvoice_Get.yaml new file mode 100644 index 000000000..79809d4c6 --- /dev/null +++ b/test/integration/fixtures/TestInvoice_Get.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/account/invoices/123 + method: GET + response: + body: '{"id": 123, "label": "Invoice", "date": "2018-01-01T00:01:01", "subtotal": 120.25, "tax": 12.25, "tax_summary": [{"name": "PA STATE TAX", "tax": 12.25}], "total": 132.5, "billing_source": "linode"}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" diff --git a/test/integration/fixtures/TestInvoice_List.yaml b/test/integration/fixtures/TestInvoice_List.yaml new file mode 100644 index 000000000..bd49d43d4 --- /dev/null +++ b/test/integration/fixtures/TestInvoice_List.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/account/invoices + method: GET + response: + body: '{"data": [{"billing_source": "linode", "date": "2018-01-01T00:01:01", "id": 123, "label": "Invoice", "subtotal": 120.25, "tax": 12.25, "tax_summary": [{"name": "PA STATE TAX", "tax": 12.25}], "total": 132.5}], "page": 1, "pages": 1, "results": 1}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" \ No newline at end of file From 236518b9f5645a339ca4ac1bcdf085af7570cf1d Mon Sep 17 00:00:00 2001 From: vshanthe Date: Tue, 25 Jun 2024 10:42:38 +0530 Subject: [PATCH 02/10] added fix for failure --- test/integration/fixtures/TestInvoiceItems_List.yaml | 2 +- test/integration/fixtures/TestInvoice_List.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/fixtures/TestInvoiceItems_List.yaml b/test/integration/fixtures/TestInvoiceItems_List.yaml index 28d24c20e..cdb0e5c7d 100644 --- a/test/integration/fixtures/TestInvoiceItems_List.yaml +++ b/test/integration/fixtures/TestInvoiceItems_List.yaml @@ -8,7 +8,7 @@ interactions: - application/json Content-Type: - application/json - url: https://api.linode.com/v4beta/account/invoices/123/items + url: https://api.linode.com/v4beta/account/invoices/123/items?page=1 method: GET response: body: '{"data": [{"label": "Linode 2GB", "type": "linode", "unitprice": 10, "quantity": 1, "amount": 10, "tax": 0.6, "region": "us-east", "from": "2018-01-01T00:00:00", "to": "2018-01-31T23:59:59"}], "page": 1, "pages": 1, "results": 1}' diff --git a/test/integration/fixtures/TestInvoice_List.yaml b/test/integration/fixtures/TestInvoice_List.yaml index bd49d43d4..8b77641ea 100644 --- a/test/integration/fixtures/TestInvoice_List.yaml +++ b/test/integration/fixtures/TestInvoice_List.yaml @@ -8,7 +8,7 @@ interactions: - application/json Content-Type: - application/json - url: https://api.linode.com/v4beta/account/invoices + url: https://api.linode.com/v4beta/account/invoices?page=1 method: GET response: body: '{"data": [{"billing_source": "linode", "date": "2018-01-01T00:01:01", "id": 123, "label": "Invoice", "subtotal": 120.25, "tax": 12.25, "tax_summary": [{"name": "PA STATE TAX", "tax": 12.25}], "total": 132.5}], "page": 1, "pages": 1, "results": 1}' From 62f9c852c2630347bd111acf84557806228566e3 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Mon, 1 Jul 2024 20:14:07 +0530 Subject: [PATCH 03/10] added tests for other modules --- .../fixtures/TestIPv6Pool_Get.yaml | 20 +++++++++ .../fixtures/TestIPv6Pool_List.yaml | 20 +++++++++ test/integration/fixtures/TestTicket_Get.yaml | 20 +++++++++ .../integration/fixtures/TestTicket_List.yaml | 20 +++++++++ test/integration/network_pools_test.go | 42 +++++++++++++++++++ test/integration/support_ticket_test.go | 42 +++++++++++++++++++ 6 files changed, 164 insertions(+) create mode 100644 test/integration/fixtures/TestIPv6Pool_Get.yaml create mode 100644 test/integration/fixtures/TestIPv6Pool_List.yaml create mode 100644 test/integration/fixtures/TestTicket_Get.yaml create mode 100644 test/integration/fixtures/TestTicket_List.yaml create mode 100644 test/integration/network_pools_test.go create mode 100644 test/integration/support_ticket_test.go diff --git a/test/integration/fixtures/TestIPv6Pool_Get.yaml b/test/integration/fixtures/TestIPv6Pool_Get.yaml new file mode 100644 index 000000000..c8f131306 --- /dev/null +++ b/test/integration/fixtures/TestIPv6Pool_Get.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/networking/ipv6/pools/2600:3c00::%2F32 + method: GET + response: + body: '{"range": "2600:3c00::/32", "region": "us-east", "route_target": "2600:3c00::/32"}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" \ No newline at end of file diff --git a/test/integration/fixtures/TestIPv6Pool_List.yaml b/test/integration/fixtures/TestIPv6Pool_List.yaml new file mode 100644 index 000000000..b6ac77609 --- /dev/null +++ b/test/integration/fixtures/TestIPv6Pool_List.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/networking/ipv6/pools + method: GET + response: + body: '{"data": [{"range": "2600:3c00::/32", "region": "us-east", "route_target": "2600:3c00::/32"}], "page": 1, "pages": 1, "results": 1}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" \ No newline at end of file diff --git a/test/integration/fixtures/TestTicket_Get.yaml b/test/integration/fixtures/TestTicket_Get.yaml new file mode 100644 index 000000000..f9aa8cb02 --- /dev/null +++ b/test/integration/fixtures/TestTicket_Get.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/support/tickets/123 + method: GET + response: + body: '{"id": 123, "attachments": [], "closed": null, "description": "Test description", "entity": {"id": 1, "label": "Test Entity", "type": "linode", "url": "/v4beta/linode/instances/1"}, "gravatar_id": "", "opened": "2024-06-01T12:00:00", "opened_by": "user", "status": "open", "summary": "Test summary", "updated": "2024-06-02T12:00:00", "updated_by": "user2"}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" \ No newline at end of file diff --git a/test/integration/fixtures/TestTicket_List.yaml b/test/integration/fixtures/TestTicket_List.yaml new file mode 100644 index 000000000..6f27d0eaf --- /dev/null +++ b/test/integration/fixtures/TestTicket_List.yaml @@ -0,0 +1,20 @@ +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.linode.com/v4beta/support/tickets + method: GET + response: + body: '{"data": [{"id": 123, "attachments": [], "closed": null, "description": "Test description", "entity": {"id": 1, "label": "Test Entity", "type": "linode", "url": "/v4beta/linode/instances/1"}, "gravatar_id": "", "opened": "2024-06-01T12:00:00", "opened_by": "user", "status": "open", "summary": "Test summary", "updated": "2024-06-02T12:00:00", "updated_by": "user2"}], "page": 1, "pages": 1, "results": 1}' + headers: + Content-Type: + - application/json + status: 200 + code: 200 + duration: "" \ No newline at end of file diff --git a/test/integration/network_pools_test.go b/test/integration/network_pools_test.go new file mode 100644 index 000000000..3d3eaa920 --- /dev/null +++ b/test/integration/network_pools_test.go @@ -0,0 +1,42 @@ +package integration + +import ( + "context" + "testing" +) + +func TestIPv6Pool_List(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestIPv6Pool_List") + defer teardown() + + ipv6Pools, err := client.ListIPv6Pools(context.Background(), nil) + if err != nil { + t.Fatalf("Error getting IPv6 Pools, expected struct, got error %v", err) + } + + if len(ipv6Pools) == 0 { + t.Fatalf("Expected to see IPv6 pools returned.") + } + + if ipv6Pools[0].Range != "2600:3c00::/32" { + t.Fatalf("Expected IPv6 pool range '2600:3c00::/32', got %s", ipv6Pools[0].Range) + } +} + +func TestIPv6Pool_Get(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestIPv6Pool_Get") + defer teardown() + + ipv6Pool, err := client.GetIPv6Pool(context.Background(), "2600:3c00::/32") + if err != nil { + t.Fatalf("Error getting IPv6 Pool, expected struct, got error %v", err) + } + + if ipv6Pool.Range != "2600:3c00::/32" { + t.Fatalf("Expected IPv6 pool range '2600:3c00::/32', got %s", ipv6Pool.Range) + } + + if ipv6Pool.Region != "us-east" { + t.Fatalf("Expected IPv6 pool region 'us-east', got %s", ipv6Pool.Region) + } +} diff --git a/test/integration/support_ticket_test.go b/test/integration/support_ticket_test.go new file mode 100644 index 000000000..33e0c1c67 --- /dev/null +++ b/test/integration/support_ticket_test.go @@ -0,0 +1,42 @@ +package integration + +import ( + "context" + "testing" +) + +func TestTicket_List(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestTicket_List") + defer teardown() + + tickets, err := client.ListTickets(context.Background(), nil) + if err != nil { + t.Fatalf("Error getting Tickets, expected struct, got error %v", err) + } + + if len(tickets) == 0 { + t.Fatalf("Expected to see tickets returned.") + } + + if tickets[0].ID != 123 { + t.Fatalf("Expected ticket ID 123, got %d", tickets[0].ID) + } +} + +func TestTicket_Get(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestTicket_Get") + defer teardown() + + ticket, err := client.GetTicket(context.Background(), 123) + if err != nil { + t.Fatalf("Error getting Ticket, expected struct, got error %v", err) + } + + if ticket.ID != 123 { + t.Fatalf("Expected ticket ID 123, got %d", ticket.ID) + } + + if ticket.Description != "Test description" { + t.Fatalf("Expected ticket description 'Test description', got %s", ticket.Description) + } +} From bdaa4c0afbae5e870998e27d3b6526389b4df6ab Mon Sep 17 00:00:00 2001 From: vshanthe Date: Mon, 1 Jul 2024 20:33:56 +0530 Subject: [PATCH 04/10] fix pr comments --- test/integration/account_invoice_test.go | 50 ++++++---------------- test/integration/account_settings_test.go | 52 +++++++---------------- test/integration/account_transfer_test.go | 26 +++++------- test/integration/network_pools_test.go | 27 ++++-------- test/integration/support_ticket_test.go | 27 ++++-------- 5 files changed, 55 insertions(+), 127 deletions(-) diff --git a/test/integration/account_invoice_test.go b/test/integration/account_invoice_test.go index b6539139b..a1bbbabd1 100644 --- a/test/integration/account_invoice_test.go +++ b/test/integration/account_invoice_test.go @@ -3,6 +3,8 @@ package integration import ( "context" "testing" + + "github.com/stretchr/testify/require" ) func TestInvoice_List(t *testing.T) { @@ -10,13 +12,8 @@ func TestInvoice_List(t *testing.T) { defer teardown() invoices, err := client.ListInvoices(context.Background(), nil) - if err != nil { - t.Fatalf("Error getting Invoices, expected struct, got error %v", err) - } - - if len(invoices) == 0 { - t.Fatalf("Expected to see invoices returned.") - } + require.NoError(t, err, "Error getting Invoices, expected struct") + require.NotEmpty(t, invoices, "Expected to see invoices returned") } func TestInvoice_Get(t *testing.T) { @@ -24,21 +21,10 @@ func TestInvoice_Get(t *testing.T) { defer teardown() invoice, err := client.GetInvoice(context.Background(), 123) - if err != nil { - t.Fatalf("Error getting Invoice, expected struct, got error %v", err) - } - - if invoice.ID != 123 { - t.Fatalf("Expected Invoice ID to be 123, got %v", invoice.ID) - } - - if invoice.Label != "Invoice" { - t.Fatalf("Expected Invoice Label to be 'Invoice', got %v", invoice.Label) - } - - if invoice.Total != 132.5 { - t.Fatalf("Expected Invoice Total to be 132.5, got %v", invoice.Total) - } + require.NoError(t, err, "Error getting Invoice, expected struct") + require.Equal(t, 123, invoice.ID, "Expected Invoice ID to be 123") + require.Equal(t, "Invoice", invoice.Label, "Expected Invoice Label to be 'Invoice'") + require.Equal(t, 132.5, float64(invoice.Total), "Expected Invoice Total to be 132.5") } func TestInvoiceItems_List(t *testing.T) { @@ -46,20 +32,10 @@ func TestInvoiceItems_List(t *testing.T) { defer teardown() items, err := client.ListInvoiceItems(context.Background(), 123, nil) - if err != nil { - t.Fatalf("Error getting Invoice Items, expected struct, got error %v", err) - } - - if len(items) == 0 { - t.Fatalf("Expected to see invoice items returned.") - } + require.NoError(t, err, "Error getting Invoice Items, expected struct") + require.NotEmpty(t, items, "Expected to see invoice items returned") item := items[0] - if item.Label != "Linode 2GB" { - t.Fatalf("Expected item label to be 'Linode 2GB', got %v", item.Label) - } - - if item.Amount != 10 { - t.Fatalf("Expected item amount to be 10, got %v", item.Amount) - } -} \ No newline at end of file + require.Equal(t, "Linode 2GB", item.Label, "Expected item label to be 'Linode 2GB'") + require.Equal(t, 10.0, float64(item.Amount), "Expected item amount to be 10") +} diff --git a/test/integration/account_settings_test.go b/test/integration/account_settings_test.go index a27099b54..2a1a98b93 100644 --- a/test/integration/account_settings_test.go +++ b/test/integration/account_settings_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" "github.com/linode/linodego" ) @@ -12,29 +13,15 @@ func TestAccountSettings_Get(t *testing.T) { defer teardown() settings, err := client.GetAccountSettings(context.Background()) - if err != nil { - t.Fatalf("Error getting Account Settings, expected struct, got error %v", err) - } - - if settings.BackupsEnabled != true { - t.Fatalf("Expected BackupsEnabled to be true, got %v", settings.BackupsEnabled) - } - - if settings.Managed != true { - t.Fatalf("Expected Managed to be true, got %v", settings.Managed) - } - - if settings.NetworkHelper != true { - t.Fatalf("Expected NetworkHelper to be true, got %v", settings.NetworkHelper) - } - - if settings.LongviewSubscription == nil || *settings.LongviewSubscription != "longview-3" { - t.Fatalf("Expected LongviewSubscription to be 'longview-3', got %v", settings.LongviewSubscription) - } - - if settings.ObjectStorage == nil || *settings.ObjectStorage != "active" { - t.Fatalf("Expected ObjectStorage to be 'active', got %v", settings.ObjectStorage) - } + require.NoError(t, err, "Error getting Account Settings") + + require.True(t, settings.BackupsEnabled, "Expected BackupsEnabled to be true") + require.True(t, settings.Managed, "Expected Managed to be true") + require.True(t, settings.NetworkHelper, "Expected NetworkHelper to be true") + require.NotNil(t, settings.LongviewSubscription, "Expected LongviewSubscription to be non-nil") + require.Equal(t, "longview-3", *settings.LongviewSubscription, "Expected LongviewSubscription to be 'longview-3'") + require.NotNil(t, settings.ObjectStorage, "Expected ObjectStorage to be non-nil") + require.Equal(t, "active", *settings.ObjectStorage, "Expected ObjectStorage to be 'active'") } func TestAccountSettings_Update(t *testing.T) { @@ -48,21 +35,12 @@ func TestAccountSettings_Update(t *testing.T) { } settings, err := client.UpdateAccountSettings(context.Background(), opts) - if err != nil { - t.Fatalf("Error updating Account Settings, expected struct, got error %v", err) - } - - if settings.BackupsEnabled != false { - t.Fatalf("Expected BackupsEnabled to be false, got %v", settings.BackupsEnabled) - } - - if settings.NetworkHelper != false { - t.Fatalf("Expected NetworkHelper to be false, got %v", settings.NetworkHelper) - } + require.NoError(t, err, "Error updating Account Settings") - if settings.LongviewSubscription == nil || *settings.LongviewSubscription != "longview-10" { - t.Fatalf("Expected LongviewSubscription to be 'longview-10', got %v", settings.LongviewSubscription) - } + require.False(t, settings.BackupsEnabled, "Expected BackupsEnabled to be false") + require.False(t, settings.NetworkHelper, "Expected NetworkHelper to be false") + require.NotNil(t, settings.LongviewSubscription, "Expected LongviewSubscription to be non-nil") + require.Equal(t, "longview-10", *settings.LongviewSubscription, "Expected LongviewSubscription to be 'longview-10'") } func Bool(v bool) *bool { return &v } diff --git a/test/integration/account_transfer_test.go b/test/integration/account_transfer_test.go index b605d3607..23654f5ed 100644 --- a/test/integration/account_transfer_test.go +++ b/test/integration/account_transfer_test.go @@ -3,6 +3,8 @@ package integration import ( "context" "testing" + + "github.com/stretchr/testify/require" ) func TestAccountTransfer_Get(t *testing.T) { @@ -10,24 +12,18 @@ func TestAccountTransfer_Get(t *testing.T) { defer teardown() transfer, err := client.GetAccountTransfer(context.Background()) - if err != nil { - t.Fatalf("Error getting Account Transfer, expected struct, got error %v", err) - } + require.NoError(t, err, "Error getting Account Transfer, expected struct") - if transfer.Billable == 0 && transfer.Quota == 0 && transfer.Used == 0 { - t.Fatalf("Expected non-zero values for Billable, Quota, and Used.") - } + require.NotEqual(t, 0, transfer.Billable, "Expected non-zero value for Billable") + require.NotEqual(t, 0, transfer.Quota, "Expected non-zero value for Quota") + require.NotEqual(t, 0, transfer.Used, "Expected non-zero value for Used") - if len(transfer.RegionTransfers) == 0 { - t.Fatalf("Expected to see region transfers.") - } + require.NotEmpty(t, transfer.RegionTransfers, "Expected to see region transfers") for _, regionTransfer := range transfer.RegionTransfers { - if regionTransfer.ID == "" { - t.Errorf("Expected region ID to be non-empty.") - } - if regionTransfer.Billable == 0 && regionTransfer.Quota == 0 && regionTransfer.Used == 0 { - t.Errorf("Expected non-zero values for Billable, Quota, and Used in region %s.", regionTransfer.ID) - } + require.NotEmpty(t, regionTransfer.ID, "Expected region ID to be non-empty") + require.NotEqual(t, 0, regionTransfer.Billable, "Expected non-zero value for Billable in region %s", regionTransfer.ID) + require.NotEqual(t, 0, regionTransfer.Quota, "Expected non-zero value for Quota in region %s", regionTransfer.ID) + require.NotEqual(t, 0, regionTransfer.Used, "Expected non-zero value for Used in region %s", regionTransfer.ID) } } diff --git a/test/integration/network_pools_test.go b/test/integration/network_pools_test.go index 3d3eaa920..335348e35 100644 --- a/test/integration/network_pools_test.go +++ b/test/integration/network_pools_test.go @@ -3,6 +3,8 @@ package integration import ( "context" "testing" + + "github.com/stretchr/testify/require" ) func TestIPv6Pool_List(t *testing.T) { @@ -10,17 +12,11 @@ func TestIPv6Pool_List(t *testing.T) { defer teardown() ipv6Pools, err := client.ListIPv6Pools(context.Background(), nil) - if err != nil { - t.Fatalf("Error getting IPv6 Pools, expected struct, got error %v", err) - } + require.NoError(t, err, "Error getting IPv6 Pools, expected struct") - if len(ipv6Pools) == 0 { - t.Fatalf("Expected to see IPv6 pools returned.") - } + require.NotEmpty(t, ipv6Pools, "Expected to see IPv6 pools returned") - if ipv6Pools[0].Range != "2600:3c00::/32" { - t.Fatalf("Expected IPv6 pool range '2600:3c00::/32', got %s", ipv6Pools[0].Range) - } + require.Equal(t, "2600:3c00::/32", ipv6Pools[0].Range, "Expected IPv6 pool range '2600:3c00::/32'") } func TestIPv6Pool_Get(t *testing.T) { @@ -28,15 +24,8 @@ func TestIPv6Pool_Get(t *testing.T) { defer teardown() ipv6Pool, err := client.GetIPv6Pool(context.Background(), "2600:3c00::/32") - if err != nil { - t.Fatalf("Error getting IPv6 Pool, expected struct, got error %v", err) - } - - if ipv6Pool.Range != "2600:3c00::/32" { - t.Fatalf("Expected IPv6 pool range '2600:3c00::/32', got %s", ipv6Pool.Range) - } + require.NoError(t, err, "Error getting IPv6 Pool, expected struct") - if ipv6Pool.Region != "us-east" { - t.Fatalf("Expected IPv6 pool region 'us-east', got %s", ipv6Pool.Region) - } + require.Equal(t, "2600:3c00::/32", ipv6Pool.Range, "Expected IPv6 pool range '2600:3c00::/32'") + require.Equal(t, "us-east", ipv6Pool.Region, "Expected IPv6 pool region 'us-east'") } diff --git a/test/integration/support_ticket_test.go b/test/integration/support_ticket_test.go index 33e0c1c67..fd4b535e9 100644 --- a/test/integration/support_ticket_test.go +++ b/test/integration/support_ticket_test.go @@ -3,6 +3,8 @@ package integration import ( "context" "testing" + + "github.com/stretchr/testify/require" ) func TestTicket_List(t *testing.T) { @@ -10,17 +12,11 @@ func TestTicket_List(t *testing.T) { defer teardown() tickets, err := client.ListTickets(context.Background(), nil) - if err != nil { - t.Fatalf("Error getting Tickets, expected struct, got error %v", err) - } + require.NoError(t, err, "Error getting Tickets, expected struct") - if len(tickets) == 0 { - t.Fatalf("Expected to see tickets returned.") - } + require.NotEmpty(t, tickets, "Expected to see tickets returned") - if tickets[0].ID != 123 { - t.Fatalf("Expected ticket ID 123, got %d", tickets[0].ID) - } + require.Equal(t, 123, tickets[0].ID, "Expected ticket ID 123") } func TestTicket_Get(t *testing.T) { @@ -28,15 +24,8 @@ func TestTicket_Get(t *testing.T) { defer teardown() ticket, err := client.GetTicket(context.Background(), 123) - if err != nil { - t.Fatalf("Error getting Ticket, expected struct, got error %v", err) - } - - if ticket.ID != 123 { - t.Fatalf("Expected ticket ID 123, got %d", ticket.ID) - } + require.NoError(t, err, "Error getting Ticket, expected struct") - if ticket.Description != "Test description" { - t.Fatalf("Expected ticket description 'Test description', got %s", ticket.Description) - } + require.Equal(t, 123, ticket.ID, "Expected ticket ID 123") + require.Equal(t, "Test description", ticket.Description, "Expected ticket description 'Test description'") } From d614278c6323b0a5bfd47955bf4841ea13f12c60 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Wed, 3 Jul 2024 10:58:15 +0530 Subject: [PATCH 05/10] added new changes to account_setting --- test/integration/account_settings_test.go | 36 +++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/test/integration/account_settings_test.go b/test/integration/account_settings_test.go index 2a1a98b93..7e18a022d 100644 --- a/test/integration/account_settings_test.go +++ b/test/integration/account_settings_test.go @@ -2,16 +2,34 @@ package integration import ( "context" + "encoding/json" "testing" - - "github.com/stretchr/testify/require" + + "github.com/jarcoal/httpmock" "github.com/linode/linodego" + "github.com/stretchr/testify/require" ) func TestAccountSettings_Get(t *testing.T) { client, teardown := createTestClient(t, "fixtures/TestAccountSettings") defer teardown() + // Mocking the API response + httpmock.Activate() + defer httpmock.DeactivateAndReset() + + mockSettings := linodego.AccountSettings{ + BackupsEnabled: true, + Managed: true, + NetworkHelper: true, + LongviewSubscription: String("longview-3"), + ObjectStorage: String("active"), + } + mockResponse, _ := json.Marshal(mockSettings) + + httpmock.RegisterResponder("GET", "https://api.linode.com/v4/account/settings", + httpmock.NewStringResponder(200, string(mockResponse))) + settings, err := client.GetAccountSettings(context.Background()) require.NoError(t, err, "Error getting Account Settings") @@ -28,12 +46,26 @@ func TestAccountSettings_Update(t *testing.T) { client, teardown := createTestClient(t, "fixtures/TestAccountSettings") defer teardown() + // Mocking the API response + httpmock.Activate() + defer httpmock.DeactivateAndReset() + opts := linodego.AccountSettingsUpdateOptions{ BackupsEnabled: Bool(false), LongviewSubscription: String("longview-10"), NetworkHelper: Bool(false), } + mockSettings := linodego.AccountSettings{ + BackupsEnabled: false, + NetworkHelper: false, + LongviewSubscription: String("longview-10"), + } + mockResponse, _ := json.Marshal(mockSettings) + + httpmock.RegisterResponder("PUT", "https://api.linode.com/v4/account/settings", + httpmock.NewStringResponder(200, string(mockResponse))) + settings, err := client.UpdateAccountSettings(context.Background(), opts) require.NoError(t, err, "Error updating Account Settings") From bea68cbf477a163abd586d29dc16ee3a35e57464 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Tue, 9 Jul 2024 17:50:51 +0530 Subject: [PATCH 06/10] test added --- .../fixtures/TestSecurityQuestions_List.yaml | 62 +++++++++++++++++++ .../profile_security_question_test.go | 20 ++++++ 2 files changed, 82 insertions(+) create mode 100644 test/integration/fixtures/TestSecurityQuestions_List.yaml create mode 100644 test/integration/profile_security_question_test.go diff --git a/test/integration/fixtures/TestSecurityQuestions_List.yaml b/test/integration/fixtures/TestSecurityQuestions_List.yaml new file mode 100644 index 000000000..51bb59c70 --- /dev/null +++ b/test/integration/fixtures/TestSecurityQuestions_List.yaml @@ -0,0 +1,62 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/profile/security-questions + method: GET + response: + body: '{"security_questions": [{"id": 1, "question": "What was the name of your first pet?", "response": null}, {"id": 2, "question": "What is the name of your oldest sibling?", "response": null}, {"id": 3, "question": "What was the first concert you attended?", "response": null}, {"id": 4, "question": "What was the make and model of your first car?", "response": null}, {"id": 5, "question": "In what city or town did your parents meet?", "response": null}, {"id": 6, "question": "What is the name of a college you applied to but did not attend?", "response": null}, {"id": 7, "question": "Where did you go on your most memorable school field trip?", "response": null}, {"id": 8, "question": "What is the name of the teacher who impacted you the most?", "response": null}, {"id": 9, "question": "Which city did you visit on your first airplane flight?", "response": null}, {"id": 10, "question": "On what street did your best friend in high school live?", "response": null}, {"id": 11, "question": "What is the name of your favorite city?", "response": null}, {"id": 12, "question": "What is your favorite artist of all time?", "response": null}, {"id": 13, "question": "What is the maiden name of your grandmother?", "response": null}, {"id": 14, "question": "What is the name of your first roommate?", "response": null}, {"id": 15, "question": "In what city or town was your first job?", "response": null}, {"id": 16, "question": "Who is your favorite author?", "response": null}, {"id": 17, "question": "What is the name of the hospital you were born in?", "response": null}, {"id": 18, "question": "What sports team do you love to see lose?", "response": null}, {"id": 19, "question": "On what street is your grocery store?", "response": null}]}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Fri, 05 Jul 2024 15:42:19 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + - Accept-Encoding + X-Accepted-Oauth-Scopes: + - account:read_only + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" diff --git a/test/integration/profile_security_question_test.go b/test/integration/profile_security_question_test.go new file mode 100644 index 000000000..0215e6899 --- /dev/null +++ b/test/integration/profile_security_question_test.go @@ -0,0 +1,20 @@ +package integration + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestSecurityQuestions_List(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestSecurityQuestions_List") + defer teardown() + + questions, err := client.SecurityQuestionsList(context.Background()) + require.NoError(t, err, "Error getting security questions, expected struct") + + require.NotEmpty(t, questions.SecurityQuestions, "Expected to see security questions returned") + + require.Equal(t, "What was the name of your first pet?", questions.SecurityQuestions[0].Question, "Expected question 'What was the name of your first pet?'") +} \ No newline at end of file From 5df8db765bd3d22be4040d3e667e0aeddaf22c4c Mon Sep 17 00:00:00 2001 From: vshanthe Date: Tue, 9 Jul 2024 20:23:53 +0530 Subject: [PATCH 07/10] fix failure --- test/integration/fixtures/TestIPv6Pool_List.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/fixtures/TestIPv6Pool_List.yaml b/test/integration/fixtures/TestIPv6Pool_List.yaml index b6ac77609..2db83a3f0 100644 --- a/test/integration/fixtures/TestIPv6Pool_List.yaml +++ b/test/integration/fixtures/TestIPv6Pool_List.yaml @@ -8,7 +8,7 @@ interactions: - application/json Content-Type: - application/json - url: https://api.linode.com/v4beta/networking/ipv6/pools + url: https://api.linode.com/v4beta/networking/ipv6/pools?page=1 method: GET response: body: '{"data": [{"range": "2600:3c00::/32", "region": "us-east", "route_target": "2600:3c00::/32"}], "page": 1, "pages": 1, "results": 1}' From 5c8ee1ac33f2665c0f4e19366fad1738e9800cb3 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Fri, 19 Jul 2024 17:48:30 +0530 Subject: [PATCH 08/10] accommodate PR comments --- .../profile_security_question_test.go | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/integration/profile_security_question_test.go b/test/integration/profile_security_question_test.go index 0215e6899..59ca9ef2c 100644 --- a/test/integration/profile_security_question_test.go +++ b/test/integration/profile_security_question_test.go @@ -2,12 +2,32 @@ package integration import ( "context" + "fmt" "testing" "github.com/stretchr/testify/require" + "golang.org/x/exp/slog" ) +// Assuming `testingMode` and `recorder.ModeReplaying` are defined somewhere in your codebase + +func warnSensitiveTest(t *testing.T) { + if testingMode == recorder.ModeReplaying { + return + } + + slog.Warn( + fmt.Sprintf( + "Test %s is a sensitive test. Ensure you validate and sanitize "+ + "its generated test fixtures before pushing.", + t.Name(), + ), + ) +} + func TestSecurityQuestions_List(t *testing.T) { + warnSensitiveTest(t) + client, teardown := createTestClient(t, "fixtures/TestSecurityQuestions_List") defer teardown() @@ -17,4 +37,4 @@ func TestSecurityQuestions_List(t *testing.T) { require.NotEmpty(t, questions.SecurityQuestions, "Expected to see security questions returned") require.Equal(t, "What was the name of your first pet?", questions.SecurityQuestions[0].Question, "Expected question 'What was the name of your first pet?'") -} \ No newline at end of file +} From 32ce4bb3739ca848c618449ff9fc4d1a5da4a414 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Mon, 22 Jul 2024 12:48:44 +0530 Subject: [PATCH 09/10] fix PR comments --- test/integration/account_invoice_test.go | 3 +++ test/integration/integration_suite_test.go | 16 ++++++++++++++++ .../profile_security_question_test.go | 18 ------------------ test/integration/support_ticket_test.go | 2 ++ 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/test/integration/account_invoice_test.go b/test/integration/account_invoice_test.go index a1bbbabd1..ea1586862 100644 --- a/test/integration/account_invoice_test.go +++ b/test/integration/account_invoice_test.go @@ -8,6 +8,7 @@ import ( ) func TestInvoice_List(t *testing.T) { + warnSensitiveTest(t) client, teardown := createTestClient(t, "fixtures/TestInvoice_List") defer teardown() @@ -17,6 +18,7 @@ func TestInvoice_List(t *testing.T) { } func TestInvoice_Get(t *testing.T) { + warnSensitiveTest(t) client, teardown := createTestClient(t, "fixtures/TestInvoice_Get") defer teardown() @@ -28,6 +30,7 @@ func TestInvoice_Get(t *testing.T) { } func TestInvoiceItems_List(t *testing.T) { + warnSensitiveTest(t) client, teardown := createTestClient(t, "fixtures/TestInvoiceItems_List") defer teardown() diff --git a/test/integration/integration_suite_test.go b/test/integration/integration_suite_test.go index a4534cc6e..d58196a33 100644 --- a/test/integration/integration_suite_test.go +++ b/test/integration/integration_suite_test.go @@ -2,6 +2,7 @@ package integration import ( "context" + "fmt" "log" "net/http" "os" @@ -15,6 +16,7 @@ import ( "github.com/dnaeon/go-vcr/recorder" "github.com/linode/linodego" "golang.org/x/oauth2" + "log/slog" "k8s.io/client-go/transport" ) @@ -58,6 +60,20 @@ func init() { } } +func warnSensitiveTest(t *testing.T) { + if testingMode == recorder.ModeReplaying { + return + } + + slog.Warn( + fmt.Sprintf( + "Test %s is a sensitive test. Ensure you validate and sanitize "+ + "its generated test fixtures before pushing.", + t.Name(), + ), + ) +} + // testRecorder returns a go-vcr recorder and an associated function that the caller must defer func testRecorder(t *testing.T, fixturesYaml string, testingMode recorder.Mode, realTransport http.RoundTripper) (r *recorder.Recorder, recordStopper func()) { if t != nil { diff --git a/test/integration/profile_security_question_test.go b/test/integration/profile_security_question_test.go index 59ca9ef2c..48c15adbd 100644 --- a/test/integration/profile_security_question_test.go +++ b/test/integration/profile_security_question_test.go @@ -2,29 +2,11 @@ package integration import ( "context" - "fmt" "testing" "github.com/stretchr/testify/require" - "golang.org/x/exp/slog" ) -// Assuming `testingMode` and `recorder.ModeReplaying` are defined somewhere in your codebase - -func warnSensitiveTest(t *testing.T) { - if testingMode == recorder.ModeReplaying { - return - } - - slog.Warn( - fmt.Sprintf( - "Test %s is a sensitive test. Ensure you validate and sanitize "+ - "its generated test fixtures before pushing.", - t.Name(), - ), - ) -} - func TestSecurityQuestions_List(t *testing.T) { warnSensitiveTest(t) diff --git a/test/integration/support_ticket_test.go b/test/integration/support_ticket_test.go index fd4b535e9..31fd0457d 100644 --- a/test/integration/support_ticket_test.go +++ b/test/integration/support_ticket_test.go @@ -8,6 +8,7 @@ import ( ) func TestTicket_List(t *testing.T) { + warnSensitiveTest(t) client, teardown := createTestClient(t, "fixtures/TestTicket_List") defer teardown() @@ -20,6 +21,7 @@ func TestTicket_List(t *testing.T) { } func TestTicket_Get(t *testing.T) { + warnSensitiveTest(t) client, teardown := createTestClient(t, "fixtures/TestTicket_Get") defer teardown() From 6fb9b22e352789a853d1b28f9b5ac80dbaa6d9d1 Mon Sep 17 00:00:00 2001 From: vshanthe Date: Mon, 22 Jul 2024 13:05:03 +0530 Subject: [PATCH 10/10] small fix --- test/integration/fixtures/TestTicket_List.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/fixtures/TestTicket_List.yaml b/test/integration/fixtures/TestTicket_List.yaml index 6f27d0eaf..5c25f0608 100644 --- a/test/integration/fixtures/TestTicket_List.yaml +++ b/test/integration/fixtures/TestTicket_List.yaml @@ -8,7 +8,7 @@ interactions: - application/json Content-Type: - application/json - url: https://api.linode.com/v4beta/support/tickets + url: https://api.linode.com/v4beta/support/tickets?page=1 method: GET response: body: '{"data": [{"id": 123, "attachments": [], "closed": null, "description": "Test description", "entity": {"id": 1, "label": "Test Entity", "type": "linode", "url": "/v4beta/linode/instances/1"}, "gravatar_id": "", "opened": "2024-06-01T12:00:00", "opened_by": "user", "status": "open", "summary": "Test summary", "updated": "2024-06-02T12:00:00", "updated_by": "user2"}], "page": 1, "pages": 1, "results": 1}'