diff --git a/flask_postgresql_app/.env b/flask_postgresql_app/.env new file mode 100644 index 0000000..e6f528c --- /dev/null +++ b/flask_postgresql_app/.env @@ -0,0 +1,2 @@ +FLASK_ENV=development +DATABASE_URL=postgresql://flaskuser:password@db:5432/flaskdb diff --git a/flask_postgresql_app/Dockerfile b/flask_postgresql_app/Dockerfile new file mode 100644 index 0000000..9c4f754 --- /dev/null +++ b/flask_postgresql_app/Dockerfile @@ -0,0 +1,18 @@ + +FROM python:3.9-slim + + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the rest of the working directory contents +COPY . . + +EXPOSE 5000 + +# env +ENV FLASK_APP=app.py + +CMD ["flask", "run", "--host=0.0.0.0"] diff --git a/flask_postgresql_app/README.md b/flask_postgresql_app/README.md new file mode 100644 index 0000000..e41dbc3 --- /dev/null +++ b/flask_postgresql_app/README.md @@ -0,0 +1,81 @@ +# User Management API + + +## Overview + +This is a Flask-based web application that uses PostgreSQL as its database. The project is containerized using Docker and Docker Compose for easy deployment and management. +The endpoints available will be: + +1. `GET /` - Home Route +2. `GET /users` - List all users +3. `POST /users` - Create a new user +4. `PUT /users/` - Update a user +5. `DELETE /users//` - Delete a user + + + +## Setup Instructions + +1. Clone the repository and navigate to project directory. + ```bash + git clone https://github.com/keploy/samples-python.git + cd samples-python/flask_postgresql_app + ``` +2. Install Keploy. + ```bash + curl --silent -O -L https://keploy.io/install.sh && source install.sh + ``` +3. Build and run the Docker containers: + ```bash + docker compose up --build + ``` +4. Access the application: + Once the containers are running, the Flask app will be available at: + ```bash + http://localhost:5000 + ``` +5. Capture the testcases. + ```bash + keploy record -c "docker compose up" --container-name "flask_web_app" + ``` +6. Generate testcases by making API calls. + ### Home Route + # GET / + ```bash + curl -X GET http://localhost:5000 + ``` + ```bash + # Retrieves a list of all users. + # GET /users + curl -X GET http://localhost:5000/users \ + ``` + ```bash + # Create a new user by providing a name. + # POST /users + curl -X POST http://localhost:5000/users -H "Content-Type: application/json" -d '{"name": "Harsh"}' + + ``` + ```bash + # Retrieve a user by their ID. + # GET /users/ + curl -X GET http://localhost:8000/users// \ + + ``` + ```bash + # Update the name of a user by their ID. + # PUT /users/ + curl -X PUT http://localhost:5000/users/ -H "Content-Type: application/json" -d '{"name": "Updated Name"}' + ``` + ```bash + # Delete a user by their ID + # DELETE / + curl -X DELETE http://localhost:5000/users/ + ``` + ```bash + Replace `` with the actual ID of the item you want to retrieve, update, or delete. + +## Run the testcases +```bash +keploy test -c "docker compose up" --container-name "flask_web_app" +``` + diff --git a/flask_postgresql_app/app.py b/flask_postgresql_app/app.py new file mode 100644 index 0000000..cce0ca9 --- /dev/null +++ b/flask_postgresql_app/app.py @@ -0,0 +1,77 @@ +from flask import Flask, jsonify, request +from flask_sqlalchemy import SQLAlchemy +from dotenv import load_dotenv +import os + +# Load environment variables from .env file +load_dotenv() + +app = Flask(__name__) +app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL') +app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False + +db = SQLAlchemy(app) + +class User(db.Model): + __tablename__ = 'users' + id = db.Column(db.Integer, primary_key=True) + name = db.Column(db.String(80), nullable=False) + + def __init__(self, name): + self.name = name + +# Create the database tables +@app.before_request +def create_tables(): + db.create_all() + +# Home route +@app.route('/', methods=['GET']) +def home(): + return jsonify({"message": "Welcome to the User Management API!"}), 200 + +# GET all users +@app.route('/users', methods=['GET']) +def get_users(): + users = User.query.all() + return jsonify([{'id': user.id, 'name': user.name} for user in users]) + +# POST a new user +@app.route('/users', methods=['POST']) +def add_user(): + name = request.json.get('name') + if not name: + return jsonify({"error": "Name is required."}), 400 + user = User(name=name) + db.session.add(user) + db.session.commit() + return jsonify({"message": f"User {name} added.", "id": user.id}), 201 + +# PUT to update a user +@app.route('/users/', methods=['PUT']) +def update_user(id): + user = User.query.get(id) + if user is None: + return jsonify({"error": "User not found."}), 404 + + name = request.json.get('name') + if name: + user.name = name + db.session.commit() + return jsonify({"message": f"User {id} updated."}) + + return jsonify({"error": "Name is required."}), 400 + +# DELETE a user +@app.route('/users/', methods=['DELETE']) +def delete_user(id): + user = User.query.get(id) + if user is None: + return jsonify({"error": "User not found."}), 404 + + db.session.delete(user) + db.session.commit() + return jsonify({"message": f"User {id} deleted."}) + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=5000) diff --git a/flask_postgresql_app/docker-compose.yml b/flask_postgresql_app/docker-compose.yml new file mode 100644 index 0000000..f35f9c5 --- /dev/null +++ b/flask_postgresql_app/docker-compose.yml @@ -0,0 +1,23 @@ +services: + web: + build: . + container_name: flask_web_app + ports: + - "5000:5000" + environment: + - DATABASE_URL=postgresql://flaskuser:password@db:5432/flaskdb + - FLASK_APP=app.py # Ensure Flask app is specified + - FLASK_ENV=development + command: flask run --host=0.0.0.0 # Ensure Flask runs with the correct host + depends_on: + - db + + db: + image: postgres:13 + container_name: flask_db + environment: + POSTGRES_DB: flaskdb + POSTGRES_USER: flaskuser + POSTGRES_PASSWORD: password + ports: + - "5432:5432" diff --git a/flask_postgresql_app/keploy.yml b/flask_postgresql_app/keploy.yml new file mode 100755 index 0000000..4a2a998 --- /dev/null +++ b/flask_postgresql_app/keploy.yml @@ -0,0 +1,61 @@ +path: "" +appId: 0 +appName: flask_postgresql_app +command: docker compose up --build +templatize: + testSets: [] +port: 0 +dnsPort: 26789 +proxyPort: 16789 +debug: false +disableTele: false +disableANSI: false +containerName: flask_postgresql_app +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/flask_postgresql_app/keploy/.gitignore b/flask_postgresql_app/keploy/.gitignore new file mode 100644 index 0000000..5137843 --- /dev/null +++ b/flask_postgresql_app/keploy/.gitignore @@ -0,0 +1,2 @@ + +/reports/ diff --git a/flask_postgresql_app/keploy/test-set-0/mocks.yaml b/flask_postgresql_app/keploy/test-set-0/mocks.yaml new file mode 100755 index 0000000..2fb48be --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/mocks.yaml @@ -0,0 +1,1246 @@ +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-10-09T16:52:02.830573028Z + restimestampmock: 2024-10-09T16:52:02.831244867Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-1 +spec: + metadata: + type: config + postgresrequests: + - identifier: StartupRequest + payload: AAAAKQADAAB1c2VyAGZsYXNrdXNlcgBkYXRhYmFzZQBmbGFza2RiAAA= + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [133, 3, 221, 191] + msg_type: 82 + auth_type: 5 + reqtimestampmock: 2024-10-09T16:52:02.831996616Z + restimestampmock: 2024-10-09T16:52:02.832039452Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-2 +spec: + metadata: + type: config + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + password_message: + password: md5e9ccf75670af20adf7c4e48379bb8588 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R, 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: 34 + secret_key: 2476999767 + parameter_status: + - name: application_name + value: "" + - name: client_encoding + value: UTF8 + - name: DateStyle + value: ISO, MDY + - name: integer_datetimes + value: "on" + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "on" + - name: server_encoding + value: UTF8 + - name: server_version + value: 13.16 (Debian 13.16-1.pgdg120+1) + - name: session_authorization + value: flaskuser + - name: standard_conforming_strings + value: "on" + - name: TimeZone + value: Etc/UTC + - name: TimeZone + value: Etc/UTC + - name: TimeZone + value: Etc/UTC + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.835642375Z + restimestampmock: 2024-10-09T16:52:02.835723939Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-3 +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.836164161Z + restimestampmock: 2024-10-09T16:52:02.83619432Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-4 +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_type: SELECT 0 + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: oid, table_oid: 1247, table_attribute_number: 1, data_type_oid: 26, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: typarray, table_oid: 1247, table_attribute_number: 14, data_type_oid: 26, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.837461213Z + restimestampmock: 2024-10-09T16:52:02.837501512Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-5 +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_type: ROLLBACK + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.837848953Z + restimestampmock: 2024-10-09T16:52:02.837885486Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-6 +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.838418843Z + restimestampmock: 2024-10-09T16:52:02.838454616Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-7 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: select version() + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: ['PostgreSQL 13.16 (Debian 13.16-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit']}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: version, 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-10-09T16:52:02.838665794Z + restimestampmock: 2024-10-09T16:52:02.838698521Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-8 +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 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: [public]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: current_schema, 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-10-09T16:52:02.839613853Z + restimestampmock: 2024-10-09T16:52:02.839662169Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-9 +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 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SHOW + data_row: [{row_values: [read committed]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: transaction_isolation, 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-10-09T16:52:02.83998089Z + restimestampmock: 2024-10-09T16:52:02.840014622Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-10 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: [test plain returns]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: anon_1, table_oid: 0, table_attribute_number: 0, data_type_oid: 1043, data_type_size: -1, type_modifier: 64, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.841477739Z + restimestampmock: 2024-10-09T16:52:02.84152715Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-11 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: [test unicode returns]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: anon_1, table_oid: 0, table_attribute_number: 0, data_type_oid: 1043, data_type_size: -1, type_modifier: 64, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.842010391Z + restimestampmock: 2024-10-09T16:52:02.84203208Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-12 +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 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SHOW + data_row: [{row_values: ["on"]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: standard_conforming_strings, 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-10-09T16:52:02.842246434Z + restimestampmock: 2024-10-09T16:52:02.842285151Z +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: 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_type: ROLLBACK + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.842554536Z + restimestampmock: 2024-10-09T16:52:02.842597306Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-14 +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.84341846Z + restimestampmock: 2024-10-09T16:52:02.84347898Z +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 relname from pg_class c join pg_namespace n on n.oid=c.relnamespace where pg_catalog.pg_table_is_visible(c.oid) and relname='users' + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: [users]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: relname, 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-10-09T16:52:02.844216679Z + restimestampmock: 2024-10-09T16:52:02.844269317Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-16 +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_type: ROLLBACK + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:02.844850035Z + restimestampmock: 2024-10-09T16:52:02.844879734Z +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: 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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:15.942120188Z + restimestampmock: 2024-10-09T16:52:15.942255625Z +connectionId: "0" +--- +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 users (name) VALUES ('harshjoshi') RETURNING users.id + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: INSERT 0 1 + data_row: [{row_values: ["5"]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: id, table_oid: 16387, 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-10-09T16:52:15.943656569Z + restimestampmock: 2024-10-09T16:52:15.943699019Z +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: 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_type: COMMIT + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:15.948172194Z + restimestampmock: 2024-10-09T16:52:15.948306699Z +connectionId: "0" +--- +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:15.950999349Z + restimestampmock: 2024-10-09T16:52:15.951212649Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-21 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAFpTRUxFQ1QgdXNlcnMuaWQgQVMgdXNlcnNfaWQsIHVzZXJzLm5hbWUgQVMgdXNlcnNfbmFtZSAKRlJPTSB1c2VycyAKV0hFUkUgdXNlcnMuaWQgPSA1AA== + query: + string: SELECT users.id AS users_id, users.name AS users_name FROM users WHERE users.id = 5 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: ["5", harshjoshi]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: users_id, table_oid: 16387, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: users_name, table_oid: 16387, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 84, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:15.960229809Z + restimestampmock: 2024-10-09T16:52:15.960468611Z +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: 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_type: ROLLBACK + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:15.964142202Z + restimestampmock: 2024-10-09T16:52:15.964294111Z +connectionId: "0" +--- +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:24.27538668Z + restimestampmock: 2024-10-09T16:52:24.275522488Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-24 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAFpTRUxFQ1QgdXNlcnMuaWQgQVMgdXNlcnNfaWQsIHVzZXJzLm5hbWUgQVMgdXNlcnNfbmFtZSAKRlJPTSB1c2VycyAKV0hFUkUgdXNlcnMuaWQgPSA1AA== + query: + string: SELECT users.id AS users_id, users.name AS users_name FROM users WHERE users.id = 5 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: ["5", harshjoshi]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: users_id, table_oid: 16387, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: users_name, table_oid: 16387, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 84, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:24.276356632Z + restimestampmock: 2024-10-09T16:52:24.276478637Z +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: UPDATE users SET name='harshjoshi1' WHERE users.id = 5 + 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_type: UPDATE 1 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:24.278842896Z + restimestampmock: 2024-10-09T16:52:24.278889652Z +connectionId: "0" +--- +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_type: COMMIT + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:24.281524213Z + restimestampmock: 2024-10-09T16:52:24.281569809Z +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: 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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:29.150281172Z + restimestampmock: 2024-10-09T16:52:29.150394831Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-28 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAFpTRUxFQ1QgdXNlcnMuaWQgQVMgdXNlcnNfaWQsIHVzZXJzLm5hbWUgQVMgdXNlcnNfbmFtZSAKRlJPTSB1c2VycyAKV0hFUkUgdXNlcnMuaWQgPSA1AA== + query: + string: SELECT users.id AS users_id, users.name AS users_name FROM users WHERE users.id = 5 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: ["5", harshjoshi1]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: users_id, table_oid: 16387, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: users_name, table_oid: 16387, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 84, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:29.151126001Z + restimestampmock: 2024-10-09T16:52:29.151159414Z +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: DELETE FROM users WHERE users.id = 5 + 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_type: DELETE 1 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:29.152177132Z + restimestampmock: 2024-10-09T16:52:29.1522471Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-30 +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_type: COMMIT + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:29.154192548Z + restimestampmock: 2024-10-09T16:52:29.154266201Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-31 +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:34.320529598Z + restimestampmock: 2024-10-09T16:52:34.320605115Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-32 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAEZTRUxFQ1QgdXNlcnMuaWQgQVMgdXNlcnNfaWQsIHVzZXJzLm5hbWUgQVMgdXNlcnNfbmFtZSAKRlJPTSB1c2VycwA= + query: + string: SELECT users.id AS users_id, users.name AS users_name FROM users + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: ["4", harsh]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: users_id, table_oid: 16387, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: users_name, table_oid: 16387, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 84, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:34.321330701Z + restimestampmock: 2024-10-09T16:52:34.321478797Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-33 +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_type: ROLLBACK + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:34.323701768Z + restimestampmock: 2024-10-09T16:52:34.323826848Z +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: 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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:49.282145701Z + restimestampmock: 2024-10-09T16:52:49.282269829Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-35 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAFpTRUxFQ1QgdXNlcnMuaWQgQVMgdXNlcnNfaWQsIHVzZXJzLm5hbWUgQVMgdXNlcnNfbmFtZSAKRlJPTSB1c2VycyAKV0hFUkUgdXNlcnMuaWQgPSA0AA== + query: + string: SELECT users.id AS users_id, users.name AS users_name FROM users WHERE users.id = 4 + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: [0, 0, 0, 0] + command_complete: + - command_tag_type: SELECT 1 + data_row: [{row_values: ["4", harsh]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: users_id, table_oid: 16387, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: users_name, table_oid: 16387, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 84, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:49.282941176Z + restimestampmock: 2024-10-09T16:52:49.283010044Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-36 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: DELETE FROM users WHERE users.id = 4 + 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_type: DELETE 1 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:49.284580663Z + restimestampmock: 2024-10-09T16:52:49.284602152Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-37 +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_type: COMMIT + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:49.286666457Z + restimestampmock: 2024-10-09T16:52:49.286736895Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-38 +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_type: BEGIN + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:56.967044619Z + restimestampmock: 2024-10-09T16:52:56.967123063Z +connectionId: "0" +--- +version: api.keploy.io/v1beta1 +kind: Postgres +name: mock-39 +spec: + metadata: + type: config + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + payload: UQAAAEZTRUxFQ1QgdXNlcnMuaWQgQVMgdXNlcnNfaWQsIHVzZXJzLm5hbWUgQVMgdXNlcnNfbmFtZSAKRlJPTSB1c2VycwA= + query: + string: SELECT users.id AS users_id, users.name AS users_name FROM users + 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_type: SELECT 0 + ready_for_query: + txstatus: 84 + row_description: {fields: [{field_name: users_id, table_oid: 16387, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {field_name: users_name, table_oid: 16387, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: 84, format: 0}]} + msg_type: 90 + auth_type: 0 + reqtimestampmock: 2024-10-09T16:52:56.96770962Z + restimestampmock: 2024-10-09T16:52:56.967773952Z +connectionId: "0" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-1.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-1.yaml new file mode 100755 index 0000000..6e22f8a --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-1.yaml @@ -0,0 +1,53 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-1 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "25" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi" + } + timestamp: 2024-10-09T16:52:02.809644362Z + resp: + status_code: 200 + header: + Content-Length: "55" + Content-Type: application/json + Date: Wed, 09 Oct 2024 16:52:02 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: | + { + "message": "Welcome to the User Management API!" + } + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:04.856965925Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492724 +curl: |- + curl --request GET \ + --url http://localhost:5000/ \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Accept: */*' \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:5000' \ + --header 'Connection: close' \ + --data "{\n \"name\":\"harshjoshi\"\n}" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-2.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-2.yaml new file mode 100755 index 0000000..ca56fc9 --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-2.yaml @@ -0,0 +1,50 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-2 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/users + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "25" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi" + } + timestamp: 2024-10-09T16:52:15.936436966Z + resp: + status_code: 201 + header: + Content-Length: "54" + Content-Type: application/json + Date: Wed, 09 Oct 2024 16:52:15 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: "{\n \"id\": 5, \n \"message\": \"User harshjoshi added.\"\n}\n" + status_message: Created + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:18.022153619Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492738 +curl: |- + curl --request POST \ + --url http://localhost:5000/users \ + --header 'Accept: */*' \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:5000' \ + --header 'Connection: close' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --data "{\n \"name\":\"harshjoshi\"\n}" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-3.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-3.yaml new file mode 100755 index 0000000..f99ce73 --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-3.yaml @@ -0,0 +1,53 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-3 +spec: + metadata: {} + req: + method: PUT + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/users/5 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "26" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi1" + } + timestamp: 2024-10-09T16:52:24.271748853Z + resp: + status_code: 200 + header: + Content-Length: "35" + Content-Type: application/json + Date: Wed, 09 Oct 2024 16:52:24 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: | + { + "message": "User 5 updated." + } + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:26.3624278Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492746 +curl: |- + curl --request PUT \ + --url http://localhost:5000/users/5 \ + --header 'Connection: close' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Accept: */*' \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:5000' \ + --data "{\n \"name\":\"harshjoshi1\"\n}" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-4.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-4.yaml new file mode 100755 index 0000000..36650b5 --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-4.yaml @@ -0,0 +1,53 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-4 +spec: + metadata: {} + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/users/5 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "26" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi1" + } + timestamp: 2024-10-09T16:52:29.147040179Z + resp: + status_code: 200 + header: + Content-Length: "35" + Content-Type: application/json + Date: Wed, 09 Oct 2024 16:52:29 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: | + { + "message": "User 5 deleted." + } + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:31.185249908Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492751 +curl: |- + curl --request DELETE \ + --url http://localhost:5000/users/5 \ + --header 'Host: localhost:5000' \ + --header 'Connection: close' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Accept: */*' \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --data "{\n \"name\":\"harshjoshi1\"\n}" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-5.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-5.yaml new file mode 100755 index 0000000..97dab2a --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-5.yaml @@ -0,0 +1,50 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-5 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/users + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "26" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi1" + } + timestamp: 2024-10-09T16:52:34.318334127Z + resp: + status_code: 200 + header: + Content-Length: "46" + Content-Type: application/json + Date: Wed, 09 Oct 2024 16:52:34 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: "[\n {\n \"id\": 4, \n \"name\": \"harsh\"\n }\n]\n" + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:36.413011311Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492756 +curl: |- + curl --request GET \ + --url http://localhost:5000/users \ + --header 'Accept: */*' \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:5000' \ + --header 'Connection: close' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --data "{\n \"name\":\"harshjoshi1\"\n}" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-6.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-6.yaml new file mode 100755 index 0000000..649f206 --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-6.yaml @@ -0,0 +1,53 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-6 +spec: + metadata: {} + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/users/4 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "26" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi1" + } + timestamp: 2024-10-09T16:52:49.27966925Z + resp: + status_code: 200 + header: + Content-Length: "35" + Content-Type: application/json + Date: Wed, 09 Oct 2024 16:52:49 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: | + { + "message": "User 4 deleted." + } + status_message: OK + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:51.378732252Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492771 +curl: |- + curl --request DELETE \ + --url http://localhost:5000/users/4 \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --header 'Host: localhost:5000' \ + --header 'Connection: close' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Accept: */*' \ + --data "{\n \"name\":\"harshjoshi1\"\n}" diff --git a/flask_postgresql_app/keploy/test-set-0/tests/test-7.yaml b/flask_postgresql_app/keploy/test-set-0/tests/test-7.yaml new file mode 100755 index 0000000..3aa1e77 --- /dev/null +++ b/flask_postgresql_app/keploy/test-set-0/tests/test-7.yaml @@ -0,0 +1,54 @@ +version: api.keploy.io/v1beta1 +kind: Http +name: test-7 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://localhost:5000/users/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: close + Content-Length: "26" + Content-Type: application/json + Host: localhost:5000 + User-Agent: Thunder Client (https://www.thunderclient.com) + body: |- + { + "name":"harshjoshi1" + } + timestamp: 2024-10-09T16:52:53.793701467Z + resp: + status_code: 404 + header: + Content-Length: "232" + Content-Type: text/html; charset=utf-8 + Date: Wed, 09 Oct 2024 16:52:53 GMT + Server: Werkzeug/2.0.1 Python/3.9.20 + body: | + + 404 Not Found +

Not Found

+

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

+ status_message: Not Found + proto_major: 0 + proto_minor: 0 + timestamp: 2024-10-09T16:52:55.800973357Z + objects: [] + assertions: + noise: + header.Date: [] + created: 1728492775 +curl: |- + curl --request GET \ + --url http://localhost:5000/users/ \ + --header 'Host: localhost:5000' \ + --header 'Connection: close' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Accept: */*' \ + --header 'User-Agent: Thunder Client (https://www.thunderclient.com)' \ + --header 'Content-Type: application/json' \ + --data "{\n \"name\":\"harshjoshi1\"\n}" diff --git a/flask_postgresql_app/requirements.txt b/flask_postgresql_app/requirements.txt new file mode 100644 index 0000000..d6ff7bb --- /dev/null +++ b/flask_postgresql_app/requirements.txt @@ -0,0 +1,6 @@ +Flask==2.3.3 +Flask-SQLAlchemy==3.0.5 +psycopg2-binary==2.9.10 +Werkzeug==3.0.5 +SQLAlchemy==2.0.36 +python-dotenv