Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

46 #79

Merged
merged 4 commits into from
Feb 10, 2022
Merged

46 #79

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 136 additions & 136 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,137 +1,137 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/
dist/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# templates
.github/templates/*

.local
/.idea
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
dist/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# templates
.github/templates/*
.local
/.idea
/.idea
11 changes: 10 additions & 1 deletion g2w/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from .api import LoggableRoute
from .gitlab import Push
from .gitlab import commit_msg_pattern
from .grafana import Alert
from .version import __version__
from .ws import Ws
from .log import Log

__all__ = ["Push", "Ws", "LoggableRoute", "Alert", "Log", __version__]
__all__ = [
"Push",
"Ws",
"LoggableRoute",
"Alert",
"commit_msg_pattern",
"Log",
__version__,
]
6 changes: 1 addition & 5 deletions g2w/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@

log = logging.getLogger(__name__)

# @todo #/DEV Worksection task id in the middle (or end) might be in message
# not only at the begining. It could be in the middle or end. It would be good
# to support such cases as from app perspective we need Worksection task id
# only and doesn't matter where it in message exactly...
commit_msg_pattern = re.compile(r"^#WS-(\d+):.+$")
commit_msg_pattern = re.compile(r"#WS-(\d+)")

"""
Push event details from Gitlab.
Expand Down
6 changes: 4 additions & 2 deletions tests/test_alert.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from g2w import Alert
import unittest


# @todo #/DEV Create fake grafana alert event object based on
# https://grafana.com/docs/grafana/latest/alerting/unified-alerting/contact-points/#webhook # noqa: E501

class SimpleTest(unittest.TestCase):

def test_comment():
assert Alert().desc('{"user":"Tom"}').find("user%22%3A%22Tom") > 0
def test_comment(self):
self.assertGreater(Alert().desc('{"user":"Tom"}').find("user%22%3A%22Tom"), 0)
Loading