Metadata-Version: 2.1
Name: verifit
Version: 5.0.2
Summary: Verify It: Small automatic testing helper tools
Author-email: Sorel Mitra <sorelmitra@yahoo.com>
License: MIT License
        
        Copyright (c) 2022 sorelmitra
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/sorelmitra/verifit
Keywords: automatic testing tools,acceptance testing tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyJWT
Requires-Dist: pytest
Provides-Extra: dev


# Authentication Tools Library

This small Python library provides a few tools designed to facilitate the writing of automated tests for any type of application. It encompasses functionalities for login procedures, a caching mechanism for efficient data retrieval, a utility for simulating successful and failed communication results, and a few operations for date and time calculations. The library aims to streamline authentication tasks, improve performance via caching strategies, and assist with testing apps that depend on other services or APIs.


# Project Structure

The project is organized into two main directories, `src` for the source code and `test` for the self-test suite, ensuring the functionality is thoroughly verified.

## Source Code (`src`)

The `src` directory encapsulates the core functionalities divided into several modules:

- **`endpoint_tools.py`**: Manages endpoint results, including checks for success and configuration for sequences of endpoint results. By 'endpoint' we really mean any type of communication from your app to some other service that returns a payload and some status code. So with this library you're not tied to a particular type of service or API.

- **`cache.py`**: Provides caching functionalities to store, retrieve, and manage any type of JSON-serializable data, enhancing performance and data retrieval efficiency.

- **`json_web_token.py`**: Facilitates operations related to JWTs, such as decoding and extracting expiration dates, used in the cache mechanism.

- **`date_tools.py`**: Contains utilities for date and time calculations, supporting operations like token expiration checks.

- **`login.py`**: Handles login operations, leveraging JWT validation and caching for optimized login processes. The module only does the bookkeeping around logging in. The actual log in is done by the user of the library, via a very simple `driver` mechanism - you need to supply a function that takes a username and secret, and returns an access token as a JWT string. So, apart from JTW, this library is not tied to any particular authentication mechanism.

Each module is documented inline, offering insights into their functionalities and usage.

## Tests (`test`)

The `test` directory includes tests for the source code's functionality, structured as follows:

- **`test_login.py`**: Ensures the login process, including token handling and caching, works as expected under various scenarios.

- **`test_endpoint_tools.py`**: Verifies the endpoint results simulation, with both success and failure cases.

Tests are implemented with `pytest`, which is a robust framework for validating each component's correctness and reliability.


# Conclusion

This library went through quite a few iterations.  Its present form reflects my current stance on helper libraries in general: In-house developed libraries should be kept as simple and focused as possible.  Large project templates or frameworks actually make things worse in both the long and short term, because of the time they consume for writing and maintaining them on one side, and on understanding and using them, on the other.
