diff --git a/tests/cassettes/test_integration/test_api_keys.yaml b/tests/cassettes/test_integration/test_api_keys.yaml index 34e0c52..adc18a4 100644 --- a/tests/cassettes/test_integration/test_api_keys.yaml +++ b/tests/cassettes/test_integration/test_api_keys.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"key_name": "pytest-5482"}' + body: '{"key_name": "pytest-8877"}' headers: Accept: - application/json @@ -18,7 +18,7 @@ interactions: uri: https://console.neon.tech/api/v2/api_keys response: body: - string: '{"id":768745,"key":"8b9ezkgcm46nk5fgdg84b31tw2smoojxcakymrvq46x4i0fis7puto9ad81o7d4c","name":"pytest-5482","created_at":"2024-01-23T22:34:47Z"}' + string: '{"id":770959,"key":"sujk30fcgqn9bwtte51fspimwqweod88e50t1p40v0j13zj15tjkk99ywzbt1xoz","name":"pytest-8877","created_at":"2024-01-24T13:55:40Z"}' headers: Connection: - keep-alive @@ -27,13 +27,13 @@ interactions: Content-Type: - application/json Date: - - Tue, 23 Jan 2024 22:34:47 GMT + - Wed, 24 Jan 2024 13:55:40 GMT Strict-Transport-Security: - max-age=15724800; includeSubDomains Vary: - Origin X-Neon-Ret-Request-Id: - - 534aa267d9215c4a9906eb1ecdecfbf1 + - 5343674b346d4b860442487c77e04caa status: code: 200 message: OK @@ -54,22 +54,22 @@ interactions: uri: https://console.neon.tech/api/v2/api_keys response: body: - string: '[{"id":768745,"name":"pytest-5482","created_at":"2024-01-23T22:34:47Z","last_used_at":null,"last_used_from_addr":""},{"id":768657,"name":"pytest-330","created_at":"2024-01-23T22:04:59Z","last_used_at":null,"last_used_from_addr":""},{"id":768620,"name":"neon_client","created_at":"2024-01-23T21:56:07Z","last_used_at":"2024-01-23T22:34:47Z","last_used_from_addr":"204.111.161.156"}]' + string: '[{"id":770959,"name":"pytest-8877","created_at":"2024-01-24T13:55:40Z","last_used_at":null,"last_used_from_addr":""},{"id":768620,"name":"neon_client","created_at":"2024-01-23T21:56:07Z","last_used_at":"2024-01-24T13:55:40Z","last_used_from_addr":"204.111.161.156"}]' headers: Connection: - keep-alive Content-Length: - - '381' + - '266' Content-Type: - application/json Date: - - Tue, 23 Jan 2024 22:34:47 GMT + - Wed, 24 Jan 2024 13:55:40 GMT Strict-Transport-Security: - max-age=15724800; includeSubDomains Vary: - Origin X-Neon-Ret-Request-Id: - - b1d947c8facb4874741524eb128f8839 + - 7e8f348f84f42246076507dd411b7364 status: code: 200 message: OK @@ -89,10 +89,10 @@ interactions: User-Agent: - neon-client/python version=(0.1.0) method: DELETE - uri: https://console.neon.tech/api/v2/api_keys/768745 + uri: https://console.neon.tech/api/v2/api_keys/770959 response: body: - string: '{"id":768745,"name":"pytest-5482","revoked":true,"last_used_at":null,"last_used_from_addr":""}' + string: '{"id":770959,"name":"pytest-8877","revoked":true,"last_used_at":null,"last_used_from_addr":""}' headers: Connection: - keep-alive @@ -101,13 +101,13 @@ interactions: Content-Type: - application/json Date: - - Tue, 23 Jan 2024 22:34:47 GMT + - Wed, 24 Jan 2024 13:55:40 GMT Strict-Transport-Security: - max-age=15724800; includeSubDomains Vary: - Origin X-Neon-Ret-Request-Id: - - 865a6f80f3ce504a56c9f422ec7ecae9 + - deaf54189dfd12fe26685391d6f9d609 status: code: 200 message: OK diff --git a/tests/cassettes/test_integration/test_branches.yaml b/tests/cassettes/test_integration/test_branches.yaml new file mode 100644 index 0000000..0378252 --- /dev/null +++ b/tests/cassettes/test_integration/test_branches.yaml @@ -0,0 +1,112 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"projects":[]}' + headers: + Connection: + - keep-alive + Content-Length: + - '15' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 72384706de02e9a3f7b00af35937c5f3 + status: + code: 200 + message: OK +- request: + body: '{"project": {"name": "pytest-1124"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: POST + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"cool-bird-75158673","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-1124","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z","consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"connection_uris":[{"connection_uri":"postgres://kennethreitz:pbKEAwCt4l3Q@ep-broad-shadow-a5zv1xko.us-east-2.aws.neon.tech/neondb","connection_parameters":{"database":"neondb","password":"pbKEAwCt4l3Q","role":"kennethreitz","host":"ep-broad-shadow-a5zv1xko.us-east-2.aws.neon.tech","pooler_host":"ep-broad-shadow-a5zv1xko-pooler.us-east-2.aws.neon.tech"}}],"roles":[{"branch_id":"br-silent-sunset-a5za8cyv","name":"kennethreitz","password":"pbKEAwCt4l3Q","protected":false,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z"}],"databases":[{"id":32636971,"branch_id":"br-silent-sunset-a5za8cyv","name":"neondb","owner_name":"kennethreitz","created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z"}],"operations":[{"id":"f1fc8c0f-d17c-4d24-9585-d8309def29d6","project_id":"cool-bird-75158673","branch_id":"br-silent-sunset-a5za8cyv","action":"create_timeline","status":"running","failures_count":0,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z","total_duration_ms":0},{"id":"acc6ae0a-60cc-4fe6-8f50-f07b86b617fb","project_id":"cool-bird-75158673","branch_id":"br-silent-sunset-a5za8cyv","endpoint_id":"ep-broad-shadow-a5zv1xko","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z","total_duration_ms":0}],"branch":{"id":"br-silent-sunset-a5za8cyv","project_id":"cool-bird-75158673","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z"},"endpoints":[{"host":"ep-broad-shadow-a5zv1xko.us-east-2.aws.neon.tech","id":"ep-broad-shadow-a5zv1xko","project_id":"cool-bird-75158673","branch_id":"br-silent-sunset-a5za8cyv","autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"region_id":"aws-us-east-2","type":"read_write","current_state":"init","pending_state":"active","settings":{},"pooler_enabled":false,"pooler_mode":"transaction","disabled":false,"passwordless_access":true,"creation_source":"console","created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z","proxy_host":"us-east-2.aws.neon.tech","suspend_timeout_seconds":0,"provisioner":"k8s-neonvm"}]}' + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Transfer-Encoding: + - chunked + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 0cc52a86da1812674c6af69b58cc1ca3 + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/cool-bird-75158673/branches + response: + body: + string: '{"branches":[{"id":"br-silent-sunset-a5za8cyv","project_id":"cool-bird-75158673","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z"}]}' + headers: + Connection: + - keep-alive + Content-Length: + - '372' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 34bbb6a0319f2064f340a67115109e1e + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_integration/test_database.yaml b/tests/cassettes/test_integration/test_database.yaml new file mode 100644 index 0000000..7d5956d --- /dev/null +++ b/tests/cassettes/test_integration/test_database.yaml @@ -0,0 +1,186 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"projects":[{"id":"cool-bird-75158673","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-1124","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0,"autoscaling_limit_max_cu":0,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"active_time":0,"cpu_used_sec":0,"creation_source":"console","created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z","synthetic_storage_size":0,"quota_reset_at":"2024-02-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}],"pagination":{"cursor":"cool-bird-75158673"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '797' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 9e5e07702eacff4d71123e78ce587e55 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: DELETE + uri: https://console.neon.tech/api/v2/projects/cool-bird-75158673 + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"cool-bird-75158673","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-1124","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:41Z","updated_at":"2024-01-24T13:55:41Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '965' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 2beb85d6b360051370d414661f56b6d8 + status: + code: 200 + message: OK +- request: + body: '{"project": {"name": "pytest-7669"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: POST + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"orange-mouse-15162169","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-7669","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z","consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"connection_uris":[{"connection_uri":"postgres://kennethreitz:g9oSHI5WCdBv@ep-spring-poetry-a5oz9ye3.us-east-2.aws.neon.tech/neondb","connection_parameters":{"database":"neondb","password":"g9oSHI5WCdBv","role":"kennethreitz","host":"ep-spring-poetry-a5oz9ye3.us-east-2.aws.neon.tech","pooler_host":"ep-spring-poetry-a5oz9ye3-pooler.us-east-2.aws.neon.tech"}}],"roles":[{"branch_id":"br-morning-bar-a5x6ve4b","name":"kennethreitz","password":"g9oSHI5WCdBv","protected":false,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z"}],"databases":[{"id":32636972,"branch_id":"br-morning-bar-a5x6ve4b","name":"neondb","owner_name":"kennethreitz","created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z"}],"operations":[{"id":"bd0121c1-84d1-487c-8424-02a69711e13f","project_id":"orange-mouse-15162169","branch_id":"br-morning-bar-a5x6ve4b","action":"create_timeline","status":"running","failures_count":0,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z","total_duration_ms":0},{"id":"6faa7a1f-c150-4054-88c4-8765bf113c01","project_id":"orange-mouse-15162169","branch_id":"br-morning-bar-a5x6ve4b","endpoint_id":"ep-spring-poetry-a5oz9ye3","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z","total_duration_ms":0}],"branch":{"id":"br-morning-bar-a5x6ve4b","project_id":"orange-mouse-15162169","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z"},"endpoints":[{"host":"ep-spring-poetry-a5oz9ye3.us-east-2.aws.neon.tech","id":"ep-spring-poetry-a5oz9ye3","project_id":"orange-mouse-15162169","branch_id":"br-morning-bar-a5x6ve4b","autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"region_id":"aws-us-east-2","type":"read_write","current_state":"init","pending_state":"active","settings":{},"pooler_enabled":false,"pooler_mode":"transaction","disabled":false,"passwordless_access":true,"creation_source":"console","created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z","proxy_host":"us-east-2.aws.neon.tech","suspend_timeout_seconds":0,"provisioner":"k8s-neonvm"}]}' + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Transfer-Encoding: + - chunked + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 02d485ba2e4af8c8bac3632a08c392ea + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/orange-mouse-15162169/branches + response: + body: + string: '{"branches":[{"id":"br-morning-bar-a5x6ve4b","project_id":"orange-mouse-15162169","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z"}]}' + headers: + Connection: + - keep-alive + Content-Length: + - '373' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 49ce39814f6f2441741050fa8bed3dc4 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/orange-mouse-15162169/branches/br-morning-bar-a5x6ve4b/databases + response: + body: + string: '{"databases":[{"id":32636972,"branch_id":"br-morning-bar-a5x6ve4b","name":"neondb","owner_name":"kennethreitz","created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z"}]}' + headers: + Connection: + - keep-alive + Content-Length: + - '185' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 539aac6dd764d02f6711b9dfccc949dd + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_integration/test_me.yaml b/tests/cassettes/test_integration/test_me.yaml index 1d72724..3fdc532 100644 --- a/tests/cassettes/test_integration/test_me.yaml +++ b/tests/cassettes/test_integration/test_me.yaml @@ -27,13 +27,13 @@ interactions: Content-Type: - application/json Date: - - Tue, 23 Jan 2024 22:34:47 GMT + - Wed, 24 Jan 2024 13:55:40 GMT Strict-Transport-Security: - max-age=15724800; includeSubDomains Vary: - Origin X-Neon-Ret-Request-Id: - - 9544ab13ec24fbd72c3ada96e9041957 + - d73a287b5650dadbd19664b6fd619780 status: code: 200 message: OK diff --git a/tests/cassettes/test_integration/test_operations.yaml b/tests/cassettes/test_integration/test_operations.yaml new file mode 100644 index 0000000..a950463 --- /dev/null +++ b/tests/cassettes/test_integration/test_operations.yaml @@ -0,0 +1,222 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"projects":[{"id":"orange-mouse-15162169","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-7669","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0,"autoscaling_limit_max_cu":0,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"active_time":0,"cpu_used_sec":0,"creation_source":"console","created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z","synthetic_storage_size":0,"quota_reset_at":"2024-02-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}],"pagination":{"cursor":"orange-mouse-15162169"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '803' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 334d17e596aae5ab273594e82a5b1ae4 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: DELETE + uri: https://console.neon.tech/api/v2/projects/orange-mouse-15162169 + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"orange-mouse-15162169","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-7669","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:42Z","updated_at":"2024-01-24T13:55:42Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '968' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:42 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - af7781ef29fbef45307379f58fbcf90d + status: + code: 200 + message: OK +- request: + body: '{"project": {"name": "pytest-1682"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: POST + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"dry-sun-32303143","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-1682","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"connection_uris":[{"connection_uri":"postgres://kennethreitz:U4arIXlN8gdh@ep-restless-lab-a5monq62.us-east-2.aws.neon.tech/neondb","connection_parameters":{"database":"neondb","password":"U4arIXlN8gdh","role":"kennethreitz","host":"ep-restless-lab-a5monq62.us-east-2.aws.neon.tech","pooler_host":"ep-restless-lab-a5monq62-pooler.us-east-2.aws.neon.tech"}}],"roles":[{"branch_id":"br-throbbing-block-a52mi9q5","name":"kennethreitz","password":"U4arIXlN8gdh","protected":false,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z"}],"databases":[{"id":32636973,"branch_id":"br-throbbing-block-a52mi9q5","name":"neondb","owner_name":"kennethreitz","created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z"}],"operations":[{"id":"7b4bb4c0-cc21-4000-a2cd-aba6f37465bc","project_id":"dry-sun-32303143","branch_id":"br-throbbing-block-a52mi9q5","action":"create_timeline","status":"running","failures_count":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","total_duration_ms":0},{"id":"73621f9a-3422-47c4-ab4d-b94fb2d5463e","project_id":"dry-sun-32303143","branch_id":"br-throbbing-block-a52mi9q5","endpoint_id":"ep-restless-lab-a5monq62","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","total_duration_ms":0}],"branch":{"id":"br-throbbing-block-a52mi9q5","project_id":"dry-sun-32303143","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z"},"endpoints":[{"host":"ep-restless-lab-a5monq62.us-east-2.aws.neon.tech","id":"ep-restless-lab-a5monq62","project_id":"dry-sun-32303143","branch_id":"br-throbbing-block-a52mi9q5","autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"region_id":"aws-us-east-2","type":"read_write","current_state":"init","pending_state":"active","settings":{},"pooler_enabled":false,"pooler_mode":"transaction","disabled":false,"passwordless_access":true,"creation_source":"console","created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","proxy_host":"us-east-2.aws.neon.tech","suspend_timeout_seconds":0,"provisioner":"k8s-neonvm"}]}' + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:43 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Transfer-Encoding: + - chunked + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 5b28f365f3e4a1905d62ace02e54bc8d + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/dry-sun-32303143/branches + response: + body: + string: '{"branches":[{"id":"br-throbbing-block-a52mi9q5","project_id":"dry-sun-32303143","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z"}]}' + headers: + Connection: + - keep-alive + Content-Length: + - '372' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:43 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 941f4e0580c0ad9cc77230b352229faa + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/dry-sun-32303143/operations + response: + body: + string: '{"operations":[{"id":"73621f9a-3422-47c4-ab4d-b94fb2d5463e","project_id":"dry-sun-32303143","branch_id":"br-throbbing-block-a52mi9q5","endpoint_id":"ep-restless-lab-a5monq62","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","total_duration_ms":0},{"id":"7b4bb4c0-cc21-4000-a2cd-aba6f37465bc","project_id":"dry-sun-32303143","branch_id":"br-throbbing-block-a52mi9q5","action":"create_timeline","status":"running","failures_count":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","total_duration_ms":19}],"pagination":{"cursor":"2024-01-24T13:55:43.040646Z"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '671' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:43 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - f9077f132d1665c3c045afef70d862da + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/dry-sun-32303143/operations/73621f9a-3422-47c4-ab4d-b94fb2d5463e + response: + body: + string: '{"operation":{"id":"73621f9a-3422-47c4-ab4d-b94fb2d5463e","project_id":"dry-sun-32303143","branch_id":"br-throbbing-block-a52mi9q5","endpoint_id":"ep-restless-lab-a5monq62","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-24T13:55:43Z","updated_at":"2024-01-24T13:55:43Z","total_duration_ms":0}}' + headers: + Connection: + - keep-alive + Content-Length: + - '334' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:43 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - f2499ce88636163dcc68c88be4051ca1 + status: + code: 200 + message: OK +version: 1 diff --git a/tests/cassettes/test_integration/test_project.yaml b/tests/cassettes/test_integration/test_project.yaml index 2b69747..2c07352 100644 --- a/tests/cassettes/test_integration/test_project.yaml +++ b/tests/cassettes/test_integration/test_project.yaml @@ -16,134 +16,22 @@ interactions: uri: https://console.neon.tech/api/v2/projects response: body: - string: '{"projects":[]}' + string: '{"projects":[{"id":"sweet-haze-98484788","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-2613","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0,"autoscaling_limit_max_cu":0,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"active_time":0,"cpu_used_sec":0,"creation_source":"console","created_at":"2024-01-24T13:55:29Z","updated_at":"2024-01-24T13:55:32Z","synthetic_storage_size":0,"quota_reset_at":"2024-02-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}],"pagination":{"cursor":"sweet-haze-98484788"}}' headers: Connection: - keep-alive Content-Length: - - '15' + - '799' Content-Type: - application/json Date: - - Tue, 23 Jan 2024 22:34:47 GMT + - Wed, 24 Jan 2024 13:55:40 GMT Strict-Transport-Security: - max-age=15724800; includeSubDomains Vary: - Origin X-Neon-Ret-Request-Id: - - 885bb4b68476fa2b8e98495e45aec920 - status: - code: 200 - message: OK -- request: - body: '{"project": {"name": "pytest-904"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '35' - Content-Type: - - application/json - User-Agent: - - neon-client/python version=(0.1.0) - method: POST - uri: https://console.neon.tech/api/v2/projects - response: - body: - string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"odd-math-29198916","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-904","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"connection_uris":[{"connection_uri":"postgres://kennethreitz:m5T4RJPdEjiB@ep-tiny-art-a5s7uzng.us-east-2.aws.neon.tech/neondb","connection_parameters":{"database":"neondb","password":"m5T4RJPdEjiB","role":"kennethreitz","host":"ep-tiny-art-a5s7uzng.us-east-2.aws.neon.tech","pooler_host":"ep-tiny-art-a5s7uzng-pooler.us-east-2.aws.neon.tech"}}],"roles":[{"branch_id":"br-patient-sun-a59mbwwo","name":"kennethreitz","password":"m5T4RJPdEjiB","protected":false,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z"}],"databases":[{"id":32625994,"branch_id":"br-patient-sun-a59mbwwo","name":"neondb","owner_name":"kennethreitz","created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z"}],"operations":[{"id":"bbab693e-6ad7-4454-866d-fd845bcfaaf9","project_id":"odd-math-29198916","branch_id":"br-patient-sun-a59mbwwo","action":"create_timeline","status":"running","failures_count":0,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","total_duration_ms":0},{"id":"488a4eea-86fb-4647-8692-3c64663d73bb","project_id":"odd-math-29198916","branch_id":"br-patient-sun-a59mbwwo","endpoint_id":"ep-tiny-art-a5s7uzng","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","total_duration_ms":0}],"branch":{"id":"br-patient-sun-a59mbwwo","project_id":"odd-math-29198916","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z"},"endpoints":[{"host":"ep-tiny-art-a5s7uzng.us-east-2.aws.neon.tech","id":"ep-tiny-art-a5s7uzng","project_id":"odd-math-29198916","branch_id":"br-patient-sun-a59mbwwo","autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"region_id":"aws-us-east-2","type":"read_write","current_state":"init","pending_state":"active","settings":{},"pooler_enabled":false,"pooler_mode":"transaction","disabled":false,"passwordless_access":true,"creation_source":"console","created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","proxy_host":"us-east-2.aws.neon.tech","suspend_timeout_seconds":0,"provisioner":"k8s-neonvm"}]}' - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 23 Jan 2024 22:34:47 GMT - Strict-Transport-Security: - - max-age=15724800; includeSubDomains - Transfer-Encoding: - - chunked - Vary: - - Origin - X-Neon-Ret-Request-Id: - - d6a3d3706e83028d272e71af8033ff8f - status: - code: 201 - message: Created -- request: - body: '{"project": {"name": "pytest-renamed"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '39' - Content-Type: - - application/json - User-Agent: - - neon-client/python version=(0.1.0) - method: PATCH - uri: https://console.neon.tech/api/v2/projects/odd-math-29198916 - response: - body: - string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"odd-math-29198916","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-renamed","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"operations":[]}' - headers: - Connection: - - keep-alive - Content-Length: - - '983' - Content-Type: - - application/json - Date: - - Tue, 23 Jan 2024 22:34:47 GMT - Strict-Transport-Security: - - max-age=15724800; includeSubDomains - Vary: - - Origin - X-Neon-Ret-Request-Id: - - a7a4233be7008d15eda8469e20863777 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Type: - - application/json - User-Agent: - - neon-client/python version=(0.1.0) - method: GET - uri: https://console.neon.tech/api/v2/projects - response: - body: - string: '{"projects":[{"id":"odd-math-29198916","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-renamed","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0,"autoscaling_limit_max_cu":0,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"active_time":0,"cpu_used_sec":0,"creation_source":"console","created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","synthetic_storage_size":0,"quota_reset_at":"2024-02-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}],"pagination":{"cursor":"odd-math-29198916"}}' - headers: - Connection: - - keep-alive - Content-Length: - - '798' - Content-Type: - - application/json - Date: - - Tue, 23 Jan 2024 22:34:48 GMT - Strict-Transport-Security: - - max-age=15724800; includeSubDomains - Vary: - - Origin - X-Neon-Ret-Request-Id: - - ac8e72b6c67669eed91b8d44c01d5836 + - 5f52745db752fe63d81b6fa30592bbf7 status: code: 200 message: OK @@ -163,25 +51,211 @@ interactions: User-Agent: - neon-client/python version=(0.1.0) method: DELETE - uri: https://console.neon.tech/api/v2/projects/odd-math-29198916 + uri: https://console.neon.tech/api/v2/projects/sweet-haze-98484788 response: body: - string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"odd-math-29198916","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-renamed","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-23T22:34:47Z","updated_at":"2024-01-23T22:34:47Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}}' + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"sweet-haze-98484788","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-2613","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:29Z","updated_at":"2024-01-24T13:55:32Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}}' headers: Connection: - keep-alive Content-Length: - - '967' + - '966' Content-Type: - application/json Date: - - Tue, 23 Jan 2024 22:34:48 GMT + - Wed, 24 Jan 2024 13:55:40 GMT Strict-Transport-Security: - max-age=15724800; includeSubDomains Vary: - Origin X-Neon-Ret-Request-Id: - - f75e2d355a42c82bd0eb7cb457d10f1f + - e1c6a5c4ef7e369a08c1dd73b3e9ef23 + status: + code: 200 + message: OK +- request: + body: '{"project": {"name": "pytest-4374"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: POST + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"white-sea-87434266","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-4374","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z","consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"connection_uris":[{"connection_uri":"postgres://kennethreitz:3fP0zFQDMBIw@ep-lively-sound-a5ju8ula.us-east-2.aws.neon.tech/neondb","connection_parameters":{"database":"neondb","password":"3fP0zFQDMBIw","role":"kennethreitz","host":"ep-lively-sound-a5ju8ula.us-east-2.aws.neon.tech","pooler_host":"ep-lively-sound-a5ju8ula-pooler.us-east-2.aws.neon.tech"}}],"roles":[{"branch_id":"br-hidden-hill-a53agcv4","name":"kennethreitz","password":"3fP0zFQDMBIw","protected":false,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z"}],"databases":[{"id":32636970,"branch_id":"br-hidden-hill-a53agcv4","name":"neondb","owner_name":"kennethreitz","created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z"}],"operations":[{"id":"1e288547-1fbe-4fa6-b759-c11da496214c","project_id":"white-sea-87434266","branch_id":"br-hidden-hill-a53agcv4","action":"create_timeline","status":"running","failures_count":0,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z","total_duration_ms":0},{"id":"97b30201-c34e-49a3-a7d9-fcd51013595e","project_id":"white-sea-87434266","branch_id":"br-hidden-hill-a53agcv4","endpoint_id":"ep-lively-sound-a5ju8ula","action":"start_compute","status":"scheduling","failures_count":0,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z","total_duration_ms":0}],"branch":{"id":"br-hidden-hill-a53agcv4","project_id":"white-sea-87434266","name":"main","current_state":"init","pending_state":"ready","creation_source":"console","primary":true,"cpu_used_sec":0,"compute_time_seconds":0,"active_time_seconds":0,"written_data_bytes":0,"data_transfer_bytes":0,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z"},"endpoints":[{"host":"ep-lively-sound-a5ju8ula.us-east-2.aws.neon.tech","id":"ep-lively-sound-a5ju8ula","project_id":"white-sea-87434266","branch_id":"br-hidden-hill-a53agcv4","autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"region_id":"aws-us-east-2","type":"read_write","current_state":"init","pending_state":"active","settings":{},"pooler_enabled":false,"pooler_mode":"transaction","disabled":false,"passwordless_access":true,"creation_source":"console","created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z","proxy_host":"us-east-2.aws.neon.tech","suspend_timeout_seconds":0,"provisioner":"k8s-neonvm"}]}' + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Transfer-Encoding: + - chunked + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 2dc7ab47633f1472b645f759c4b3b070 + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects/white-sea-87434266 + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"white-sea-87434266","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-4374","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:40Z","synthetic_storage_size":0,"consumption_period_start":"2024-01-13T02:10:30Z","consumption_period_end":"2024-02-01T00:00:00Z","quota_reset_at":"2024-02-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de","owner":{"email":"me@kennethreitz.org","branches_limit":10,"subscription_type":"free"}}}' + headers: + Connection: + - keep-alive + Content-Length: + - '1092' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 9e21226f04691fffb98122626fe07196 + status: + code: 200 + message: OK +- request: + body: '{"project": {"name": "pytest-2492"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: PATCH + uri: https://console.neon.tech/api/v2/projects/white-sea-87434266 + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"white-sea-87434266","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-2492","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:41Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"},"operations":[]}' + headers: + Connection: + - keep-alive + Content-Length: + - '981' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - f1eb5bf99fc70e6dd4329b6c2b9fce03 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: GET + uri: https://console.neon.tech/api/v2/projects + response: + body: + string: '{"projects":[{"id":"white-sea-87434266","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-2492","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0,"autoscaling_limit_max_cu":0,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"active_time":0,"cpu_used_sec":0,"creation_source":"console","created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:41Z","synthetic_storage_size":0,"quota_reset_at":"2024-02-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}],"pagination":{"cursor":"white-sea-87434266"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '797' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - c053cb0d9716657cafdb9f8dc4da5578 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + User-Agent: + - neon-client/python version=(0.1.0) + method: DELETE + uri: https://console.neon.tech/api/v2/projects/white-sea-87434266 + response: + body: + string: '{"project":{"data_storage_bytes_hour":0,"data_transfer_bytes":0,"written_data_bytes":0,"compute_time_seconds":0,"active_time_seconds":0,"cpu_used_sec":0,"id":"white-sea-87434266","platform_id":"aws","region_id":"aws-us-east-2","name":"pytest-2492","provisioner":"k8s-neonvm","default_endpoint_settings":{"autoscaling_limit_min_cu":0.25,"autoscaling_limit_max_cu":0.25,"suspend_timeout_seconds":0},"settings":{"allowed_ips":{"ips":[],"primary_branch_only":false},"enable_logical_replication":false},"pg_version":15,"proxy_host":"us-east-2.aws.neon.tech","branch_logical_size_limit":3072,"branch_logical_size_limit_bytes":3221225472,"store_passwords":true,"creation_source":"console","history_retention_seconds":604800,"created_at":"2024-01-24T13:55:40Z","updated_at":"2024-01-24T13:55:41Z","synthetic_storage_size":0,"consumption_period_start":"0001-01-01T00:00:00Z","consumption_period_end":"0001-01-01T00:00:00Z","owner_id":"838386f6-b5f1-4c3b-89a2-4f5a130ef3de"}}' + headers: + Connection: + - keep-alive + Content-Length: + - '965' + Content-Type: + - application/json + Date: + - Wed, 24 Jan 2024 13:55:41 GMT + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Vary: + - Origin + X-Neon-Ret-Request-Id: + - 6a9cbfb294599c762388953bcbc4769a status: code: 200 message: OK diff --git a/tests/test_integration.py b/tests/test_integration.py index cfd4e5c..2e670aa 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -29,36 +29,117 @@ def test_api_keys(neon, random_name): @pytest.mark.vcr def test_project(neon, ensure_no_projects, random_name): + # Ensure there are no projects. ensure_no_projects() + # Create a project. project1 = neon.project_create(project={"name": random_name()}).project assert project1.id - project2 = neon.project_update( - project1.id, project={"name": "pytest-renamed"} - ).project + # Get the project. + project = neon.project(project1.id).project + assert project.id == project1.id + # Rename the project. + project2 = neon.project_update(project1.id, project={"name": random_name()}).project + + # Ensure that the names are different. assert project1.name != project2.name + # Ensure that the IDs are present. for project in neon.projects().projects: assert hasattr(project, "id") + # Delete the project. neon.project_delete(project.id) -# @pytest.mark.vcr -# def test_update_project(neon, ensure_project): -# project = ensure_project() +@pytest.mark.vcr +def test_branches(neon, ensure_no_projects, random_name): + # Ensure there are no projects. + ensure_no_projects() -# project_update = {"project": {"name": "pytest-renamed"}} + # Create a project. + project = neon.project_create(project={"name": random_name()}).project + assert project.id -# # r = neon.project_update(, **project_update) -# assert r.project.name == "pytest-renamed" + # import time + + # time.sleep(5) + + # Create a branch. + # branch1 = neon.branch_create(project.id, branch={"name": random_name()}).branch + # assert branch1.id + + # Rename the branch. + # branch2 = neon.branch_update(branch1.id, branch={"name": random_name()}).branch + # Ensure that the names are different. + # assert branch2.name != branch1.name + + # Ensure that the IDs are present. + # for i, branch in neon.branches(project.id).branches: + # if i == 0: + # Only set the first branch as primary. + # neon.branch_set_as_primary(project.id, branch.id) + # pass + + # List branches. + neon.branches(project.id) + # Delete the project. + # neon.branch_delete(project.id, branch_id=neon.branches(project.id).branches[].id) -# @pytest.mark.vcr -# def test_project_delete(neon, ensure_project): -# r = ensure_project() -# print(r) -# exit() -# r = neon.project_delete(r.id) +@pytest.mark.vcr +def test_database(neon, ensure_no_projects, random_name): + # Ensure there are no projects. + ensure_no_projects() + + # Create a project. + project = neon.project_create(project={"name": random_name()}).project + assert project.id + + branch = neon.branches(project.id).branches[0] + + # List databases. + databases = neon.databases(project.id, branch.id).databases + assert len(databases) + + # Create a database. + # database = neon.database_create( + # project.id, + # branch.id, + # database={"name": random_name(), "owner_name": "kennethreitz"}, + # ).database + + # Get the Database. + # database = neon.database(project.id, branch.id, database.id).database + # assert database.id + + # # Rename the database. + # database = neon.database_update( + # project.id, + # branch.id, + # database.id, + # database={"name": random_name()}, + # ).database + + +@pytest.mark.vcr +def test_operations(neon, ensure_no_projects, random_name): + # Ensure there are no projects. + ensure_no_projects() + + # Create a project. + project = neon.project_create(project={"name": random_name()}).project + assert project.id + + branch = neon.branches(project.id).branches[0] + + # List operations. + operations = neon.operations(project.id).operations + assert len(operations) + + # Get the operation. + operation = operations[0] + operation = neon.operation(project.id, operation.id).operation + assert operation.id