-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up tox, stub tests, and satisfy linters
- Loading branch information
1 parent
64b729f
commit 1fc69b5
Showing
7 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"""Asherah application encryption library""" | ||
|
||
from .asherah import Asherah | ||
from .types import AsherahConfig | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
"""Custom exceptions for Asherah""" | ||
|
||
|
||
class AsherahException(Exception): | ||
"""Base exception class for any problems encountered in Asherah""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,51 @@ | ||
"""Type definitions for the Asherah library""" | ||
# pylint: disable=too-many-instance-attributes,invalid-name | ||
|
||
from dataclasses import dataclass | ||
from datetime import datetime | ||
from typing import ByteString | ||
from typing import ByteString, Optional | ||
|
||
|
||
@dataclass | ||
class AsherahConfig: | ||
"""Configuration options for Asherah setup""" | ||
|
||
kms_type: str | ||
metastore: str | ||
service_name: str | ||
product_id: str | ||
rdbms_connection_string: str = None | ||
dynamo_db_endpoint: str = None | ||
dynamo_db_region: str = None | ||
dynamo_db_table_name: str = None | ||
rdbms_connection_string: Optional[str] = None | ||
dynamo_db_endpoint: Optional[str] = None | ||
dynamo_db_region: Optional[str] = None | ||
dynamo_db_table_name: Optional[str] = None | ||
enable_region_suffix: bool = False | ||
preferred_region: str = None | ||
region_map: str = None | ||
preferred_region: Optional[str] = None | ||
region_map: Optional[str] = None | ||
verbose: bool = False | ||
session_cache: bool = False | ||
debug_output: bool = False | ||
|
||
|
||
@dataclass | ||
class KeyMeta: | ||
"""Metadata about an encryption key""" | ||
|
||
id: str | ||
created: datetime | ||
|
||
|
||
@dataclass | ||
class EnvelopeKeyRecord: | ||
"""Information about an encryption envelope""" | ||
|
||
encrypted_key: ByteString | ||
created: datetime | ||
parent_key_meta: KeyMeta | ||
|
||
|
||
@dataclass | ||
class DataRowRecord: | ||
"""Encrypted data and its related information""" | ||
|
||
data: ByteString | ||
key: EnvelopeKeyRecord |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# pylint: disable=missing-function-docstring,missing-class-docstring,missing-module-docstring | ||
|
||
from unittest import TestCase | ||
|
||
|
||
class AsherahTest(TestCase): | ||
def test_fake(self): | ||
self.assertEqual(True, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[tox] | ||
minversion = 3.7.0 | ||
toxworkdir = {env:TOX_WORK_DIR:.tox} | ||
skip_missing_interpreters = True | ||
envlist = py{37,38,39,310},black,mypy,pylint | ||
parallel_show_output = True | ||
isolated_build = True | ||
|
||
[gh-actions] | ||
python = | ||
3.7: py37 | ||
3.8: py38 | ||
3.9: py39 | ||
3.10: py310 | ||
|
||
[testenv] | ||
whitelist_externals = | ||
poetry | ||
pytest | ||
setenv = | ||
PYTHONDONTWRITEBYTECODE=1 | ||
PYTHONHASHSEED=0 | ||
PYTHONWARNINGS=ignore | ||
commands = | ||
poetry install --no-root -v | ||
poetry run pytest {posargs} | ||
|
||
[testenv:black] | ||
basepython = python3.7 | ||
commands = | ||
poetry install --no-root -v | ||
poetry run black --check . | ||
|
||
[testenv:mypy] | ||
basepython = python3.7 | ||
commands = | ||
poetry install --no-root -v | ||
poetry run mypy . | ||
|
||
[testenv:pylint] | ||
basepython = python3.7 | ||
commands = | ||
poetry install --no-root -v | ||
poetry run pylint asherah/ tests/ |