Skip to main content

Contains reusable logic to check Oomnitza begin criteria for objects

Project description

Package contains reusable logic to check Oomnitza begin criteria for objects.

The check_rules handler used to check that the given document corresponds to the given rules, e.g. matches them.

given_result = check_rules(
    {
        "rules": [],
        "groupOp": "and",
        "groups": [
            {
                "groupOp": "and",
                "rules": [
                    {
                        "op": "cn",
                        "data": "CC1UH",
                        "field": "ASSETS.serial_number",
                    }
                ],
                "groups": [],
            },
        ],
    },
    document={
        "equipment_id": "ad2c2ab54adb481c8436d6238838813a",
        "assigned_to": "2e84e8e99431411a84f2339bd02cacb0",
        "serial_number": "C02CC1UHMD6T1",
        "model": "MacBookPro16,1",
    },
    changed_values=None,
    object_type="dontcare",
)

assert given_result, "serial number matches"

The check_rule_by_op handler used to check that the given values satisfy the specified operator, e.g. equal, begins_with, less_or_equal, etc.

assert check_rule_by_op(Op.LESS_OR_EQUAL, "1", "2")
assert check_rule_by_op(Op.HAS_BEEN_CHANGED, "before", "after")
assert not check_rule_by_op(Op.ENDS_WITH, "aaa", "b")

Development

Install package with or without test dependencies.

pip install oomnitza_rule_checker
pip install -e .[tests]

Feel free to write additional tests to cover the new changes and run test suite.

pytest

Distribution

Build and upload the package to the PyPi repository.

python setup.py sdist register upload

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

oomnitza_rule_checker-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

oomnitza_rule_checker-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file oomnitza_rule_checker-0.1.1.tar.gz.

File metadata

  • Download URL: oomnitza_rule_checker-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.10

File hashes

Hashes for oomnitza_rule_checker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e6859775eb5421b9303e3cdddacaeb7a0fe419cab6059c48fe07f2635c69ef6b
MD5 edf67061f13f04883e6f1a98c53a9e54
BLAKE2b-256 a0be4e674d0b3101f66001646ec911e1aba3d73c8b1f1ce5e8208aa4875d0b9b

See more details on using hashes here.

File details

Details for the file oomnitza_rule_checker-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: oomnitza_rule_checker-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.10

File hashes

Hashes for oomnitza_rule_checker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe3c64d5aa19c69980cb42e95a8a14a89af0fa91636e1e909605ba36287b5709
MD5 59485bbd76f42efd72f9c24272de86e3
BLAKE2b-256 9c835a161202e1e3c6fbc6ffda84ad4c7c643384f5c7e7614b34f3175b222ec2

See more details on using hashes here.

Supported by

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