diff --git a/fastapi-postgres/Dockerfile b/fastapi-postgres/Dockerfile index 8dfa645..dc51d4b 100644 --- a/fastapi-postgres/Dockerfile +++ b/fastapi-postgres/Dockerfile @@ -14,11 +14,11 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . # Set environment variables for PostgreSQL -ENV POSTGRES_USER=postgres \ - POSTGRES_PASSWORD=postgres \ - POSTGRES_DB=studentdb \ - POSTGRES_HOST=0.0.0.0 \ - POSTGRES_PORT=5432 +# ENV POSTGRES_USER=postgres \ +# POSTGRES_PASSWORD=postgres \ +# POSTGRES_DB=studentdb \ +# POSTGRES_HOST=0.0.0.0 \ +# POSTGRES_PORT=5432 # Install PostgreSQL client RUN apt-get update && apt-get install -y postgresql-client @@ -27,4 +27,4 @@ RUN apt-get update && apt-get install -y postgresql-client EXPOSE 8000 # Start the FastAPI application -CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] +CMD ["uvicorn", "application.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/fastapi-postgres/keploy/test-set-1/mocks.yaml b/fastapi-postgres/keploy/test-set-1/mocks.yaml new file mode 100755 index 0000000..86b47c1 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-1/mocks.yaml @@ -0,0 +1,1219 @@ +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-0 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + length: 8 + payload: AAAACATSFi8= + ssl_request: + is_ssl: true + auth_type: 0 + postgresresponses: + - payload: Tg== + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.216898875Z + restimestampmock: 2024-02-09T10:20:50.218562705Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-1 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAKgADAAB1c2VyAHBvc3RncmVzAGRhdGFiYXNlAHN0dWRlbnRkYgAA + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl: + auth_mechanisms: + - SCRAM-SHA-256 + msg_type: 82 + auth_type: 10 + reqtimestampmock: 2024-02-09T10:20:50.232737784Z + restimestampmock: 2024-02-09T10:20:50.233296602Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-2 +spec: + metadata: + type: config + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + password_message: + password: SCRAM-SHA-256 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl_continue: {data: [114, 61, 68, 54, 118, 109, 56, 118, 117, 82, 116, 89, 111, 116, 75, 81, 75, 86, 74, 100, 55, 47, 85, 115, 107, 90, 70, 78, 88, 79, 112, 80, 88, 84, 67, 105, 103, 86, 51, 101, 73, 90, 48, 105, 119, 117, 65, 106, 111, 83, 44, 115, 61, 117, 110, 74, 50, 122, 68, 57, 75, 121, 76, 47, 109, 83, 114, 117, 111, 102, 121, 55, 112, 84, 81, 61, 61, 44, 105, 61, 52, 48, 57, 54]} + msg_type: 82 + auth_type: 11 + reqtimestampmock: 2024-02-09T10:20:50.234459113Z + restimestampmock: 2024-02-09T10:20:50.234488904Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-3 +spec: + metadata: + type: config + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R, R, S, S, S, S, S, S, S, S, S, S, S, S, S, S, K, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl_final: {data: [118, 61, 118, 48, 53, 82, 117, 66, 89, 50, 52, 51, 72, 85, 67, 97, 116, 102, 83, 55, 67, 69, 70, 43, 72, 84, 106, 89, 90, 79, 118, 115, 115, 78, 48, 56, 116, 120, 99, 48, 103, 106, 105, 119, 85, 61]} + backend_key_data: + process_id: 34 + secret_key: 4065475156 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Etc/UTC + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "on" + - name: application_name + value: "" + - name: default_transaction_read_only + value: "off" + - name: scram_iterations + value: "4096" + - name: DateStyle + value: ISO, MDY + - name: standard_conforming_strings + value: "on" + - name: session_authorization + value: postgres + - name: client_encoding + value: UTF8 + - name: server_version + value: 16.1 (Debian 16.1-1.pgdg120+1) + - name: server_encoding + value: UTF8 + - name: server_encoding + value: UTF8 + - name: server_encoding + value: UTF8 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.240419203Z + restimestampmock: 2024-02-09T10:20:50.24047866Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-4 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.241574547Z + restimestampmock: 2024-02-09T10:20:50.241651254Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-5 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAHdTRUxFQ1QgdC5vaWQsIHR5cGFycmF5CkZST00gcGdfdHlwZSB0IEpPSU4gcGdfbmFtZXNwYWNlIG5zCiAgICBPTiB0eXBuYW1lc3BhY2UgPSBucy5vaWQKV0hFUkUgdHlwbmFtZSA9ICdoc3RvcmUnOwoA + query: + string: 'SELECT t.oid, typarray FROM pg_type t JOIN pg_namespace ns ON typnamespace = ns.oid WHERE typname = ''hstore''; ' + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [111, 105, 100], table_oid: 1247, table_attribute_number: 1, data_type_oid: 26, data_type_size: 4, type_modifier: -1, format: 0}, {name: [116, 121, 112, 97, 114, 114, 97, 121], table_oid: 1247, table_attribute_number: 15, data_type_oid: 26, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.243360791Z + restimestampmock: 2024-02-09T10:20:50.243385416Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-6 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.244072772Z + restimestampmock: 2024-02-09T10:20:50.244098563Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-7 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.244693006Z + restimestampmock: 2024-02-09T10:20:50.244715338Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-8 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: select pg_catalog.version() + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAACAAAXZlcnNpb24AAAAAAAAAAAAAGf///////wAARAAAAIMAAQAAAHlQb3N0Z3JlU1FMIDE2LjEgKERlYmlhbiAxNi4xLTEucGdkZzEyMCsxKSBvbiBhYXJjaDY0LXVua25vd24tbGludXgtZ251LCBjb21waWxlZCBieSBnY2MgKERlYmlhbiAxMi4yLjAtMTQpIDEyLjIuMCwgNjQtYml0QwAAAA1TRUxFQ1QgMQBaAAAABVQ= + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{row_values: ['PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit']}, {row_values: ['PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit']}, {row_values: ['PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit']}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [118, 101, 114, 115, 105, 111, 110], table_oid: 0, table_attribute_number: 0, data_type_oid: 25, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.24516216Z + restimestampmock: 2024-02-09T10:20:50.245191367Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-9 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: select current_schema() + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAACcAAWN1cnJlbnRfc2NoZW1hAAAAAAAAAAAAABMAQP////8AAEQAAAAQAAEAAAAGcHVibGljQwAAAA1TRUxFQ1QgMQBaAAAABVQ= + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{row_values: [public]}, {row_values: [public]}, {row_values: [public]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [99, 117, 114, 114, 101, 110, 116, 95, 115, 99, 104, 101, 109, 97], table_oid: 0, table_attribute_number: 0, data_type_oid: 19, data_type_size: 64, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.246241214Z + restimestampmock: 2024-02-09T10:20:50.246281713Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-10 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: show transaction isolation level + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAAC4AAXRyYW5zYWN0aW9uX2lzb2xhdGlvbgAAAAAAAAAAAAAZ////////AABEAAAAGAABAAAADnJlYWQgY29tbWl0dGVkQwAAAAlTSE9XAFoAAAAFVA== + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 72 + - 79 + - 87 + data_row: [{row_values: [read committed]}, {row_values: [read committed]}, {row_values: [read committed]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 115, 111, 108, 97, 116, 105, 111, 110], table_oid: 0, table_attribute_number: 0, data_type_oid: 25, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.247356559Z + restimestampmock: 2024-02-09T10:20:50.247387933Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-11 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: show standard_conforming_strings + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAADQAAXN0YW5kYXJkX2NvbmZvcm1pbmdfc3RyaW5ncwAAAAAAAAAAAAAZ////////AABEAAAADAABAAAAAm9uQwAAAAlTSE9XAFoAAAAFVA== + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 72 + - 79 + - 87 + data_row: [{row_values: ["on"]}, {row_values: ["on"]}, {row_values: ["on"]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 97, 110, 100, 97, 114, 100, 95, 99, 111, 110, 102, 111, 114, 109, 105, 110, 103, 95, 115, 116, 114, 105, 110, 103, 115], table_oid: 0, table_attribute_number: 0, data_type_oid: 25, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.248114456Z + restimestampmock: 2024-02-09T10:20:50.24815283Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-12 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.248975766Z + restimestampmock: 2024-02-09T10:20:50.24899789Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-13 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.252045225Z + restimestampmock: 2024-02-09T10:20:50.252072266Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-14 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAYdTRUxFQ1QgcGdfY2F0YWxvZy5wZ19jbGFzcy5yZWxuYW1lIApGUk9NIHBnX2NhdGFsb2cucGdfY2xhc3MgSk9JTiBwZ19jYXRhbG9nLnBnX25hbWVzcGFjZSBPTiBwZ19jYXRhbG9nLnBnX25hbWVzcGFjZS5vaWQgPSBwZ19jYXRhbG9nLnBnX2NsYXNzLnJlbG5hbWVzcGFjZSAKV0hFUkUgcGdfY2F0YWxvZy5wZ19jbGFzcy5yZWxuYW1lID0gJ3N0dWRlbnRzJyBBTkQgcGdfY2F0YWxvZy5wZ19jbGFzcy5yZWxraW5kID0gQU5ZIChBUlJBWVsncicsICdwJywgJ2YnLCAndicsICdtJ10pIEFORCBwZ19jYXRhbG9nLnBnX3RhYmxlX2lzX3Zpc2libGUocGdfY2F0YWxvZy5wZ19jbGFzcy5vaWQpIEFORCBwZ19jYXRhbG9nLnBnX25hbWVzcGFjZS5uc3BuYW1lICE9ICdwZ19jYXRhbG9nJwA= + query: + string: SELECT pg_catalog.pg_class.relname FROM pg_catalog.pg_class JOIN pg_catalog.pg_namespace ON pg_catalog.pg_namespace.oid = pg_catalog.pg_class.relnamespace WHERE pg_catalog.pg_class.relname = 'students' AND pg_catalog.pg_class.relkind = ANY (ARRAY['r', 'p', 'f', 'v', 'm']) AND pg_catalog.pg_table_is_visible(pg_catalog.pg_class.oid) AND pg_catalog.pg_namespace.nspname != 'pg_catalog' + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAACAAAXJlbG5hbWUAAAAE6wACAAAAEwBA/////wAARAAAABIAAQAAAAhzdHVkZW50c0MAAAANU0VMRUNUIDEAWgAAAAVU + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{row_values: [students]}, {row_values: [students]}, {row_values: [students]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [114, 101, 108, 110, 97, 109, 101], table_oid: 1259, table_attribute_number: 2, data_type_oid: 19, data_type_size: 64, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.253162445Z + restimestampmock: 2024-02-09T10:20:50.253222319Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-15 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: COMMIT + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 67 + - 79 + - 77 + - 77 + - 73 + - 84 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:20:50.254107087Z + restimestampmock: 2024-02-09T10:20:50.25412767Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-16 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.542685552Z + restimestampmock: 2024-02-09T10:21:01.542714843Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-17 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAATBTRUxFQ1Qgc3R1ZGVudHMuIklEIiBBUyAic3R1ZGVudHNfSUQiLCBzdHVkZW50cy4iTmFtZSIgQVMgInN0dWRlbnRzX05hbWUiLCBzdHVkZW50cy4iRW1haWwiIEFTICJzdHVkZW50c19FbWFpbCIsIHN0dWRlbnRzLiJIYXNoZWQgUGFzc3dvcmQiIEFTICJzdHVkZW50c19IYXNoZWQgUGFzc3dvcmQiLCBzdHVkZW50cy4iU3ViamVjdCBTdHJlYW0iIEFTICJzdHVkZW50c19TdWJqZWN0IFN0cmVhbSIgCkZST00gc3R1ZGVudHMgCldIRVJFIHN0dWRlbnRzLiJFbWFpbCIgPSAnZXZhd2hpdGVAZXhhbXBsZS5jb20nIAogTElNSVQgMQA= + query: + string: SELECT students."ID" AS "students_ID", students."Name" AS "students_Name", students."Email" AS "students_Email", students."Hashed Password" AS "students_Hashed Password", students."Subject Stream" AS "students_Subject Stream" FROM students WHERE students."Email" = 'evawhite@example.com' LIMIT 1 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.543969268Z + restimestampmock: 2024-02-09T10:21:01.544053057Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-18 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: INSERT INTO students ("Name", "Email", "Hashed Password", "Subject Stream") VALUES ('Eva White', 'evawhite@example.com', 'sfwbxijuf222', 'Mathematics') RETURNING students."ID" + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAABsAAUlEAAAAYAEAAQAAABcABP////8AAEQAAAALAAEAAAABMUMAAAAPSU5TRVJUIDAgMQBaAAAABVQ= + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 73 + - 78 + - 83 + - 69 + - 82 + - 84 + - 32 + - 48 + - 32 + - 49 + data_row: [{row_values: ["1"]}, {row_values: ["1"]}, {row_values: ["1"]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.546426702Z + restimestampmock: 2024-02-09T10:21:01.546463701Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-19 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: COMMIT + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 67 + - 79 + - 77 + - 77 + - 73 + - 84 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.551006372Z + restimestampmock: 2024-02-09T10:21:01.55108062Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-20 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.552699118Z + restimestampmock: 2024-02-09T10:21:01.552721743Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-21 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAJtTRUxFQ1Qgc3R1ZGVudHMuIklEIiwgc3R1ZGVudHMuIk5hbWUiLCBzdHVkZW50cy4iRW1haWwiLCBzdHVkZW50cy4iSGFzaGVkIFBhc3N3b3JkIiwgc3R1ZGVudHMuIlN1YmplY3QgU3RyZWFtIiAKRlJPTSBzdHVkZW50cyAKV0hFUkUgc3R1ZGVudHMuIklEIiA9IDEA + query: + string: SELECT students."ID", students."Name", students."Email", students."Hashed Password", students."Subject Stream" FROM students WHERE students."ID" = 1 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAAI0ABUlEAAAAYAEAAQAAABcABP////8AAE5hbWUAAABgAQACAAAEE////////wAARW1haWwAAABgAQADAAAEE////////wAASGFzaGVkIFBhc3N3b3JkAAAAYAEABAAABBP///////8AAFN1YmplY3QgU3RyZWFtAAAAYAEABQAABBP///////8AAEQAAABPAAUAAAABMQAAAAlFdmEgV2hpdGUAAAAUZXZhd2hpdGVAZXhhbXBsZS5jb20AAAAMc2Z3YnhpanVmMjIyAAAAC01hdGhlbWF0aWNzQwAAAA1TRUxFQ1QgMQBaAAAABVQ= + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{row_values: ["1", Eva White, evawhite@example.com, sfwbxijuf222, Mathematics]}, {row_values: ["1", Eva White, evawhite@example.com, sfwbxijuf222, Mathematics]}, {row_values: ["1", Eva White, evawhite@example.com, sfwbxijuf222, Mathematics]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.553203147Z + restimestampmock: 2024-02-09T10:21:01.553236062Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-22 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:01.556089153Z + restimestampmock: 2024-02-09T10:21:01.556110861Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-23 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.223148624Z + restimestampmock: 2024-02-09T10:21:11.223211164Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-24 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAS9TRUxFQ1Qgc3R1ZGVudHMuIklEIiBBUyAic3R1ZGVudHNfSUQiLCBzdHVkZW50cy4iTmFtZSIgQVMgInN0dWRlbnRzX05hbWUiLCBzdHVkZW50cy4iRW1haWwiIEFTICJzdHVkZW50c19FbWFpbCIsIHN0dWRlbnRzLiJIYXNoZWQgUGFzc3dvcmQiIEFTICJzdHVkZW50c19IYXNoZWQgUGFzc3dvcmQiLCBzdHVkZW50cy4iU3ViamVjdCBTdHJlYW0iIEFTICJzdHVkZW50c19TdWJqZWN0IFN0cmVhbSIgCkZST00gc3R1ZGVudHMgCldIRVJFIHN0dWRlbnRzLiJFbWFpbCIgPSAnam9obmRvZUBleGFtcGxlLmNvbScgCiBMSU1JVCAxAA== + query: + string: SELECT students."ID" AS "students_ID", students."Name" AS "students_Name", students."Email" AS "students_Email", students."Hashed Password" AS "students_Hashed Password", students."Subject Stream" AS "students_Subject Stream" FROM students WHERE students."Email" = 'johndoe@example.com' LIMIT 1 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.224563961Z + restimestampmock: 2024-02-09T10:21:11.224606043Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-25 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: INSERT INTO students ("Name", "Email", "Hashed Password", "Subject Stream") VALUES ('John Doe', 'johndoe@example.com', 'skpioepf234', 'Mathematics') RETURNING students."ID" + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAABsAAUlEAAAAYAEAAQAAABcABP////8AAEQAAAALAAEAAAABMkMAAAAPSU5TRVJUIDAgMQBaAAAABVQ= + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 73 + - 78 + - 83 + - 69 + - 82 + - 84 + - 32 + - 48 + - 32 + - 49 + data_row: [{row_values: ["2"]}, {row_values: ["2"]}, {row_values: ["2"]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.226669655Z + restimestampmock: 2024-02-09T10:21:11.226748861Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-26 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: COMMIT + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 67 + - 79 + - 77 + - 77 + - 73 + - 84 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.232155218Z + restimestampmock: 2024-02-09T10:21:11.232190134Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-27 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.233212565Z + restimestampmock: 2024-02-09T10:21:11.233238147Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-28 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAJtTRUxFQ1Qgc3R1ZGVudHMuIklEIiwgc3R1ZGVudHMuIk5hbWUiLCBzdHVkZW50cy4iRW1haWwiLCBzdHVkZW50cy4iSGFzaGVkIFBhc3N3b3JkIiwgc3R1ZGVudHMuIlN1YmplY3QgU3RyZWFtIiAKRlJPTSBzdHVkZW50cyAKV0hFUkUgc3R1ZGVudHMuIklEIiA9IDIA + query: + string: SELECT students."ID", students."Name", students."Email", students."Hashed Password", students."Subject Stream" FROM students WHERE students."ID" = 2 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + payload: VAAAAI0ABUlEAAAAYAEAAQAAABcABP////8AAE5hbWUAAABgAQACAAAEE////////wAARW1haWwAAABgAQADAAAEE////////wAASGFzaGVkIFBhc3N3b3JkAAAAYAEABAAABBP///////8AAFN1YmplY3QgU3RyZWFtAAAAYAEABQAABBP///////8AAEQAAABMAAUAAAABMgAAAAhKb2huIERvZQAAABNqb2huZG9lQGV4YW1wbGUuY29tAAAAC3NrcGlvZXBmMjM0AAAAC01hdGhlbWF0aWNzQwAAAA1TRUxFQ1QgMQBaAAAABVQ= + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{row_values: ["2", John Doe, johndoe@example.com, skpioepf234, Mathematics]}, {row_values: ["2", John Doe, johndoe@example.com, skpioepf234, Mathematics]}, {row_values: ["2", John Doe, johndoe@example.com, skpioepf234, Mathematics]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.233889547Z + restimestampmock: 2024-02-09T10:21:11.233922754Z +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-29 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-02-09T10:21:11.236845177Z + restimestampmock: 2024-02-09T10:21:11.236868259Z diff --git a/fastapi-postgres/keploy/test-set-1/tests/test-1.yaml b/fastapi-postgres/keploy/test-set-1/tests/test-1.yaml new file mode 100755 index 0000000..e5100d2 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-1/tests/test-1.yaml @@ -0,0 +1,55 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-1 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Content-Length: "105" + Content-Type: application/json + Host: 127.0.0.1:8000 + User-Agent: curl/8.2.1 + body: |- + { + "name": "Eva White", + "email": "evawhite@example.com", + "password": "evawhite111" + } + body_type: "" + timestamp: 2024-02-09T10:21:01.532943145Z + host: "" + resp: + status_code: 200 + header: + Content-Length: "107" + Content-Type: application/json + Date: Fri, 09 Feb 2024 10:21:00 GMT + Server: uvicorn + body: '{"name":"Eva White","email":"evawhite@example.com","password":"sfwbxijuf222","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + timestamp: 2024-02-09T10:21:03.574647019Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1707474063 +curl: |- + curl --request POST \ + --url http://127.0.0.1:8000/students/ \ + --header 'Host: 127.0.0.1:8000' \ + --header 'User-Agent: curl/8.2.1' \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --data '{ + "name": "Eva White", + "email": "evawhite@example.com", + "password": "evawhite111" + }' diff --git a/fastapi-postgres/keploy/test-set-1/tests/test-2.yaml b/fastapi-postgres/keploy/test-set-1/tests/test-2.yaml new file mode 100755 index 0000000..ecddaf6 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-1/tests/test-2.yaml @@ -0,0 +1,55 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-2 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Content-Length: "106" + Content-Type: application/json + Host: 127.0.0.1:8000 + User-Agent: curl/8.2.1 + body: |4- + { + "name": "John Doe", + "email": "johndoe@example.com", + "password": "johndoe123" + } + body_type: "" + timestamp: 2024-02-09T10:21:11.21894436Z + host: "" + resp: + status_code: 200 + header: + Content-Length: "104" + Content-Type: application/json + Date: Fri, 09 Feb 2024 10:21:10 GMT + Server: uvicorn + body: '{"name":"John Doe","email":"johndoe@example.com","password":"skpioepf234","stream":"Mathematics","id":2}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + timestamp: 2024-02-09T10:21:13.238027535Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1707474073 +curl: |- + curl --request POST \ + --url http://127.0.0.1:8000/students/ \ + --header 'User-Agent: curl/8.2.1' \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --header 'Host: 127.0.0.1:8000' \ + --data ' { + "name": "John Doe", + "email": "johndoe@example.com", + "password": "johndoe123" + }' diff --git a/fastapi-postgres/requirements.txt b/fastapi-postgres/requirements.txt index 946ca50..5201c90 100644 --- a/fastapi-postgres/requirements.txt +++ b/fastapi-postgres/requirements.txt @@ -22,7 +22,6 @@ pydantic==2.4.2 pydantic-extra-types==2.1.0 pydantic-settings==2.0.3 pydantic_core==2.10.1 -pyscopg2==66.0.2 python-dotenv==1.0.0 python-multipart==0.0.6 PyYAML==6.0.1 @@ -34,4 +33,4 @@ ujson==5.8.0 uvicorn==0.23.2 uvloop==0.17.0 watchfiles==0.20.0 -websockets==11.0.3 \ No newline at end of file +websockets==11.0.3