diff --git a/test/integration/account_betas_test.go b/test/integration/account_betas_test.go index 270c86c50..21344372c 100644 --- a/test/integration/account_betas_test.go +++ b/test/integration/account_betas_test.go @@ -7,44 +7,39 @@ import ( "github.com/linode/linodego" ) -func TestAccountBetaPrograms_List(t *testing.T) { - client, teardown := createTestClient(t, "fixtures/TestAccountBetaPrograms_List") +func TestAccountBetaPrograms(t *testing.T) { + client, teardown := createTestClient(t, "fixtures/TestAccountBetaPrograms") defer teardown() - betas, err := client.ListAccountBetaPrograms(context.Background(), &linodego.ListOptions{}) - if err != nil { - t.Errorf("Error getting Account Beta programs, expected struct, got error %v", err) - } + betas, err := client.ListBetaPrograms(context.Background(), linodego.NewListOptions(1, "")) if len(betas) == 0 { - t.Errorf("Expected to see account beta program returned.") - } else { - assertDateSet(t, betas[0].Enrolled) + t.Log("No beta program is available during the test.") + return } -} - -func TestAccountBetaProgram_Get(t *testing.T) { - client, teardown := createTestClient(t, "fixtures/TestAccountBetaProgram_Get") - defer teardown() + createOpts := linodego.AccountBetaProgramCreateOpts{ID: betas[0].ID} - betaID := "cool-beta" - - // Enroll the account into a beta program. - createOpts := linodego.AccountBetaProgramCreateOpts{ID: betaID} - - _, err := client.JoinBetaProgram(context.Background(), createOpts) + _, err = client.JoinBetaProgram(context.Background(), createOpts) if err != nil { t.Errorf("Error joining a Beta program, expected struct, got error %v", err) } - beta, err := client.GetAccountBetaProgram(context.Background(), betaID) - + accountBetas, err := client.ListAccountBetaPrograms(context.Background(), &linodego.ListOptions{}) if err != nil { - t.Errorf("Error getting an Account Beta program, expected struct, got error %v", err) + t.Errorf("Error getting Account Beta programs, expected struct, got error %v", err) } - if beta.ID != betaID { - t.Errorf("expected beta ID to be %s; got %s", betaID, beta.ID) + if len(accountBetas) == 0 { + t.Errorf("Expected to see account beta program returned.") + } else { + assertDateSet(t, accountBetas[0].Enrolled) + betaID := accountBetas[0].ID + beta, err := client.GetAccountBetaProgram(context.Background(), betaID) + if err != nil { + t.Errorf("Error getting an Account Beta program, expected struct, got error %v", err) + } + if beta.ID != betaID { + t.Errorf("expected beta ID to be %s; got %s", betaID, beta.ID) + } } - } diff --git a/test/integration/fixtures/TestAccountBetaProgram_Get.yaml b/test/integration/fixtures/TestAccountBetaProgram_Get.yaml deleted file mode 100644 index 2d4cbf101..000000000 --- a/test/integration/fixtures/TestAccountBetaProgram_Get.yaml +++ /dev/null @@ -1,139 +0,0 @@ ---- -version: 1 -interactions: -- request: - body: '{"id":"cool-beta"}' - 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/betas - method: POST - response: - body: '{}' - 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: - - private, max-age=60, s-maxage=60 - Content-Length: - - "2" - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Server: - - nginx - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Authorization, X-Filter - X-Accepted-Oauth-Scopes: - - account:read_write - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - DENY - - DENY - X-Oauth-Scopes: - - '*' - X-Ratelimit-Limit: - - "1200" - X-Xss-Protection: - - 1; mode=block - status: 200 OK - code: 200 - duration: "" -- 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/betas/cool-beta - method: GET - response: - body: '{"id": "cool-beta", "label": "\r\n\r\nRepellat consequatur sunt qui. Fugit - eligendi ipsa et assumenda ea aspernatur esse. A itaque iste distinctio qui - voluptas eum enim ipsa. Labore ducimus sit voluptas expedita ut non.\r\n\r\nAtque - iusto est cupiditate dignissimos soluta facere sunt molestias. Tenetur labore - est est et repudiandae praesentium officiis quis. Eveniet voluptate dignissimos - laboriosam esse maiores inventore reiciendis explicabo. Voluptas perspiciatis - voluptatibus distinctio.\r\n\r\nQui sed esse iusto ipsa repudiandae id. Quo - aut omnis id tenetur odio recusandae delectus iste. Dicta exercitationem voluptatem - accusamus. Voluptatum ut nesciunt architecto maiores.\r\n\r\nRecusandae natus - rerum aut quos aliquam. Et quisquam minima earum. Quam et quod nisi est praesentium - fuga voluptas. Blanditiis veniam aut totam.\r\n\r\nAssumenda accusantium similique - non reprehenderit sint deserunt harum vero. Et qui nihil ut. Reprehenderit quam - dicta qui repellendus perspiciatis voluptatum.\r\n", "enrolled": "2018-01-02T03:04:05", - "description": "\r\n\r\nRepellat consequatur sunt qui. Fugit eligendi ipsa et - assumenda ea aspernatur esse. A itaque iste distinctio qui voluptas eum enim - ipsa. Labore ducimus sit voluptas expedita ut non.\r\n\r\nAtque iusto est cupiditate - dignissimos soluta facere sunt molestias. Tenetur labore est est et repudiandae - praesentium officiis quis. Eveniet voluptate dignissimos laboriosam esse maiores - inventore reiciendis explicabo. Voluptas perspiciatis voluptatibus distinctio.\r\n\r\nQui - sed esse iusto ipsa repudiandae id. Quo aut omnis id tenetur odio recusandae - delectus iste. Dicta exercitationem voluptatem accusamus. Voluptatum ut nesciunt - architecto maiores.\r\n\r\nRecusandae natus rerum aut quos aliquam. Et quisquam - minima earum. Quam et quod nisi est praesentium fuga voluptas. Blanditiis veniam - aut totam.\r\n\r\nAssumenda accusantium similique non reprehenderit sint deserunt - harum vero. Et qui nihil ut. Reprehenderit quam dicta qui repellendus perspiciatis - voluptatum.\r\n", "started": "2018-01-02T03:04:05", "ended": "2018-01-02T03:04:05"}' - 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: - - private, max-age=0, s-maxage=0, no-cache, no-store - - private, max-age=60, s-maxage=60 - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Server: - - nginx - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Accept-Encoding - - Authorization, X-Filter - - Authorization, X-Filter - X-Accepted-Oauth-Scopes: - - account:read_only - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - DENY - - DENY - X-Oauth-Scopes: - - '*' - X-Ratelimit-Limit: - - "1200" - X-Xss-Protection: - - 1; mode=block - status: 200 OK - code: 200 - duration: "" diff --git a/test/integration/fixtures/TestAccountBetaPrograms.yaml b/test/integration/fixtures/TestAccountBetaPrograms.yaml new file mode 100644 index 000000000..c3040b623 --- /dev/null +++ b/test/integration/fixtures/TestAccountBetaPrograms.yaml @@ -0,0 +1,283 @@ +--- +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/betas?page=1 + method: GET + response: + body: '{"data": [{"id": "vpc_beta", "label": "Virtual Private Cloud (VPC) Pre-Registration", + "description": "VPC is coming to beta in select data centers soon! Virtual Private + Cloud (VPC) solution. A VPC is an isolated network that enables cloud resources + to privately communicate with each other and selectively gate access to the + public internet or other private networks. VPC will be available at no additional + cost both during the beta and when it enters general availability.\r\n\r\nPlease + note: VPC is not currently available in beta testing. By signing up to participate + in this beta when it becomes available, you consent to be subscribed to receive + emails from Akamai cloud computing services marketing and be contacted via email + when VPC is available.", "started": "2018-01-02T03:04:05", "ended": null, "greenlight_only": + false, "more_info": "https://www.linode.com/green-light/"}, {"id": "global_load_balancer_beta", + "label": "Akamai Global Load Balancer Pre-Registration", "description": "The + Akamai Global Load Balancer (AGLB) is a layer 4 and 7 load balancer that distributes + traffic based on performance, weight, and content (HTTP headers, query strings, + etc.). The AGLB is a multi-region, multicloud, independent of Akamai Delivery, + and built for East-West and North-South traffic. Key features include multi-region + load balancing and method selection. Beta for this product is coming soon\u2013 + sign up to be contacted first when AGLB is available.\r\n\r\nPlease note: Akamai + Global Load Balancer is not currently available in beta testing. By signing + up to participate in this beta when it becomes available, you consent to be + subscribed to receive emails from Akamai cloud computing services marketing + and be contacted via email when the beta period begins.", "started": "2018-01-02T03:04:05", + "ended": null, "greenlight_only": false, "more_info": "https://www.linode.com/green-light/"}], + "page": 1, "pages": 1, "results": 2}' + 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: + - private, max-age=0, s-maxage=0, no-cache, no-store + - private, max-age=60, s-maxage=60 + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - '*' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "800" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"id":"vpc_beta"}' + 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/betas + method: POST + response: + body: '{}' + 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: + - private, max-age=60, s-maxage=60 + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - account:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "800" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- 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/betas + method: GET + response: + body: '{"data": [{"id": "global_load_balancer_beta", "label": "Akamai Global Load + Balancer Pre-Registration", "enrolled": "2018-01-02T03:04:05", "description": + "The Akamai Global Load Balancer (AGLB) is a layer 4 and 7 load balancer that + distributes traffic based on performance, weight, and content (HTTP headers, + query strings, etc.). The AGLB is a multi-region, multicloud, independent of + Akamai Delivery, and built for East-West and North-South traffic. Key features + include multi-region load balancing and method selection. Beta for this product + is coming soon\u2013 sign up to be contacted first when AGLB is available.\r\n\r\nPlease + note: Akamai Global Load Balancer is not currently available in beta testing. + By signing up to participate in this beta when it becomes available, you consent + to be subscribed to receive emails from Akamai cloud computing services marketing + and be contacted via email when the beta period begins.", "started": "2018-01-02T03:04:05", + "ended": null}, {"id": "vpc_beta", "label": "Virtual Private Cloud (VPC) Pre-Registration", + "enrolled": "2018-01-02T03:04:05", "description": "VPC is coming to beta in + select data centers soon! Virtual Private Cloud (VPC) solution. A VPC is an + isolated network that enables cloud resources to privately communicate with + each other and selectively gate access to the public internet or other private + networks. VPC will be available at no additional cost both during the beta and + when it enters general availability.\r\n\r\nPlease note: VPC is not currently + available in beta testing. By signing up to participate in this beta when it + becomes available, you consent to be subscribed to receive emails from Akamai + cloud computing services marketing and be contacted via email when VPC is available.", + "started": "2018-01-02T03:04:05", "ended": null}], "page": 1, "pages": 1, "results": + 2}' + 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: + - private, max-age=0, s-maxage=0, no-cache, no-store + - private, max-age=60, s-maxage=60 + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - account:read_only + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "800" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- 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/betas/global_load_balancer_beta + method: GET + response: + body: '{"id": "global_load_balancer_beta", "label": "Akamai Global Load Balancer + Pre-Registration", "enrolled": "2018-01-02T03:04:05", "description": "The Akamai + Global Load Balancer (AGLB) is a layer 4 and 7 load balancer that distributes + traffic based on performance, weight, and content (HTTP headers, query strings, + etc.). The AGLB is a multi-region, multicloud, independent of Akamai Delivery, + and built for East-West and North-South traffic. Key features include multi-region + load balancing and method selection. Beta for this product is coming soon\u2013 + sign up to be contacted first when AGLB is available.\r\n\r\nPlease note: Akamai + Global Load Balancer is not currently available in beta testing. By signing + up to participate in this beta when it becomes available, you consent to be + subscribed to receive emails from Akamai cloud computing services marketing + and be contacted via email when the beta period begins.", "started": "2018-01-02T03:04:05", + "ended": 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: + - private, max-age=0, s-maxage=0, no-cache, no-store + - private, max-age=60, s-maxage=60 + Content-Length: + - "970" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Server: + - nginx + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - account:read_only + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "800" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" diff --git a/test/integration/fixtures/TestAccountBetaPrograms_List.yaml b/test/integration/fixtures/TestAccountBetaPrograms_List.yaml deleted file mode 100644 index 89493d6e2..000000000 --- a/test/integration/fixtures/TestAccountBetaPrograms_List.yaml +++ /dev/null @@ -1,85 +0,0 @@ ---- -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/betas - method: GET - response: - body: '{"data": [{"id": "cool-beta", "label": "\r\n\r\nRepellat consequatur sunt - qui. Fugit eligendi ipsa et assumenda ea aspernatur esse. A itaque iste distinctio - qui voluptas eum enim ipsa. Labore ducimus sit voluptas expedita ut non.\r\n\r\nAtque - iusto est cupiditate dignissimos soluta facere sunt molestias. Tenetur labore - est est et repudiandae praesentium officiis quis. Eveniet voluptate dignissimos - laboriosam esse maiores inventore reiciendis explicabo. Voluptas perspiciatis - voluptatibus distinctio.\r\n\r\nQui sed esse iusto ipsa repudiandae id. Quo - aut omnis id tenetur odio recusandae delectus iste. Dicta exercitationem voluptatem - accusamus. Voluptatum ut nesciunt architecto maiores.\r\n\r\nRecusandae natus - rerum aut quos aliquam. Et quisquam minima earum. Quam et quod nisi est praesentium - fuga voluptas. Blanditiis veniam aut totam.\r\n\r\nAssumenda accusantium similique - non reprehenderit sint deserunt harum vero. Et qui nihil ut. Reprehenderit quam - dicta qui repellendus perspiciatis voluptatum.\r\n", "enrolled": "2018-01-02T03:04:05", - "description": "\r\n\r\nRepellat consequatur sunt qui. Fugit eligendi ipsa et - assumenda ea aspernatur esse. A itaque iste distinctio qui voluptas eum enim - ipsa. Labore ducimus sit voluptas expedita ut non.\r\n\r\nAtque iusto est cupiditate - dignissimos soluta facere sunt molestias. Tenetur labore est est et repudiandae - praesentium officiis quis. Eveniet voluptate dignissimos laboriosam esse maiores - inventore reiciendis explicabo. Voluptas perspiciatis voluptatibus distinctio.\r\n\r\nQui - sed esse iusto ipsa repudiandae id. Quo aut omnis id tenetur odio recusandae - delectus iste. Dicta exercitationem voluptatem accusamus. Voluptatum ut nesciunt - architecto maiores.\r\n\r\nRecusandae natus rerum aut quos aliquam. Et quisquam - minima earum. Quam et quod nisi est praesentium fuga voluptas. Blanditiis veniam - aut totam.\r\n\r\nAssumenda accusantium similique non reprehenderit sint deserunt - harum vero. Et qui nihil ut. Reprehenderit quam dicta qui repellendus perspiciatis - voluptatum.\r\n", "started": "2018-01-02T03:04:05", "ended": "2018-01-02T03:04:05"}], - "page": 1, "pages": 1, "results": 1}' - 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: - - private, max-age=0, s-maxage=0, no-cache, no-store - - private, max-age=60, s-maxage=60 - Content-Security-Policy: - - default-src 'none' - Content-Type: - - application/json - Server: - - nginx - Strict-Transport-Security: - - max-age=31536000 - Vary: - - Accept-Encoding - - Authorization, X-Filter - - Authorization, X-Filter - X-Accepted-Oauth-Scopes: - - account:read_only - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - DENY - - DENY - X-Oauth-Scopes: - - '*' - X-Ratelimit-Limit: - - "1200" - X-Xss-Protection: - - 1; mode=block - status: 200 OK - code: 200 - duration: ""