diff --git a/fastapi-postgres/.gitignore b/fastapi-postgres/.gitignore new file mode 100644 index 0000000..78a1f19 --- /dev/null +++ b/fastapi-postgres/.gitignore @@ -0,0 +1,2 @@ +venv +application/__pycache__ \ No newline at end of file diff --git a/fastapi-postgres/Dockerfile b/fastapi-postgres/Dockerfile new file mode 100644 index 0000000..8dfa645 --- /dev/null +++ b/fastapi-postgres/Dockerfile @@ -0,0 +1,30 @@ +# Use the official Python image as the base image +FROM python:3.11.5-bullseye + +# Set the working directory to /app +WORKDIR /app + +# Copy the requirements file into the container +COPY requirements.txt . + +# Install the dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the rest of the application code into the container +COPY . . + +# Set environment variables for PostgreSQL +ENV POSTGRES_USER=postgres \ + POSTGRES_PASSWORD=postgres \ + POSTGRES_DB=studentdb \ + POSTGRES_HOST=0.0.0.0 \ + POSTGRES_PORT=5432 + +# Install PostgreSQL client +RUN apt-get update && apt-get install -y postgresql-client + +# Expose port 80 for the FastAPI application +EXPOSE 8000 + +# Start the FastAPI application +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/fastapi-postgres/README.md b/fastapi-postgres/README.md new file mode 100644 index 0000000..888804d --- /dev/null +++ b/fastapi-postgres/README.md @@ -0,0 +1,124 @@ +# FastAPI-Postgres CRUD Application + +A sample user data CRUD app to test Keploy integration capabilities using [FastAPI](https://fastapi.tiangolo.com/) and [PostgreSQL](https://www.postgresql.org/).
+Make the following requests to the respective endpoints - + +1. `GET students/` - Get all students. +2. `GET students/{id}` - Get a student by id. +3. `POST students/` - Create a student. +4. `PUT students/{id}` - Update a student by id. +5. `DELETE students/{id}` - Delete a student by id. + +## Installation Setup + +```bash +git clone https://github.com/keploy/samples-python.git && cd samples-python/fastapi-postgres +pip3 install -r requirements.txt +``` + +## Installation Keploy + +Keploy can be installed on Linux directly and on Windows with the help of WSL. Based on your system architecture, install the keploy latest binary release + +**1. AMD Architecture** + +```shell +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 +``` + +
+ 2. ARM Architecture + +```shell +curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz -C /tmp + +sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin && keploy +``` + +
+ +### Starting the PostgreSQL Instance + +```bash +# Start the application +docker-compose up -d +``` + +### Capture the Testcases + +This command will start the recording of API calls using ebpf:- + +```shell +sudo -E keploy record -c "uvicorn application.main:app --reload" +``` + +Make API Calls using Hoppscotch, Postman or cURL command. Keploy with capture those calls to generate the test-suites containing testcases and data mocks. + +### Make a POST request + +```bash +curl --location 'http://127.0.0.1:8000/students/' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "name": "Eva White", + "email": "evawhite@example.com", + "password": "evawhite111" + }' +``` + +```bash +curl --location 'http://127.0.0.1:8000/students/' \ +--header 'Content-Type: application/json' \ +--data-raw ' { + "name": "John Doe", + "email": "johndoe@example.com", + "password": "johndoe123" + }' +``` + +### Make a GET request to get all the data + +```bash +curl --location 'http://127.0.0.1:8000/students/' +``` + +This will return all the data saved in the database. + +### Make a GET request to get a specific data + +```bash +curl --location 'http://127.0.0.1:8000/students/1' +``` + +### Make a PUT request to update a specific data + +```bash +curl --location --request PUT 'http://127.0.0.1:8000/students/2' \ +--header 'Content-Type: application/json' \ +--data-raw ' { + "name": "John Dow", + "email": "doe.john@example.com", + "password": "johndoe123", + "stream": "Arts" + }' +``` + +### Make a DELETE request to delete a specific data + +```bash +curl --location --request DELETE 'http://127.0.0.1:8000/students/1' +``` + +Now all these API calls were captured as **editable** testcases and written to `keploy/tests` folder. The keploy directory would also have `mocks` file that contains all the outputs of postgres operations. + +## Run the Testcases + +Now let's run the application in test mode. + +```shell +sudo -E keploy test -c "uvicorn application.main:app --reload" --delay 10 +``` + +So, no need to setup fake database/apis like Postgres or write mocks for them. Keploy automatically mocks them and, **The application thinks it's talking to Postgres 😄** diff --git a/fastapi-postgres/application/__init__.py b/fastapi-postgres/application/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fastapi-postgres/application/crud.py b/fastapi-postgres/application/crud.py new file mode 100644 index 0000000..ae0411e --- /dev/null +++ b/fastapi-postgres/application/crud.py @@ -0,0 +1,52 @@ +from sqlalchemy.orm import Session +from . import models, schemas + + +def get_student(db: Session, student_id: int): + return db.query(models.Student).filter(models.Student.id == student_id).first() + + +def get_student_byEmail(db: Session, student_email: str): + return db.query(models.Student).filter(models.Student.email == student_email).first() + + +def get_students(db: Session, skip: int = 0, limit: int = 50): + return db.query(models.Student).offset(skip).limit(limit).all() + + +def create_student(db: Session, student: schemas.StudentCreate): + student_hashed_password = password_hasher(student.password) + + db_student = models.Student(name=student.name, email=student.email, password=student_hashed_password) + db.add(db_student) + db.commit() + db.refresh(db_student) + return db_student + + +def update_student(db: Session, student: schemas.StudentUpdate, student_id: int): + student_old = db.query(models.Student).filter(models.Student.id == student_id).first() + if student_old is None: + return None + student_old.name = student_old.name if student.name is None else student.name + student_old.email = student_old.email if student.email is None else student.email + student_old.stream = student_old.stream if student.stream is None else student.stream + student_old.password = password_hasher(student.password) + db.commit() + db.refresh(student_old) + return student_old + + +def delete_student(db: Session, student_id: int): + student = db.query(models.Student).filter(models.Student.id == student_id).first() + if student: + db.delete(student) + db.commit() + return student + + +def password_hasher(password) -> str: + hashed_password = 's' + for i in range(0, len(password)): + hashed_password += chr(ord(password[i]) + 1) + return hashed_password diff --git a/fastapi-postgres/application/database.py b/fastapi-postgres/application/database.py new file mode 100644 index 0000000..044ffb7 --- /dev/null +++ b/fastapi-postgres/application/database.py @@ -0,0 +1,11 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + + +SQLALCHEMY_DATABASE_URL = "postgresql://postgres:postgres@0.0.0.0:5432/studentdb" + +engine = create_engine(SQLALCHEMY_DATABASE_URL) +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) + +Base = declarative_base() \ No newline at end of file diff --git a/fastapi-postgres/application/main.py b/fastapi-postgres/application/main.py new file mode 100644 index 0000000..294ad02 --- /dev/null +++ b/fastapi-postgres/application/main.py @@ -0,0 +1,59 @@ +from fastapi import Depends, FastAPI, HTTPException +from sqlalchemy.orm import Session + +from . import models, crud, schemas +from .database import SessionLocal, engine + +models.Base.metadata.create_all(bind=engine) + +app = FastAPI() + + +# Dependency +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() + + +@app.post('/students/', response_model=schemas.Student) +def create_student(student: schemas.StudentCreate, db: Session = Depends(get_db)): + db_student = crud.get_student_byEmail(db, student_email=student.email) + if db_student: + raise HTTPException(status_code=400, detail="Student already registered!!") + data = crud.create_student(db, student=student) + return data + + +@app.get('/students/', response_model=list[schemas.Student]) +def read_students(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)): + students = crud.get_students(db, skip, limit) + if students == []: + raise HTTPException(404, 'Data not found!!') + return students + + +@app.get('/students/{student_id}', response_model=schemas.Student) +def read_student(student_id: int, db: Session = Depends(get_db)): + student = crud.get_student(db, student_id=student_id) + if student is None: + raise HTTPException(status_code=404, detail=f'Student with ID={student_id} not found!!') + return student + + +@app.put('/students/{student_id}', response_model=schemas.Student) +def update_student(student_id: int, student: schemas.StudentUpdate, db: Session = Depends(get_db)): + student = crud.update_student(db, student=student, student_id=student_id) + if student is None: + raise HTTPException(status_code=404, detail=f'Student with ID={student_id} not found!!') + return student + + +@app.delete('/students/{student_id}', response_model=schemas.Student) +def delete_student(student_id: int, db: Session = Depends(get_db)): + student = crud.delete_student(db, student_id=student_id) + if student is None: + raise HTTPException(status_code=404, detail=f'Student with ID={student_id} not found!!') + return student diff --git a/fastapi-postgres/application/models.py b/fastapi-postgres/application/models.py new file mode 100644 index 0000000..05dd1eb --- /dev/null +++ b/fastapi-postgres/application/models.py @@ -0,0 +1,13 @@ +from sqlalchemy import Integer, String, Column + +from .database import Base + + +class Student(Base): + __tablename__="students" + + id = Column(Integer, name="ID", primary_key=True, index=True, info="Stores the id of a student", autoincrement="auto") + name = Column(String, name="Name") + email = Column(String, name="Email", index=True) + password = Column(String, name="Hashed Password") + stream = Column(String, name="Subject Stream", default="Mathematics") diff --git a/fastapi-postgres/application/schemas.py b/fastapi-postgres/application/schemas.py new file mode 100644 index 0000000..2935dcb --- /dev/null +++ b/fastapi-postgres/application/schemas.py @@ -0,0 +1,24 @@ +from pydantic import BaseModel + + +class StudentBase(BaseModel): + name: str + email: str + + +class StudentCreate(StudentBase): + password: str + + +class StudentUpdate(StudentCreate): + stream: str + + class Config: + from_attributes = True + + +class Student(StudentUpdate): + id: int + + class Config: + from_attributes = True diff --git a/fastapi-postgres/data.json b/fastapi-postgres/data.json new file mode 100644 index 0000000..629467e --- /dev/null +++ b/fastapi-postgres/data.json @@ -0,0 +1,53 @@ +[ + { + "name": "John Doe", + "email": "johndoe@example.com", + "password": "johndoe123" + }, + { + "name": "Alice Smith", + "email": "alicesmith@example.com", + "password": "alicesmith789" + }, + { + "name": "Bob Johnson", + "email": "bobjohnson@example.com", + "password": "bobjohnson456" + }, + { + "name": "Eva White", + "email": "evawhite@example.com", + "password": "evawhite111" + }, + { + "name": "Michael Brown", + "email": "michaelbrown@example.com", + "password": "michaelbrown999" + }, + { + "name": "Sophia Lee", + "email": "sophialee@example.com", + "password": "sophialee777" + }, + { + "name": "David Hall", + "email": "davidhall@example.com", + "password": "davidhall222" + }, + { + "name": "Emma Turner", + "email": "emmaturner@example.com", + "password": "emmaturner654" + }, + { + "name": "Oliver Harris", + "email": "oliverharris@example.com", + "password": "oliverharris333" + }, + { + "name": "Ava Martinez", + "email": "avamartinez@example.com", + "password": "avamartinez888" + } + ] + \ No newline at end of file diff --git a/fastapi-postgres/docker-compose.yml b/fastapi-postgres/docker-compose.yml new file mode 100644 index 0000000..8cffd1a --- /dev/null +++ b/fastapi-postgres/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3' +services: + + postgres: + image: postgres:latest + environment: + POSTGRES_DB: studentdb + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" # Map the PostgreSQL port to the host machine + volumes: + - ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql diff --git a/fastapi-postgres/keploy/test-set-0/mocks.yaml b/fastapi-postgres/keploy/test-set-0/mocks.yaml new file mode 100755 index 0000000..e1a173b --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/mocks.yaml @@ -0,0 +1,1567 @@ +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + 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 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - identifier: StartupRequest + payload: AAAAKgADAAB1c2VyAHBvc3RncmVzAGRhdGFiYXNlAHN0dWRlbnRkYgAA + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl: + auth_mechanisms: + - SCRAM-SHA-256 + msg_type: 82 + auth_type: 10 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + password_message: + password: SCRAM-SHA-256 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl_continue: {data: [114, 61, 52, 74, 86, 106, 122, 74, 112, 52, 47, 119, 114, 53, 76, 107, 84, 51, 47, 80, 100, 82, 122, 65, 109, 99, 112, 117, 117, 82, 118, 49, 67, 99, 87, 86, 114, 102, 122, 72, 79, 51, 51, 82, 105, 77, 105, 105, 52, 98, 44, 115, 61, 66, 89, 47, 121, 78, 51, 75, 102, 49, 117, 90, 109, 90, 69, 100, 85, 72, 111, 68, 105, 117, 81, 61, 61, 44, 105, 61, 52, 48, 57, 54]} + msg_type: 82 + auth_type: 11 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R, R, S, S, S, S, S, S, S, S, S, S, S, S, S, S, K, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl_final: {data: [118, 61, 84, 87, 72, 57, 77, 119, 88, 70, 57, 109, 51, 107, 113, 85, 71, 76, 56, 110, 52, 104, 43, 97, 50, 106, 83, 89, 55, 74, 53, 109, 97, 122, 75, 111, 77, 83, 51, 52, 53, 75, 89, 80, 107, 61]} + backend_key_data: + process_id: 33 + secret_key: 4106888949 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Etc/UTC + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "on" + - name: application_name + value: "" + - name: default_transaction_read_only + value: "off" + - name: scram_iterations + value: "4096" + - name: DateStyle + value: ISO, MDY + - name: standard_conforming_strings + value: "on" + - name: session_authorization + value: postgres + - name: client_encoding + value: UTF8 + - name: server_version + value: 16.0 (Debian 16.0-1.pgdg120+1) + - name: server_encoding + value: UTF8 + - name: server_encoding + value: UTF8 + - name: server_encoding + value: UTF8 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: | + SELECT t.oid, typarray + FROM pg_type t JOIN pg_namespace ns + ON typnamespace = ns.oid + WHERE typname = 'hstore'; + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [111, 105, 100], table_oid: 1247, table_attribute_number: 1, data_type_oid: 26, data_type_size: 4, type_modifier: -1, format: 0}, {name: [116, 121, 112, 97, 114, 114, 97, 121], table_oid: 1247, table_attribute_number: 15, data_type_oid: 26, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: select pg_catalog.version() + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[80, 111, 115, 116, 103, 114, 101, 83, 81, 76, 32, 49, 54, 46, 48, 32, 40, 68, 101, 98, 105, 97, 110, 32, 49, 54, 46, 48, 45, 49, 46, 112, 103, 100, 103, 49, 50, 48, 43, 49, 41, 32, 111, 110, 32, 120, 56, 54, 95, 54, 52, 45, 112, 99, 45, 108, 105, 110, 117, 120, 45, 103, 110, 117, 44, 32, 99, 111, 109, 112, 105, 108, 101, 100, 32, 98, 121, 32, 103, 99, 99, 32, 40, 68, 101, 98, 105, 97, 110, 32, 49, 50, 46, 50, 46, 48, 45, 49, 52, 41, 32, 49, 50, 46, 50, 46, 48, 44, 32, 54, 52, 45, 98, 105, 116]]}, {values: [[80, 111, 115, 116, 103, 114, 101, 83, 81, 76, 32, 49, 54, 46, 48, 32, 40, 68, 101, 98, 105, 97, 110, 32, 49, 54, 46, 48, 45, 49, 46, 112, 103, 100, 103, 49, 50, 48, 43, 49, 41, 32, 111, 110, 32, 120, 56, 54, 95, 54, 52, 45, 112, 99, 45, 108, 105, 110, 117, 120, 45, 103, 110, 117, 44, 32, 99, 111, 109, 112, 105, 108, 101, 100, 32, 98, 121, 32, 103, 99, 99, 32, 40, 68, 101, 98, 105, 97, 110, 32, 49, 50, 46, 50, 46, 48, 45, 49, 52, 41, 32, 49, 50, 46, 50, 46, 48, 44, 32, 54, 52, 45, 98, 105, 116]]}, {values: [[80, 111, 115, 116, 103, 114, 101, 83, 81, 76, 32, 49, 54, 46, 48, 32, 40, 68, 101, 98, 105, 97, 110, 32, 49, 54, 46, 48, 45, 49, 46, 112, 103, 100, 103, 49, 50, 48, 43, 49, 41, 32, 111, 110, 32, 120, 56, 54, 95, 54, 52, 45, 112, 99, 45, 108, 105, 110, 117, 120, 45, 103, 110, 117, 44, 32, 99, 111, 109, 112, 105, 108, 101, 100, 32, 98, 121, 32, 103, 99, 99, 32, 40, 68, 101, 98, 105, 97, 110, 32, 49, 50, 46, 50, 46, 48, 45, 49, 52, 41, 32, 49, 50, 46, 50, 46, 48, 44, 32, 54, 52, 45, 98, 105, 116]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [118, 101, 114, 115, 105, 111, 110], table_oid: 0, table_attribute_number: 0, data_type_oid: 25, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + 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: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[112, 117, 98, 108, 105, 99]]}, {values: [[112, 117, 98, 108, 105, 99]]}, {values: [[112, 117, 98, 108, 105, 99]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [99, 117, 114, 114, 101, 110, 116, 95, 115, 99, 104, 101, 109, 97], table_oid: 0, table_attribute_number: 0, data_type_oid: 19, data_type_size: 64, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + 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: + - 83 + - 72 + - 79 + - 87 + data_row: [{values: [[114, 101, 97, 100, 32, 99, 111, 109, 109, 105, 116, 116, 101, 100]]}, {values: [[114, 101, 97, 100, 32, 99, 111, 109, 109, 105, 116, 116, 101, 100]]}, {values: [[114, 101, 97, 100, 32, 99, 111, 109, 109, 105, 116, 116, 101, 100]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 115, 111, 108, 97, 116, 105, 111, 110], table_oid: 0, table_attribute_number: 0, data_type_oid: 25, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + 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: + - 83 + - 72 + - 79 + - 87 + data_row: [{values: [[111, 110]]}, {values: [[111, 110]]}, {values: [[111, 110]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 97, 110, 100, 97, 114, 100, 95, 99, 111, 110, 102, 111, 114, 109, 105, 110, 103, 95, 115, 116, 114, 105, 110, 103, 115], table_oid: 0, table_attribute_number: 0, data_type_oid: 25, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT pg_catalog.pg_class.relname \nFROM pg_catalog.pg_class JOIN pg_catalog.pg_namespace ON pg_catalog.pg_namespace.oid = pg_catalog.pg_class.relnamespace \nWHERE pg_catalog.pg_class.relname = 'students' AND pg_catalog.pg_class.relkind = ANY (ARRAY['r', 'p', 'f', 'v', 'm']) AND pg_catalog.pg_table_is_visible(pg_catalog.pg_class.oid) AND pg_catalog.pg_namespace.nspname != 'pg_catalog'" + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, D, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[115, 116, 117, 100, 101, 110, 116, 115]]}, {values: [[115, 116, 117, 100, 101, 110, 116, 115]]}, {values: [[115, 116, 117, 100, 101, 110, 116, 115]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [114, 101, 108, 110, 97, 109, 101], table_oid: 1259, table_attribute_number: 2, data_type_oid: 19, data_type_size: 64, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: COMMIT + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 67 + - 79 + - 77 + - 77 + - 73 + - 84 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\" AS \"students_ID\", students.\"Name\" AS \"students_Name\", students.\"Email\" AS \"students_Email\", students.\"Hashed Password\" AS \"students_Hashed Password\", students.\"Subject Stream\" AS \"students_Subject Stream\" \nFROM students \n LIMIT 100 OFFSET 0" + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\" AS \"students_ID\", students.\"Name\" AS \"students_Name\", students.\"Email\" AS \"students_Email\", students.\"Hashed Password\" AS \"students_Hashed Password\", students.\"Subject Stream\" AS \"students_Subject Stream\" \nFROM students \nWHERE students.\"Email\" = 'michaelbrown@example.com' \n LIMIT 1" + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: INSERT INTO students ("Name", "Email", "Hashed Password", "Subject Stream") VALUES ('Michael Brown', 'michaelbrown@example.com', 'snjdibfmcspxo:::', 'Mathematics') RETURNING students."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: + - 73 + - 78 + - 83 + - 69 + - 82 + - 84 + - 32 + - 48 + - 32 + - 49 + data_row: [{values: [[49]]}, {values: [[49]]}, {values: [[49]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: COMMIT + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 67 + - 79 + - 77 + - 77 + - 73 + - 84 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\", students.\"Name\", students.\"Email\", students.\"Hashed Password\", students.\"Subject Stream\" \nFROM students \nWHERE students.\"ID\" = 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: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\" AS \"students_ID\", students.\"Name\" AS \"students_Name\", students.\"Email\" AS \"students_Email\", students.\"Hashed Password\" AS \"students_Hashed Password\", students.\"Subject Stream\" AS \"students_Subject Stream\" \nFROM students \nWHERE students.\"ID\" = 11 \n LIMIT 1" + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [T, C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 48 + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\" AS \"students_ID\", students.\"Name\" AS \"students_Name\", students.\"Email\" AS \"students_Email\", students.\"Hashed Password\" AS \"students_Hashed Password\", students.\"Subject Stream\" AS \"students_Subject Stream\" \nFROM students \nWHERE students.\"ID\" = 1 \n LIMIT 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: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\" AS \"students_ID\", students.\"Name\" AS \"students_Name\", students.\"Email\" AS \"students_Email\", students.\"Hashed Password\" AS \"students_Hashed Password\", students.\"Subject Stream\" AS \"students_Subject Stream\" \nFROM students \n LIMIT 100 OFFSET 0" + 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: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: ROLLBACK + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 82 + - 79 + - 76 + - 76 + - 66 + - 65 + - 67 + - 75 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: BEGIN + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 66 + - 69 + - 71 + - 73 + - 78 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: "SELECT students.\"ID\" AS \"students_ID\", students.\"Name\" AS \"students_Name\", students.\"Email\" AS \"students_Email\", students.\"Hashed Password\" AS \"students_Hashed Password\", students.\"Subject Stream\" AS \"students_Subject Stream\" \nFROM students \nWHERE students.\"ID\" = 1 \n LIMIT 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: + - 83 + - 69 + - 76 + - 69 + - 67 + - 84 + - 32 + - 49 + data_row: [{values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}, {values: [[49], [77, 105, 99, 104, 97, 101, 108, 32, 66, 114, 111, 119, 110], [109, 105, 99, 104, 97, 101, 108, 98, 114, 111, 119, 110, 64, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], [115, 110, 106, 100, 105, 98, 102, 109, 99, 115, 112, 120, 111, 58, 58, 58], [77, 97, 116, 104, 101, 109, 97, 116, 105, 99, 115]]}] + ready_for_query: + txstatus: 84 + row_description: {fields: [{name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 73, 68], table_oid: 24577, table_attribute_number: 1, data_type_oid: 23, data_type_size: 4, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 78, 97, 109, 101], table_oid: 24577, table_attribute_number: 2, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 69, 109, 97, 105, 108], table_oid: 24577, table_attribute_number: 3, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 72, 97, 115, 104, 101, 100, 32, 80, 97, 115, 115, 119, 111, 114, 100], table_oid: 24577, table_attribute_number: 4, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}, {name: [115, 116, 117, 100, 101, 110, 116, 115, 95, 83, 117, 98, 106, 101, 99, 116, 32, 83, 116, 114, 101, 97, 109], table_oid: 24577, table_attribute_number: 5, data_type_oid: 1043, data_type_size: -1, type_modifier: -1, format: 0}]} + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: DELETE FROM students WHERE students."ID" = 1 + 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: + - 68 + - 69 + - 76 + - 69 + - 84 + - 69 + - 32 + - 49 + ready_for_query: + txstatus: 84 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [Q] + identifier: ClientRequest + length: 8 + query: + string: COMMIT + msg_type: 81 + auth_type: 0 + postgresresponses: + - header: [C, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + command_complete: + - command_tag: + - 67 + - 79 + - 77 + - 77 + - 73 + - 84 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - identifier: StartupRequest + payload: AAAAKgADAAB1c2VyAHBvc3RncmVzAGRhdGFiYXNlAHN0dWRlbnRkYgAA + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl: + auth_mechanisms: + - SCRAM-SHA-256 + msg_type: 82 + auth_type: 10 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + password_message: + password: SCRAM-SHA-256 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl_continue: {data: [114, 61, 104, 65, 52, 72, 75, 114, 50, 75, 103, 51, 111, 66, 110, 76, 108, 120, 97, 78, 113, 50, 51, 110, 97, 97, 49, 113, 98, 70, 100, 86, 48, 121, 86, 51, 115, 113, 116, 87, 116, 108, 115, 54, 73, 51, 97, 117, 83, 110, 44, 115, 61, 87, 115, 114, 48, 101, 50, 78, 57, 105, 51, 55, 51, 89, 121, 78, 105, 47, 53, 120, 100, 86, 81, 61, 61, 44, 105, 61, 52, 48, 57, 54]} + msg_type: 82 + auth_type: 11 +--- +version: api.keploy.io/v1beta2 +kind: Postgres +name: mocks +spec: + metadata: {} + postgresrequests: + - header: [p] + identifier: ClientRequest + length: 8 + msg_type: 112 + auth_type: 0 + postgresresponses: + - header: [R, R, S, S, S, S, S, S, S, S, S, S, S, S, S, S, K, Z] + identifier: ServerResponse + length: 8 + authentication_md5_password: + salt: + - 0 + - 0 + - 0 + - 0 + authentication_sasl_final: {data: [118, 61, 48, 107, 114, 111, 101, 115, 78, 107, 115, 108, 107, 101, 51, 100, 75, 77, 79, 85, 109, 100, 78, 57, 88, 71, 103, 78, 87, 47, 89, 118, 114, 122, 105, 80, 85, 67, 43, 71, 114, 65, 53, 47, 56, 61]} + backend_key_data: + process_id: 54 + secret_key: 1374794602 + parameter_status: + - name: in_hot_standby + value: "off" + - name: integer_datetimes + value: "on" + - name: TimeZone + value: Etc/UTC + - name: IntervalStyle + value: postgres + - name: is_superuser + value: "on" + - name: application_name + value: "" + - name: default_transaction_read_only + value: "off" + - name: scram_iterations + value: "4096" + - name: DateStyle + value: ISO, MDY + - name: standard_conforming_strings + value: "on" + - name: session_authorization + value: postgres + - name: client_encoding + value: UTF8 + - name: server_version + value: 16.0 (Debian 16.0-1.pgdg120+1) + - name: server_encoding + value: UTF8 + - name: server_encoding + value: UTF8 + - name: server_encoding + value: UTF8 + ready_for_query: + txstatus: 73 + msg_type: 90 + auth_type: 0 \ No newline at end of file diff --git a/fastapi-postgres/keploy/test-set-0/tests/test-1.yaml b/fastapi-postgres/keploy/test-set-0/tests/test-1.yaml new file mode 100755 index 0000000..df8342b --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/tests/test-1.yaml @@ -0,0 +1,45 @@ +version: api.keploy.io/v1beta2 +kind: Http +name: test-1 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: 1d33acb6-386d-45d1-99db-52329895a032 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 404 + header: + Content-Length: "29" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:02 GMT + Server: uvicorn + body: '{"detail":"Data not found!!"}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1697621766 +curl: | + curl --request GET \ + --url http://127.0.0.1:8000/students/ \ + --header 'Host: 127.0.0.1:8000' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Connection: keep-alive' \ + --header 'User-Agent: PostmanRuntime/7.33.0' \ + --header 'Accept: */*' \ + --header 'Postman-Token: 1d33acb6-386d-45d1-99db-52329895a032' \ diff --git a/fastapi-postgres/keploy/test-set-0/tests/test-2.yaml b/fastapi-postgres/keploy/test-set-0/tests/test-2.yaml new file mode 100755 index 0000000..810598c --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/tests/test-2.yaml @@ -0,0 +1,58 @@ +version: api.keploy.io/v1beta2 +kind: Http +name: test-2 +spec: + metadata: {} + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Content-Length: "121" + Content-Type: application/json + Host: 127.0.0.1:8000 + Postman-Token: aba3841e-82f1-489f-9dda-c1c3e3ef3979 + User-Agent: PostmanRuntime/7.33.0 + body: |4- + { + "name": "Michael Brown", + "email": "michaelbrown@example.com", + "password": "michaelbrown999" + } + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "119" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:07 GMT + Server: uvicorn + body: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1697621770 +curl: |- + curl --request POST \ + --url http://127.0.0.1:8000/students/ \ + --header 'User-Agent: PostmanRuntime/7.33.0' \ + --header 'Accept: */*' \ + --header 'Postman-Token: aba3841e-82f1-489f-9dda-c1c3e3ef3979' \ + --header 'Host: 127.0.0.1:8000' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Connection: keep-alive' \ + --header 'Content-Type: application/json' \ + --data ' { + "name": "Michael Brown", + "email": "michaelbrown@example.com", + "password": "michaelbrown999" + }' diff --git a/fastapi-postgres/keploy/test-set-0/tests/test-3.yaml b/fastapi-postgres/keploy/test-set-0/tests/test-3.yaml new file mode 100755 index 0000000..ac81f63 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/tests/test-3.yaml @@ -0,0 +1,45 @@ +version: api.keploy.io/v1beta2 +kind: Http +name: test-3 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/11 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: 4c94cd86-3b39-4fe6-ba34-df66b82fd932 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 404 + header: + Content-Length: "43" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:21 GMT + Server: uvicorn + body: '{"detail":"Student with ID=11 not found!!"}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1697621784 +curl: | + curl --request GET \ + --url http://127.0.0.1:8000/students/11 \ + --header 'Postman-Token: 4c94cd86-3b39-4fe6-ba34-df66b82fd932' \ + --header 'Host: 127.0.0.1:8000' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Connection: keep-alive' \ + --header 'User-Agent: PostmanRuntime/7.33.0' \ + --header 'Accept: */*' \ diff --git a/fastapi-postgres/keploy/test-set-0/tests/test-4.yaml b/fastapi-postgres/keploy/test-set-0/tests/test-4.yaml new file mode 100755 index 0000000..2abb599 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/tests/test-4.yaml @@ -0,0 +1,45 @@ +version: api.keploy.io/v1beta2 +kind: Http +name: test-4 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/1 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: b46c5b40-375c-4956-bcea-84ef922f77f4 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "119" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:25 GMT + Server: uvicorn + body: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1697621789 +curl: | + curl --request GET \ + --url http://127.0.0.1:8000/students/1 \ + --header 'User-Agent: PostmanRuntime/7.33.0' \ + --header 'Accept: */*' \ + --header 'Postman-Token: b46c5b40-375c-4956-bcea-84ef922f77f4' \ + --header 'Host: 127.0.0.1:8000' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Connection: keep-alive' \ diff --git a/fastapi-postgres/keploy/test-set-0/tests/test-5.yaml b/fastapi-postgres/keploy/test-set-0/tests/test-5.yaml new file mode 100755 index 0000000..dab53d3 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/tests/test-5.yaml @@ -0,0 +1,45 @@ +version: api.keploy.io/v1beta2 +kind: Http +name: test-5 +spec: + metadata: {} + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: cdbe1654-026d-4eaa-a059-1f6374a0c4c7 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "121" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:31 GMT + Server: uvicorn + body: '[{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}]' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1697621794 +curl: | + curl --request GET \ + --url http://127.0.0.1:8000/students/ \ + --header 'User-Agent: PostmanRuntime/7.33.0' \ + --header 'Accept: */*' \ + --header 'Postman-Token: cdbe1654-026d-4eaa-a059-1f6374a0c4c7' \ + --header 'Host: 127.0.0.1:8000' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Connection: keep-alive' \ diff --git a/fastapi-postgres/keploy/test-set-0/tests/test-6.yaml b/fastapi-postgres/keploy/test-set-0/tests/test-6.yaml new file mode 100755 index 0000000..c378e76 --- /dev/null +++ b/fastapi-postgres/keploy/test-set-0/tests/test-6.yaml @@ -0,0 +1,45 @@ +version: api.keploy.io/v1beta2 +kind: Http +name: test-6 +spec: + metadata: {} + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/1 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: 4eb76f24-2797-486e-bfda-188164f4611e + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "119" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:38 GMT + Server: uvicorn + body: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + objects: [] + assertions: + noise: + - header.Date + created: 1697621802 +curl: | + curl --request DELETE \ + --url http://127.0.0.1:8000/students/1 \ + --header 'Postman-Token: 4eb76f24-2797-486e-bfda-188164f4611e' \ + --header 'Host: 127.0.0.1:8000' \ + --header 'Accept-Encoding: gzip, deflate, br' \ + --header 'Connection: keep-alive' \ + --header 'User-Agent: PostmanRuntime/7.33.0' \ + --header 'Accept: */*' \ diff --git a/fastapi-postgres/keploy/testReports/report-1.yaml b/fastapi-postgres/keploy/testReports/report-1.yaml new file mode 100755 index 0000000..6ec8809 --- /dev/null +++ b/fastapi-postgres/keploy/testReports/report-1.yaml @@ -0,0 +1,519 @@ +version: api.keploy.io/v1beta1 +name: report-21 +status: PASSED +success: 6 +failure: 0 +total: 6 +tests: + - kind: Http + name: report-21 + status: PASSED + started: 1697621960 + completed: 1697621960 + test_case_path: /home/shashwat/Projects/fastapi-postgres/keploy/test-set-3 + mock_path: "" + test_case_id: test-1 + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: 1d33acb6-386d-45d1-99db-52329895a032 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 404 + header: + Content-Length: "29" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:02 GMT + Server: uvicorn + body: '{"detail":"Data not found!!"}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + noise: + - header.Date + result: + status_code: + normal: true + expected: 404 + actual: 404 + headers_result: + - normal: true + expected: + key: Content-Length + value: + - "29" + actual: + key: Content-Length + value: + - "29" + - normal: true + expected: + key: Content-Type + value: + - application/json + actual: + key: Content-Type + value: + - application/json + - normal: true + expected: + key: Date + value: + - Wed, 18 Oct 2023 09:36:02 GMT + actual: + key: Date + value: + - Wed, 18 Oct 2023 09:39:19 GMT + - normal: true + expected: + key: Server + value: + - uvicorn + actual: + key: Server + value: + - uvicorn + body_result: + - normal: true + type: JSON + expected: '{"detail":"Data not found!!"}' + actual: '{"detail":"Data not found!!"}' + dep_result: [] + - kind: Http + name: report-21 + status: PASSED + started: 1697621960 + completed: 1697621960 + test_case_path: /home/shashwat/Projects/fastapi-postgres/keploy/test-set-3 + mock_path: "" + test_case_id: test-2 + req: + method: POST + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Content-Length: "121" + Content-Type: application/json + Host: 127.0.0.1:8000 + Postman-Token: aba3841e-82f1-489f-9dda-c1c3e3ef3979 + User-Agent: PostmanRuntime/7.33.0 + body: |4- + { + "name": "Michael Brown", + "email": "michaelbrown@example.com", + "password": "michaelbrown999" + } + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "119" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:07 GMT + Server: uvicorn + body: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + noise: + - header.Date + result: + status_code: + normal: true + expected: 200 + actual: 200 + headers_result: + - normal: true + expected: + key: Content-Length + value: + - "119" + actual: + key: Content-Length + value: + - "119" + - normal: true + expected: + key: Content-Type + value: + - application/json + actual: + key: Content-Type + value: + - application/json + - normal: true + expected: + key: Date + value: + - Wed, 18 Oct 2023 09:36:07 GMT + actual: + key: Date + value: + - Wed, 18 Oct 2023 09:39:19 GMT + - normal: true + expected: + key: Server + value: + - uvicorn + actual: + key: Server + value: + - uvicorn + body_result: + - normal: true + type: JSON + expected: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + actual: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + dep_result: [] + - kind: Http + name: report-21 + status: PASSED + started: 1697621960 + completed: 1697621960 + test_case_path: /home/shashwat/Projects/fastapi-postgres/keploy/test-set-3 + mock_path: "" + test_case_id: test-3 + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/11 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: 4c94cd86-3b39-4fe6-ba34-df66b82fd932 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 404 + header: + Content-Length: "43" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:21 GMT + Server: uvicorn + body: '{"detail":"Student with ID=11 not found!!"}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + noise: + - header.Date + result: + status_code: + normal: true + expected: 404 + actual: 404 + headers_result: + - normal: true + expected: + key: Content-Length + value: + - "43" + actual: + key: Content-Length + value: + - "43" + - normal: true + expected: + key: Content-Type + value: + - application/json + actual: + key: Content-Type + value: + - application/json + - normal: true + expected: + key: Date + value: + - Wed, 18 Oct 2023 09:36:21 GMT + actual: + key: Date + value: + - Wed, 18 Oct 2023 09:39:20 GMT + - normal: true + expected: + key: Server + value: + - uvicorn + actual: + key: Server + value: + - uvicorn + body_result: + - normal: true + type: JSON + expected: '{"detail":"Student with ID=11 not found!!"}' + actual: '{"detail":"Student with ID=11 not found!!"}' + dep_result: [] + - kind: Http + name: report-21 + status: PASSED + started: 1697621960 + completed: 1697621960 + test_case_path: /home/shashwat/Projects/fastapi-postgres/keploy/test-set-3 + mock_path: "" + test_case_id: test-4 + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/1 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: b46c5b40-375c-4956-bcea-84ef922f77f4 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "119" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:25 GMT + Server: uvicorn + body: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + noise: + - header.Date + result: + status_code: + normal: true + expected: 200 + actual: 200 + headers_result: + - normal: true + expected: + key: Content-Length + value: + - "119" + actual: + key: Content-Length + value: + - "119" + - normal: true + expected: + key: Content-Type + value: + - application/json + actual: + key: Content-Type + value: + - application/json + - normal: true + expected: + key: Date + value: + - Wed, 18 Oct 2023 09:36:25 GMT + actual: + key: Date + value: + - Wed, 18 Oct 2023 09:39:20 GMT + - normal: true + expected: + key: Server + value: + - uvicorn + actual: + key: Server + value: + - uvicorn + body_result: + - normal: true + type: JSON + expected: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + actual: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + dep_result: [] + - kind: Http + name: report-21 + status: PASSED + started: 1697621960 + completed: 1697621960 + test_case_path: /home/shashwat/Projects/fastapi-postgres/keploy/test-set-3 + mock_path: "" + test_case_id: test-5 + req: + method: GET + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/ + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: cdbe1654-026d-4eaa-a059-1f6374a0c4c7 + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "121" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:31 GMT + Server: uvicorn + body: '[{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}]' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + noise: + - header.Date + result: + status_code: + normal: true + expected: 200 + actual: 200 + headers_result: + - normal: true + expected: + key: Date + value: + - Wed, 18 Oct 2023 09:36:31 GMT + actual: + key: Date + value: + - Wed, 18 Oct 2023 09:39:20 GMT + - normal: true + expected: + key: Server + value: + - uvicorn + actual: + key: Server + value: + - uvicorn + - normal: true + expected: + key: Content-Length + value: + - "121" + actual: + key: Content-Length + value: + - "121" + - normal: true + expected: + key: Content-Type + value: + - application/json + actual: + key: Content-Type + value: + - application/json + body_result: + - normal: true + type: JSON + expected: '[{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}]' + actual: '[{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}]' + dep_result: [] + - kind: Http + name: report-21 + status: PASSED + started: 1697621960 + completed: 1697621960 + test_case_path: /home/shashwat/Projects/fastapi-postgres/keploy/test-set-3 + mock_path: "" + test_case_id: test-6 + req: + method: DELETE + proto_major: 1 + proto_minor: 1 + url: http://127.0.0.1:8000/students/1 + header: + Accept: '*/*' + Accept-Encoding: gzip, deflate, br + Connection: keep-alive + Host: 127.0.0.1:8000 + Postman-Token: 4eb76f24-2797-486e-bfda-188164f4611e + User-Agent: PostmanRuntime/7.33.0 + body: "" + body_type: "" + resp: + status_code: 200 + header: + Content-Length: "119" + Content-Type: application/json + Date: Wed, 18 Oct 2023 09:36:38 GMT + Server: uvicorn + body: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + body_type: "" + status_message: "" + proto_major: 0 + proto_minor: 0 + noise: + - header.Date + result: + status_code: + normal: true + expected: 200 + actual: 200 + headers_result: + - normal: true + expected: + key: Content-Type + value: + - application/json + actual: + key: Content-Type + value: + - application/json + - normal: true + expected: + key: Date + value: + - Wed, 18 Oct 2023 09:36:38 GMT + actual: + key: Date + value: + - Wed, 18 Oct 2023 09:39:20 GMT + - normal: true + expected: + key: Server + value: + - uvicorn + actual: + key: Server + value: + - uvicorn + - normal: true + expected: + key: Content-Length + value: + - "119" + actual: + key: Content-Length + value: + - "119" + body_result: + - normal: true + type: JSON + expected: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + actual: '{"name":"Michael Brown","email":"michaelbrown@example.com","password":"snjdibfmcspxo:::","stream":"Mathematics","id":1}' + dep_result: [] +test_set: test-set-3 diff --git a/fastapi-postgres/requirements.txt b/fastapi-postgres/requirements.txt new file mode 100644 index 0000000..946ca50 --- /dev/null +++ b/fastapi-postgres/requirements.txt @@ -0,0 +1,37 @@ +annotated-types==0.6.0 +anyio==3.7.1 +certifi==2023.7.22 +click==8.1.7 +dnspython==2.4.2 +email-validator==2.0.0.post2 +exceptiongroup==1.1.3 +fastapi==0.103.2 +greenlet==3.0.0 +h11==0.14.0 +httpcore==0.18.0 +httptools==0.6.0 +httpx==0.25.0 +idna==3.4 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.3 +orjson==3.9.8 +psycopg2==2.9.9 +psycopg2-binary==2.9.9 +pydantic==2.4.2 +pydantic-extra-types==2.1.0 +pydantic-settings==2.0.3 +pydantic_core==2.10.1 +pyscopg2==66.0.2 +python-dotenv==1.0.0 +python-multipart==0.0.6 +PyYAML==6.0.1 +sniffio==1.3.0 +SQLAlchemy==2.0.21 +starlette==0.27.0 +typing_extensions==4.8.0 +ujson==5.8.0 +uvicorn==0.23.2 +uvloop==0.17.0 +watchfiles==0.20.0 +websockets==11.0.3 \ No newline at end of file diff --git a/fastapi-postgres/sql/init.sql b/fastapi-postgres/sql/init.sql new file mode 100644 index 0000000..aaa55f3 --- /dev/null +++ b/fastapi-postgres/sql/init.sql @@ -0,0 +1,2 @@ +DROP DATABASE studentdb IF EXISTS; +CREATE DATABASE studentdb; \ No newline at end of file