Skip to main content

Librería para procesar y gestionar metadatos de bases de datos

Project description

DeltaSnap

A tool to capture any subset of database records and compare changes between captures. It is mainly used for functional testing and debugging.

Installation

Clone the repository and create a virtual environment:

git clone https://github.com/vmaiasw/DeltaSnap.git
cd deltasnap
python3 -m venv venv
source venv/bin/activate  # For Linux/MacOS
pip install -r requirements.txt

Usage

from src.deltasnap import capture_all_records, compare_capture

def test_start_game(test_session):
    initial_capture = capture_all_records(test_session)

    # Logic to test

    final_capture = capture_all_records(test_session)
    changes, created, deleted = compare_capture(initial_capture, final_capture)

    assert not deleted.data # No records were deleted
    assert created.data == {
            ("cards", 1),
            ("cards", 2),
            ("cards", 3)
        } # 3 records were created in the 'cards' table
    assert changes.data == {
        ('games', 1): {
            'started': (False, True),
            'turn_start': (None, '2021-10-10T10:00:00Z')
            }
        } # There were changes in 2 columns of the record with id 1 from the 'games' table. For example, the 'started' field changed from False to True.

Advantages

  • Full coverage: Automatically validates all changes in the database.
  • Simplification: Reduces the use of fixed asserts that may be missed by the tester.
  • Automatic evolution: Adapts to changes in the database schema.
  • Complete comparisons: Validates both previous and current values.

Requirements

  • Python 3.6 or higher.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deltasnap-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file deltasnap-0.1.0.tar.gz.

File metadata

  • Download URL: deltasnap-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for deltasnap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c9a36dc782bcbac844f83fcab125cad0652bea5f7232a6a76afcd8e0a72007c3
MD5 f2bc61dd550c42fb7fd70488abcfef13
BLAKE2b-256 32b8b164db6b5f1d0c5d972d4a15e6eaba24ff51f6390d18bec007776f91a11d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page