diff --git a/sanic-postgres/.env b/sanic-postgres/.env new file mode 100644 index 0000000..151c5cd --- /dev/null +++ b/sanic-postgres/.env @@ -0,0 +1,2 @@ +FLASK_ENV=development +DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/mydatabase diff --git a/sanic-postgres/.gitignore b/sanic-postgres/.gitignore new file mode 100644 index 0000000..43513b1 --- /dev/null +++ b/sanic-postgres/.gitignore @@ -0,0 +1 @@ +myenv/ \ No newline at end of file diff --git a/sanic-postgres/README.md b/sanic-postgres/README.md new file mode 100644 index 0000000..391b4c4 --- /dev/null +++ b/sanic-postgres/README.md @@ -0,0 +1,127 @@ +# Employee Management API + +This application is a simple employee management API built using Python's Sanic framework and PostgreSQL for data storage. It allows you to perform basic CRUD (Create, Read, Update, Delete) operations on employee records. + +## Table of Contents + +- [Introduction](#introduction) +- [Pre-Requisites](#pre-requisites) +- [Installation](#installation) +- [API Endpoints](#api-endpoints) + - [Create Employee](#create-employee) + - [Get All Employees](#get-all-employees) + - [Get Employee by ID](#get-employee-by-id) + - [Update Employee](#update-employee) + - [Delete Employee](#delete-employee) +- [Testing](#testing) +- [Wrapping it up](#wrapping-it-up) + +## Introduction + +🪄 Dive into the world of Employee Management and see how seamlessly Keploy integrated with Sanic and PostgreSQL. Buckle up, it's gonna be a fun ride! 🎢 + +## Pre-Requisites 🛠️ + +Before you begin, ensure you have the following installed: + +- **Python 3.x**: The programming language used for this application. You can download it from [python.org](https://www.python.org/downloads/). +- **PostgreSQL**: The database system used for storing employee data. You can download it from [postgresql.org](https://www.postgresql.org/download/). + +## Installation 📥 + +Once you have the prerequisites set up, follow these steps: + +1. Clone the repository: + + ```bash + git clone https://github.com/keploy/sample-python.git + cd sample-python +Install the required Python packages: + +```bash +pip install -r requirements.txt +``` + +Set up your PostgreSQL database and update the connection settings in your application as needed. + +Install the latest Keploy binary: + +```bash +curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_amd64.tar.gz" | tar xz -C /tmp +sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy +``` +Add alias for Keploy: + +```bash +alias keploy='sudo docker run --pull always --name keploy-v2 -p 16789:16789 --privileged --pid=host -it -v "$(pwd)":/files -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock -v '"$HOME"'/.keploy-config:/root/.keploy-config -v '"$HOME"'/.keploy:/root/.keploy --rm ghcr.io/keploy/keploy' +``` +Install the dependencies: + +```bash +pip3 install -r requirements.txt +``` +API Endpoints +Create Employee +To add a new employee: + +```bash +curl -X POST http://localhost:8000/employees \ +-H "Content-Type: application/json" \ +-d '{ + "first_name": "John", + "last_name": "Doe", + "email": "john.doe@example.com", + "position": "Developer", + "salary": 60000 +}' +``` +Get All Employees +To retrieve all employees: + +```bash +curl -X GET http://localhost:8000/employees +``` + +Get Employee by ID +To retrieve a specific employee by ID: + +```bash +curl -X GET http://localhost:8000/employees/1 +``` +Update Employee +To update an existing employee's details: + +```bash +curl -X PUT http://localhost:8000/employees/1 \ +-H "Content-Type: application/json" \ +-d '{ + "first_name": "Jane", + "last_name": "Doe", + "email": "jane.doe@example.com", + "position": "Senior Developer", + "salary": 80000 +}' +``` +Delete Employee +To delete an employee: + +```bash +curl -X DELETE http://localhost:8000/employees/1 +``` +Testing +Capture Test Cases +Capture the test cases using Keploy: + +```bash +keploy record -c "python3 server.py" +``` +Run Tests +Run the tests: + +```bash +keploy test -c "python3 server.py" +``` +Wrapping it up 🎉 +Congrats on the journey so far! You've seen how to manage employees seamlessly with Keploy, Sanic, and PostgreSQL. Keep exploring, innovating, and creating! With the right tools, anything's possible. 😊🚀 + +Happy coding! ✨👩‍💻👨‍💻✨ \ No newline at end of file diff --git a/sanic-postgres/keploy.yml b/sanic-postgres/keploy.yml new file mode 100755 index 0000000..2e0604c --- /dev/null +++ b/sanic-postgres/keploy.yml @@ -0,0 +1,61 @@ +path: "" +appId: 0 +appName: sanic-postgres +command: python3 server.py +templatize: + testSets: [] +port: 0 +dnsPort: 26789 +proxyPort: 16789 +debug: false +disableTele: false +disableANSI: false +containerName: "" +networkName: "" +buildDelay: 30 +test: + selectedTests: {} + globalNoise: + global: {} + test-sets: {} + delay: 5 + host: "" + port: 0 + apiTimeout: 5 + skipCoverage: false + coverageReportPath: "" + ignoreOrdering: true + mongoPassword: default@123 + language: "" + removeUnusedMocks: false + fallBackOnMiss: false + jacocoAgentPath: "" + basePath: "" + mocking: true + ignoredTests: {} + disableLineCoverage: false + disableMockUpload: true + useLocalMock: false + updateTemplate: false +record: + filters: [] + recordTimer: 0s +configPath: "" +bypassRules: [] +generateGithubActions: false +keployContainer: keploy-v2 +keployNetwork: keploy-network +cmdType: native +contract: + services: [] + tests: [] + path: "" + download: false + generate: false + driven: consumer + mappings: + servicesMapping: {} + self: "" +inCi: false + +# Visit [https://keploy.io/docs/running-keploy/configuration-file/] to learn about using keploy through configration file. diff --git a/sanic-postgres/keploy/.gitignore b/sanic-postgres/keploy/.gitignore new file mode 100644 index 0000000..5137843 --- /dev/null +++ b/sanic-postgres/keploy/.gitignore @@ -0,0 +1,2 @@ + +/reports/ diff --git a/sanic-postgres/keploy/test-set-0/mocks.yaml b/sanic-postgres/keploy/test-set-0/mocks.yaml new file mode 100755 index 0000000..f6b10d5 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/mocks.yaml @@ -0,0 +1,1752 @@ +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-11-02T00:24:00.083972836+05:30 + restimestampmock: 2024-11-02T00:24:00.084164389+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-1 +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-11-02T00:24:00.167614021+05:30 + restimestampmock: 2024-11-02T00:24:00.17718867+05:30 +connectionId: "2" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-2 +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-11-02T00:24:00.165411429+05:30 + restimestampmock: 2024-11-02T00:24:00.17710596+05:30 +connectionId: "4" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-3 +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-11-02T00:24:00.177715308+05:30 + restimestampmock: 2024-11-02T00:24:00.18145664+05:30 +connectionId: "8" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-4 +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-11-02T00:24:00.168265524+05:30 + restimestampmock: 2024-11-02T00:24:00.177743076+05:30 +connectionId: "6" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-5 +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-11-02T00:24:00.177654462+05:30 + restimestampmock: 2024-11-02T00:24:00.199354838+05:30 +connectionId: "10" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-6 +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-11-02T00:24:00.177594935+05:30 + restimestampmock: 2024-11-02T00:24:00.199162814+05:30 +connectionId: "12" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-7 +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-11-02T00:24:00.198469406+05:30 + restimestampmock: 2024-11-02T00:24:00.234040088+05:30 +connectionId: "16" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-8 +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-11-02T00:24:00.177518008+05:30 + restimestampmock: 2024-11-02T00:24:00.208708798+05:30 +connectionId: "14" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-9 +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-11-02T00:24:00.19854718+05:30 + restimestampmock: 2024-11-02T00:24:00.223360105+05:30 +connectionId: "18" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-10 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56033 + secret_key: 3037226085 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.103776338+05:30 + restimestampmock: 2024-11-02T00:24:00.103914002+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-11 +spec: + metadata: + type: config + postgresrequests: + - header: [P, D] + identifier: ClientRequest + length: 8 + payload: UAAAAHxfX2FzeW5jcGdfc3RtdF8xX18ASU5TRVJUIElOVE8gZW1wbG95ZWVzIChmaXJzdF9uYW1lLCBsYXN0X25hbWUsIGVtYWlsLCBwb3NpdGlvbiwgc2FsYXJ5KSBWQUxVRVMgKCQxLCAkMiwgJDMsICQ0LCAkNSkAAABEAAAAGFNfX2FzeW5jcGdfc3RtdF8xX18ASAAAAAQ= + describe: + object_type: 83 + name: __asyncpg_stmt_1__ + parse: + - name: __asyncpg_stmt_1__ + query: INSERT INTO employees (first_name, last_name, email, position, salary) VALUES ($1, $2, $3, $4, $5) + parameter_oids: [] + msg_type: 68 + auth_type: 0 + postgresresponses: + - header: ["1", t] + identifier: ServerResponse + length: 8 + payload: MQAAAAR0AAAAGgAFAAAEEwAABBMAAAQTAAAEEwAABqRuAAAABA== + authentication_md5_password: + salt: [0, 0, 0, 0] + parameter_description: + parameteroids: + - 1043 + - 1043 + - 1043 + - 1043 + - 1700 + msg_type: 116 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:11.553896163+05:30 + restimestampmock: 2024-11-02T00:24:11.554038629+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-12 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAAHoAX19hc3luY3BnX3N0bXRfMV9fAAAFAAEAAQABAAEAAQAFAAAAA0JvYgAAAAdKb2huc29uAAAAF2JvYi5qb2huc29uQGV4YW1wbGUuY29tAAAAD1Byb2plY3QgTWFuYWdlcgAAAAwAAgABAAAAAAAHE4gAAQABRQAAAAkAAAAAAFMAAAAE + bind: + - prepared_statement: __asyncpg_stmt_1__ + parameter_format_codes: [1, 1, 1, 1, 1] + parameters: [[66, 111, 98], [74, 111, 104, 110, 115, 111, 110], [98, 111, 98, 46, 106, 111, 104, 110, 115, 111, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [80, 114, 111, 106, 101, 99, 116, 32, 77, 97, 110, 97, 103, 101, 114], [0, 2, 0, 1, 0, 0, 0, 0, 0, 7, 19, 136]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: INSERT 0 1 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:11.580492915+05:30 + restimestampmock: 2024-11-02T00:24:11.581306226+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-13 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:11.586699965+05:30 + restimestampmock: 2024-11-02T00:24:11.588399417+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-14 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAAHsAX19hc3luY3BnX3N0bXRfMV9fAAAFAAEAAQABAAEAAQAFAAAAB0NoYXJsaWUAAAAFQnJvd24AAAAZY2hhcmxpZS5icm93bkBleGFtcGxlLmNvbQAAAAxEYXRhIEFuYWx5c3QAAAAMAAIAAQAAAAAABROIAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_1__ + parameter_format_codes: [1, 1, 1, 1, 1] + parameters: [[67, 104, 97, 114, 108, 105, 101], [66, 114, 111, 119, 110], [99, 104, 97, 114, 108, 105, 101, 46, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [68, 97, 116, 97, 32, 65, 110, 97, 108, 121, 115, 116], [0, 2, 0, 1, 0, 0, 0, 0, 0, 5, 19, 136]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: INSERT 0 1 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:24.631061378+05:30 + restimestampmock: 2024-11-02T00:24:24.631153695+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-15 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:24.634474685+05:30 + restimestampmock: 2024-11-02T00:24:24.634607459+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-16 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAAHgAX19hc3luY3BnX3N0bXRfMV9fAAAFAAEAAQABAAEAAQAFAAAABURpYW5hAAAABlByaW5jZQAAABhkaWFuYS5wcmluY2VAZXhhbXBsZS5jb20AAAALVVggRGVzaWduZXIAAAAMAAIAAQAAAAAABwAAAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_1__ + parameter_format_codes: [1, 1, 1, 1, 1] + parameters: [[68, 105, 97, 110, 97], [80, 114, 105, 110, 99, 101], [100, 105, 97, 110, 97, 46, 112, 114, 105, 110, 99, 101, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [85, 88, 32, 68, 101, 115, 105, 103, 110, 101, 114], [0, 2, 0, 1, 0, 0, 0, 0, 0, 7, 0, 0]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: INSERT 0 1 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:34.337791555+05:30 + restimestampmock: 2024-11-02T00:24:34.337858813+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-17 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:34.341253861+05:30 + restimestampmock: 2024-11-02T00:24:34.341390263+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-18 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAAH4AX19hc3luY3BnX3N0bXRfMV9fAAAFAAEAAQABAAEAAQAFAAAABUV0aGFuAAAABEh1bnQAAAAWZXRoYW4uaHVudEBleGFtcGxlLmNvbQAAABVOZXR3b3JrIEFkbWluaXN0cmF0b3IAAAAMAAIAAQAAAAAABgAAAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_1__ + parameter_format_codes: [1, 1, 1, 1, 1] + parameters: [[69, 116, 104, 97, 110], [72, 117, 110, 116], [101, 116, 104, 97, 110, 46, 104, 117, 110, 116, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [78, 101, 116, 119, 111, 114, 107, 32, 65, 100, 109, 105, 110, 105, 115, 116, 114, 97, 116, 111, 114], [0, 2, 0, 1, 0, 0, 0, 0, 0, 6, 0, 0]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: INSERT 0 1 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:41.07876865+05:30 + restimestampmock: 2024-11-02T00:24:41.078836668+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-19 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:24:41.08021433+05:30 + restimestampmock: 2024-11-02T00:24:41.08029966+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-20 +spec: + metadata: + type: config + postgresrequests: + - header: [P, D] + identifier: ClientRequest + length: 8 + payload: UAAAAPZfX2FzeW5jcGdfc3RtdF8yX18ACiAgICAgICAgICAgIFVQREFURSBlbXBsb3llZXMKICAgICAgICAgICAgU0VUIGZpcnN0X25hbWUgPSAkMSwKICAgICAgICAgICAgICAgIGxhc3RfbmFtZSA9ICQyLAogICAgICAgICAgICAgICAgZW1haWwgPSAkMywKICAgICAgICAgICAgICAgIHBvc2l0aW9uID0gJDQsCiAgICAgICAgICAgICAgICBzYWxhcnkgPSAkNQogICAgICAgICAgICBXSEVSRSBpZCA9ICQ2CiAgICAgICAgICAgIAAAAEQAAAAYU19fYXN5bmNwZ19zdG10XzJfXwBIAAAABA== + describe: + object_type: 83 + name: __asyncpg_stmt_2__ + parse: + - name: __asyncpg_stmt_2__ + query: ' UPDATE employees SET first_name = $1, last_name = $2, email = $3, position = $4, salary = $5 WHERE id = $6 ' + parameter_oids: [] + msg_type: 68 + auth_type: 0 + postgresresponses: + - header: ["1", t] + identifier: ServerResponse + length: 8 + payload: MQAAAAR0AAAAHgAGAAAEEwAABBMAAAQTAAAEEwAABqQAAAAXbgAAAAQ= + authentication_md5_password: + salt: [0, 0, 0, 0] + parameter_description: + parameteroids: + - 1043 + - 1043 + - 1043 + - 1043 + - 1700 + - 23 + msg_type: 116 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:25:47.4085832+05:30 + restimestampmock: 2024-11-02T00:25:47.415893588+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-21 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAAIoAX19hc3luY3BnX3N0bXRfMl9fAAAGAAEAAQABAAEAAQABAAYAAAAFRnJhbmsAAAAGQ2FzdGxlAAAAGGZyYW5rLmNhc3RsZUBleGFtcGxlLmNvbQAAABNTZWN1cml0eSBTcGVjaWFsaXN0AAAADAACAAEAAAAAAAgAAAAAAAQAAAABAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_2__ + parameter_format_codes: [1, 1, 1, 1, 1, 1] + parameters: [[70, 114, 97, 110, 107], [67, 97, 115, 116, 108, 101], [102, 114, 97, 110, 107, 46, 99, 97, 115, 116, 108, 101, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [83, 101, 99, 117, 114, 105, 116, 121, 32, 83, 112, 101, 99, 105, 97, 108, 105, 115, 116], [0, 2, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0], [0, 0, 0, 1]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: UPDATE 0 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:25:47.460065945+05:30 + restimestampmock: 2024-11-02T00:25:47.460193217+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-22 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:25:47.463869372+05:30 + restimestampmock: 2024-11-02T00:25:47.463997714+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-23 +spec: + metadata: + type: config + postgresrequests: + - header: [P, D] + identifier: ClientRequest + length: 8 + payload: UAAAAD9fX2FzeW5jcGdfc3RtdF8zX18AU0VMRUNUICogRlJPTSBlbXBsb3llZXMgV0hFUkUgaWQgPSAkMQAAAEQAAAAYU19fYXN5bmNwZ19zdG10XzNfXwBIAAAABA== + describe: + object_type: 83 + name: __asyncpg_stmt_3__ + parse: + - name: __asyncpg_stmt_3__ + query: SELECT * FROM employees WHERE id = $1 + parameter_oids: [] + msg_type: 68 + auth_type: 0 + postgresresponses: + - header: ["1", t, T] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + parameter_description: + parameteroids: + - 23 + row_description: {fields: [{field_name: id, table_oid: 16386, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: first_name, table_oid: 16386, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 54, format: 0}, {field_name: last_name, table_oid: 16386, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: 54, format: 0}, {field_name: email, table_oid: 16386, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: 104, format: 0}, {field_name: position, table_oid: 16386, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: 54, format: 0}, {field_name: salary, table_oid: 16386, table_attribute_number: 6, data_type_oid: 1700, data_type_size: -1, type_modifier: 655366, format: 0}, {field_name: date_hired, table_oid: 16386, table_attribute_number: 7, data_type_oid: 1082, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 84 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:25:57.958411237+05:30 + restimestampmock: 2024-11-02T00:25:57.958479842+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-24 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAACoAX19hc3luY3BnX3N0bXRfM19fAAABAAEAAQAAAAQAAAABAAEAAUUAAAAJAAAAAAFTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_3__ + parameter_format_codes: [1] + parameters: [[0, 0, 0, 1]] + result_format_codes: [1] + execute: + - max_rows: 1 + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 0 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:25:57.964307531+05:30 + restimestampmock: 2024-11-02T00:25:57.964414402+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-25 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:25:57.967177613+05:30 + restimestampmock: 2024-11-02T00:25:57.967355116+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-26 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAACoAX19hc3luY3BnX3N0bXRfM19fAAABAAEAAQAAAAQAAAADAAEAAUUAAAAJAAAAAAFTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_3__ + parameter_format_codes: [1] + parameters: [[0, 0, 0, 3]] + result_format_codes: [1] + execute: + - max_rows: 1 + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 0 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:02.277859505+05:30 + restimestampmock: 2024-11-02T00:26:02.278156136+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-27 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:02.281179011+05:30 + restimestampmock: 2024-11-02T00:26:02.281388742+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-28 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAACoAX19hc3luY3BnX3N0bXRfM19fAAABAAEAAQAAAAQAAAACAAEAAUUAAAAJAAAAAAFTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_3__ + parameter_format_codes: [1] + parameters: [[0, 0, 0, 2]] + result_format_codes: [1] + execute: + - max_rows: 1 + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", D, s, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + data_row: [{row_values: ['b64:AAAAAg==', Dhruv, slashexx, slashexx@example.com, Developer, 'b64:AAEAAQAAAAIABg==', 'b64:AAAjbw==']}] + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:04.963927809+05:30 + restimestampmock: 2024-11-02T00:26:04.965198376+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-29 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:04.970818229+05:30 + restimestampmock: 2024-11-02T00:26:04.971874274+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-30 +spec: + metadata: + type: config + postgresrequests: + - header: [P, D] + identifier: ClientRequest + length: 8 + payload: UAAAADtfX2FzeW5jcGdfc3RtdF80X18AREVMRVRFIEZST00gZW1wbG95ZWVzIFdIRVJFIGlkPSQxAAAARAAAABhTX19hc3luY3BnX3N0bXRfNF9fAEgAAAAE + describe: + object_type: 83 + name: __asyncpg_stmt_4__ + parse: + - name: __asyncpg_stmt_4__ + query: DELETE FROM employees WHERE id=$1 + parameter_oids: [] + msg_type: 68 + auth_type: 0 + postgresresponses: + - header: ["1", t] + identifier: ServerResponse + length: 8 + payload: MQAAAAR0AAAACgABAAAAF24AAAAE + authentication_md5_password: + salt: [0, 0, 0, 0] + parameter_description: + parameteroids: + - 23 + msg_type: 116 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:18.473156914+05:30 + restimestampmock: 2024-11-02T00:26:18.47327845+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-31 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAACoAX19hc3luY3BnX3N0bXRfNF9fAAABAAEAAQAAAAQAAAAFAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_4__ + parameter_format_codes: [1] + parameters: [[0, 0, 0, 5]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: DELETE 0 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:18.479261843+05:30 + restimestampmock: 2024-11-02T00:26:18.479381902+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-32 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:18.48461228+05:30 + restimestampmock: 2024-11-02T00:26:18.484716818+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-33 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAACoAX19hc3luY3BnX3N0bXRfNF9fAAABAAEAAQAAAAQAAAAIAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_4__ + parameter_format_codes: [1] + parameters: [[0, 0, 0, 8]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: DELETE 0 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:42.826314398+05:30 + restimestampmock: 2024-11-02T00:26:42.826364365+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-34 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:42.829870394+05:30 + restimestampmock: 2024-11-02T00:26:42.829976758+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-35 +spec: + metadata: + type: config + postgresrequests: + - header: [B, E] + identifier: ClientRequest + length: 8 + payload: QgAAACoAX19hc3luY3BnX3N0bXRfNF9fAAABAAEAAQAAAAQAAAACAAEAAUUAAAAJAAAAAABTAAAABA== + bind: + - prepared_statement: __asyncpg_stmt_4__ + parameter_format_codes: [1] + parameters: [[0, 0, 0, 2]] + result_format_codes: [1] + execute: + - {} + msg_type: 69 + auth_type: 0 + postgresresponses: + - header: ["2", C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: DELETE 1 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:45.439361257+05:30 + restimestampmock: 2024-11-02T00:26:45.439457915+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-36 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56036 + secret_key: 2072059547 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.198788779+05:30 + restimestampmock: 2024-11-02T00:24:00.206849467+05:30 +connectionId: "4" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-37 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56042 + secret_key: 1801189782 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.234047956+05:30 + restimestampmock: 2024-11-02T00:24:00.234128761+05:30 +connectionId: "10" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-38 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56043 + secret_key: 620349829 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.223511405+05:30 + restimestampmock: 2024-11-02T00:24:00.223563224+05:30 +connectionId: "12" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-39 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56044 + secret_key: 3570427540 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.246393386+05:30 + restimestampmock: 2024-11-02T00:24:00.246505351+05:30 +connectionId: "14" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-40 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT pg_advisory_unlock_all(); CLOSE ALL; UNLISTEN *; RESET ALL; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, C, C, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + - command_tag_type: CLOSE CURSOR ALL + - command_tag_type: UNLISTEN + - command_tag_type: RESET + data_row: [{row_values: [""]}] + ready_for_query: + txstatus: 73 + row_description: {fields: [{field_name: pg_advisory_unlock_all, table_oid: 0, table_attribute_number: 0, data_type_oid: 2278, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-11-02T00:26:45.440448264+05:30 + restimestampmock: 2024-11-02T00:26:45.440621975+05:30 +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-41 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56046 + secret_key: 3378630764 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.254902613+05:30 + restimestampmock: 2024-11-02T00:24:00.255027369+05:30 +connectionId: "16" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-42 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56045 + secret_key: 3087317218 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.251125068+05:30 + restimestampmock: 2024-11-02T00:24:00.25123582+05:30 +connectionId: "18" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-43 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56037 + secret_key: 3109363849 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.22321499+05:30 + restimestampmock: 2024-11-02T00:24:00.223318321+05:30 +connectionId: "6" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-44 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56035 + secret_key: 3366720961 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.199235016+05:30 + restimestampmock: 2024-11-02T00:24:00.199320268+05:30 +connectionId: "2" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-45 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAQQADAABjbGllbnRfZW5jb2RpbmcAJ3V0Zi04JwB1c2VyAG15dXNlcgBkYXRhYmFzZQBteWRhdGFiYXNlAAA= + auth_type: 0 + postgresresponses: + - header: [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] + backend_key_data: + process_id: 56038 + secret_key: 2167216798 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Asia/Kolkata + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "off" + - 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: myuser + - name: client_encoding + value: UTF8 + - name: server_version + value: "16.3" + - 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-11-02T00:24:00.223405003+05:30 + restimestampmock: 2024-11-02T00:24:00.22346753+05:30 +connectionId: "8" diff --git a/sanic-postgres/keploy/test-set-0/tests/test-1.yaml b/sanic-postgres/keploy/test-set-0/tests/test-1.yaml new file mode 100755 index 0000000..cafa157 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-1.yaml @@ -0,0 +1,48 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-1 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees + header: + Accept: '*/*' + Content-Length: "151" + Content-Type: application/json + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: |- + { + "first_name": "Bob", + "last_name": "Johnson", + "email": "bob.johnson@example.com", + "position": "Project Manager", + "salary": 75000 + } + timestamp: 2024-11-02T00:24:11.530933247+05:30 + resp: + status_code: 201 + header: + Connection: keep-alive + Content-Length: "27" + Content-Type: application/json + body: '{"status":"Employee added"}' + status_message: Created + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:24:13.635103945+05:30 + objects: [] + assertions: + noise: {} + created: 1730487253 +curl: |- + curl --request POST \ + --url http://localhost:8000/employees \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --data "{\n \"first_name\": \"Bob\",\n \"last_name\": \"Johnson\",\n \"email\": \"bob.johnson@example.com\",\n \"position\": \"Project Manager\",\n \"salary\": 75000\n}" diff --git a/sanic-postgres/keploy/test-set-0/tests/test-10.yaml b/sanic-postgres/keploy/test-set-0/tests/test-10.yaml new file mode 100755 index 0000000..72fe3cb --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-10.yaml @@ -0,0 +1,37 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-10 +spec: + metadata: {} + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/8 + header: + Accept: '*/*' + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: "" + timestamp: 2024-11-02T00:26:42.824245581+05:30 + resp: + status_code: 404 + header: + Connection: keep-alive + Content-Length: "31" + Content-Type: application/json + body: '{"status":"Employee not found"}' + status_message: Not Found + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:26:44.916426565+05:30 + objects: [] + assertions: + noise: {} + created: 1730487404 +curl: | + curl --request DELETE \ + --url http://localhost:8000/employees/8 \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ diff --git a/sanic-postgres/keploy/test-set-0/tests/test-11.yaml b/sanic-postgres/keploy/test-set-0/tests/test-11.yaml new file mode 100755 index 0000000..c601433 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-11.yaml @@ -0,0 +1,37 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-11 +spec: + metadata: {} + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/2 + header: + Accept: '*/*' + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: "" + timestamp: 2024-11-02T00:26:45.433382637+05:30 + resp: + status_code: 200 + header: + Connection: keep-alive + Content-Length: "29" + Content-Type: application/json + body: '{"status":"Employee deleted"}' + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:26:47.530880511+05:30 + objects: [] + assertions: + noise: {} + created: 1730487407 +curl: | + curl --request DELETE \ + --url http://localhost:8000/employees/2 \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ + --header 'Host: localhost:8000' \ diff --git a/sanic-postgres/keploy/test-set-0/tests/test-2.yaml b/sanic-postgres/keploy/test-set-0/tests/test-2.yaml new file mode 100755 index 0000000..6e02f3d --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-2.yaml @@ -0,0 +1,48 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-2 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees + header: + Accept: '*/*' + Content-Length: "152" + Content-Type: application/json + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: |- + { + "first_name": "Charlie", + "last_name": "Brown", + "email": "charlie.brown@example.com", + "position": "Data Analyst", + "salary": 55000 + } + timestamp: 2024-11-02T00:24:24.621246547+05:30 + resp: + status_code: 201 + header: + Connection: keep-alive + Content-Length: "27" + Content-Type: application/json + body: '{"status":"Employee added"}' + status_message: Created + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:24:26.732572815+05:30 + objects: [] + assertions: + noise: {} + created: 1730487266 +curl: |- + curl --request POST \ + --url http://localhost:8000/employees \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ + --data "{\n \"first_name\": \"Charlie\",\n \"last_name\": \"Brown\",\n \"email\": \"charlie.brown@example.com\",\n \"position\": \"Data Analyst\",\n \"salary\": 55000\n}" diff --git a/sanic-postgres/keploy/test-set-0/tests/test-3.yaml b/sanic-postgres/keploy/test-set-0/tests/test-3.yaml new file mode 100755 index 0000000..be9e26f --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-3.yaml @@ -0,0 +1,48 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-3 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees + header: + Accept: '*/*' + Content-Length: "149" + Content-Type: application/json + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: |- + { + "first_name": "Diana", + "last_name": "Prince", + "email": "diana.prince@example.com", + "position": "UX Designer", + "salary": 70000 + } + timestamp: 2024-11-02T00:24:34.32675721+05:30 + resp: + status_code: 201 + header: + Connection: keep-alive + Content-Length: "27" + Content-Type: application/json + body: '{"status":"Employee added"}' + status_message: Created + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:24:36.388946121+05:30 + objects: [] + assertions: + noise: {} + created: 1730487276 +curl: |- + curl --request POST \ + --url http://localhost:8000/employees \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:8000' \ + --data "{\n \"first_name\": \"Diana\",\n \"last_name\": \"Prince\",\n \"email\": \"diana.prince@example.com\",\n \"position\": \"UX Designer\",\n \"salary\": 70000\n}" diff --git a/sanic-postgres/keploy/test-set-0/tests/test-4.yaml b/sanic-postgres/keploy/test-set-0/tests/test-4.yaml new file mode 100755 index 0000000..90d4570 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-4.yaml @@ -0,0 +1,48 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-4 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees + header: + Accept: '*/*' + Content-Length: "155" + Content-Type: application/json + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: |- + { + "first_name": "Ethan", + "last_name": "Hunt", + "email": "ethan.hunt@example.com", + "position": "Network Administrator", + "salary": 60000 + } + timestamp: 2024-11-02T00:24:41.068808434+05:30 + resp: + status_code: 201 + header: + Connection: keep-alive + Content-Length: "27" + Content-Type: application/json + body: '{"status":"Employee added"}' + status_message: Created + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:24:43.124788378+05:30 + objects: [] + assertions: + noise: {} + created: 1730487283 +curl: |- + curl --request POST \ + --url http://localhost:8000/employees \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --data "{\n \"first_name\": \"Ethan\",\n \"last_name\": \"Hunt\",\n \"email\": \"ethan.hunt@example.com\",\n \"position\": \"Network Administrator\",\n \"salary\": 60000\n}" diff --git a/sanic-postgres/keploy/test-set-0/tests/test-5.yaml b/sanic-postgres/keploy/test-set-0/tests/test-5.yaml new file mode 100755 index 0000000..441d38f --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-5.yaml @@ -0,0 +1,48 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-5 +spec: + metadata: {} + req: + method: PUT + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/1 + header: + Accept: '*/*' + Content-Length: "157" + Content-Type: application/json + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: |- + { + "first_name": "Frank", + "last_name": "Castle", + "email": "frank.castle@example.com", + "position": "Security Specialist", + "salary": 80000 + } + timestamp: 2024-11-02T00:25:47.343116345+05:30 + resp: + status_code: 404 + header: + Connection: keep-alive + Content-Length: "31" + Content-Type: application/json + body: '{"status":"Employee not found"}' + status_message: Not Found + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:25:49.52236244+05:30 + objects: [] + assertions: + noise: {} + created: 1730487349 +curl: |- + curl --request PUT \ + --url http://localhost:8000/employees/1 \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:8000' \ + --data "{\n \"first_name\": \"Frank\",\n \"last_name\": \"Castle\",\n \"email\": \"frank.castle@example.com\",\n \"position\": \"Security Specialist\",\n \"salary\": 80000\n}" diff --git a/sanic-postgres/keploy/test-set-0/tests/test-6.yaml b/sanic-postgres/keploy/test-set-0/tests/test-6.yaml new file mode 100755 index 0000000..acd2791 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-6.yaml @@ -0,0 +1,37 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-6 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/1 + header: + Accept: '*/*' + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: "" + timestamp: 2024-11-02T00:25:57.955879435+05:30 + resp: + status_code: 404 + header: + Connection: keep-alive + Content-Length: "31" + Content-Type: application/json + body: '{"status":"Employee not found"}' + status_message: Not Found + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:25:59.977751505+05:30 + objects: [] + assertions: + noise: {} + created: 1730487359 +curl: | + curl --request GET \ + --url http://localhost:8000/employees/1 \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ diff --git a/sanic-postgres/keploy/test-set-0/tests/test-7.yaml b/sanic-postgres/keploy/test-set-0/tests/test-7.yaml new file mode 100755 index 0000000..3fff7c8 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-7.yaml @@ -0,0 +1,37 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-7 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/3 + header: + Accept: '*/*' + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: "" + timestamp: 2024-11-02T00:26:02.274891841+05:30 + resp: + status_code: 404 + header: + Connection: keep-alive + Content-Length: "31" + Content-Type: application/json + body: '{"status":"Employee not found"}' + status_message: Not Found + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:26:04.302597857+05:30 + objects: [] + assertions: + noise: {} + created: 1730487364 +curl: | + curl --request GET \ + --url http://localhost:8000/employees/3 \ + --header 'Accept: */*' \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ diff --git a/sanic-postgres/keploy/test-set-0/tests/test-8.yaml b/sanic-postgres/keploy/test-set-0/tests/test-8.yaml new file mode 100755 index 0000000..7d23d7f --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-8.yaml @@ -0,0 +1,38 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-8 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/2 + header: + Accept: '*/*' + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: "" + timestamp: 2024-11-02T00:26:04.960388094+05:30 + resp: + status_code: 200 + header: + Connection: keep-alive + Content-Length: "162" + Content-Type: application/json + body: '{"employee":{"id":2,"first_name":"Dhruv","last_name":"slashexx","email":"slashexx@example.com","position":"Developer","salary":60000.0,"date_hired":"2024-11-01"}}' + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:26:07.014944126+05:30 + objects: [] + assertions: + noise: + body.employee.date_hired: [] + created: 1730487367 +curl: | + curl --request GET \ + --url http://localhost:8000/employees/2 \ + --header 'Host: localhost:8000' \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ diff --git a/sanic-postgres/keploy/test-set-0/tests/test-9.yaml b/sanic-postgres/keploy/test-set-0/tests/test-9.yaml new file mode 100755 index 0000000..28f8605 --- /dev/null +++ b/sanic-postgres/keploy/test-set-0/tests/test-9.yaml @@ -0,0 +1,37 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-9 +spec: + metadata: {} + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://localhost:8000/employees/5 + header: + Accept: '*/*' + Host: localhost:8000 + User-Agent: curl/8.10.1 + body: "" + timestamp: 2024-11-02T00:26:18.470028007+05:30 + resp: + status_code: 404 + header: + Connection: keep-alive + Content-Length: "31" + Content-Type: application/json + body: '{"status":"Employee not found"}' + status_message: Not Found + proto_major: 0 + proto_minor: 0 + timestamp: 2024-11-02T00:26:20.586858053+05:30 + objects: [] + assertions: + noise: {} + created: 1730487380 +curl: | + curl --request DELETE \ + --url http://localhost:8000/employees/5 \ + --header 'User-Agent: curl/8.10.1' \ + --header 'Accept: */*' \ + --header 'Host: localhost:8000' \ diff --git a/sanic-postgres/requirements.txt b/sanic-postgres/requirements.txt new file mode 100644 index 0000000..7543908 --- /dev/null +++ b/sanic-postgres/requirements.txt @@ -0,0 +1,43 @@ +attrs==23.2.1.dev0 +autocommand==2.2.2 +beautifulsoup4==4.12.3 +cffi==1.16.0 +charset-normalizer==3.3.2 +configobj==5.0.8 +cryptography==42.0.7 +dbus-python==1.3.2 +fastjsonschema==2.20.0 +filelock==3.13.3 +httplib2==0.22.0 +idna==3.8 +jaraco.context==5.3.0 +jaraco.functools==4.0.2 +jaraco.text==4.0.0 +libtorrent==2.0.10 +lxml==5.3.0 +Mako==1.3.5.dev0 +Markdown==3.7 +MarkupSafe==2.1.5 +more-itertools==10.3.0 +ordered-set==4.1.0 +packaging==24.1 +pillow==10.4.0 +platformdirs==4.3.6 +pwquality==1.4.5 +pycairo==1.27.0 +pycparser==2.22 +pycurl==7.45.3 +PyGObject==3.50.0 +pyparsing==3.1.2 +Reflector==2023.6.28.0.36.1 +requests==2.32.3 +setuptools==69.5.1 +six==1.16.0 +soupsieve==2.6 +tomli==2.0.1 +trove-classifiers==2024.10.21.16 +urllib3==1.26.20 +validate==5.0.8 +validate-pyproject==0.21 +variety==0.8.12 +wheel==0.44.0 diff --git a/sanic-postgres/server.py b/sanic-postgres/server.py new file mode 100644 index 0000000..b28eb6f --- /dev/null +++ b/sanic-postgres/server.py @@ -0,0 +1,123 @@ +from sanic import Sanic, response +from asyncpg import create_pool +import os +from dotenv import load_dotenv + +app = Sanic("EmployeeManagementApp") + +load_dotenv() +DB_URL = os.getenv("DATABASE_URL") + +DB_CONFIG = { + "dsn": DB_URL, +} + +@app.listener("before_server_start") +async def setup_db(app, loop): + app.ctx.db_pool = await create_pool(**DB_CONFIG, loop=loop) + +@app.listener("after_server_stop") +async def close_db(app, loop): + await app.ctx.db_pool.close() + +@app.route("/employees", methods=["POST"]) +async def add_employee(request): + data = request.json + async with app.ctx.db_pool.acquire() as connection: + await connection.execute( + "INSERT INTO employees (first_name, last_name, email, position, salary) VALUES ($1, $2, $3, $4, $5)", + data["first_name"], data["last_name"], data["email"], data["position"], data["salary"] + ) + return response.json({"status": "Employee added"}, status=201) + +@app.route("/employees", methods=["GET"]) +async def get_employees(request): + async with app.ctx.db_pool.acquire() as connection: + rows = await connection.fetch("SELECT * FROM employees") + employees = [{"id": row["id"], "first_name": row["first_name"], "last_name": row["last_name"], + "email": row["email"], "position": row["position"], "salary": row["salary"], + "date_hired": row["date_hired"].isoformat()} for row in rows] + return response.json({"employees": employees}) + +@app.route("/employees/", methods=["GET"]) +async def get_employee(request, employee_id): + try: + employee_id = int(employee_id) + except ValueError: + return response.json({"status": "Invalid employee ID"}, status=400) + + async with app.ctx.db_pool.acquire() as connection: + row = await connection.fetchrow("SELECT * FROM employees WHERE id = $1", employee_id) + + if row is None: + return response.json({"status": "Employee not found"}, status=404) + + employee = { + "id": row["id"], + "first_name": row["first_name"], + "last_name": row["last_name"], + "email": row["email"], + "position": row["position"], + "salary": row["salary"], + "date_hired": row["date_hired"].isoformat() if row["date_hired"] else None + } + + return response.json({"employee": employee}) + +@app.route("/employees/", methods=["PUT"]) +async def update_employee(request, employee_id): + try: + employee_id = int(employee_id) + except ValueError: + return response.json({"status": "Invalid employee ID"}, status=400) + + updated_data = request.json + required_fields = ["first_name", "last_name", "email", "position", "salary"] + for field in required_fields: + if field not in updated_data: + return response.json({"status": f"Missing field: {field}"}, status=400) + + async with app.ctx.db_pool.acquire() as connection: + result = await connection.execute( + """ + UPDATE employees + SET first_name = $1, + last_name = $2, + email = $3, + position = $4, + salary = $5 + WHERE id = $6 + """, + updated_data["first_name"], + updated_data["last_name"], + updated_data["email"], + updated_data["position"], + float(updated_data["salary"]), + employee_id + ) + + if result == "UPDATE 0": + return response.json({"status": "Employee not found"}, status=404) + + return response.json({"status": "Employee updated"}) + +# Function to delete an employee +@app.route("/employees/", methods=["DELETE"]) +async def delete_employee(request, employee_id): + try: + employee_id = int(employee_id) + except ValueError: + return response.json({"status": "Invalid employee ID"}, status=400) + + async with app.ctx.db_pool.acquire() as connection: + result = await connection.execute( + "DELETE FROM employees WHERE id=$1", employee_id + ) + + if result == "DELETE 0": + return response.json({"status": "Employee not found"}, status=404) + + return response.json({"status": "Employee deleted"}) + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=8000)