mirror of https://github.com/caronc/apprise
Test Coverage and Code Tidy (#1015)
parent
a175f16eb7
commit
cda692594d
|
@ -31,7 +31,7 @@ FROM python:3.10-buster
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends libdbus-1-dev libgirepository1.0-dev build-essential musl-dev bash dbus && \
|
apt-get install -y --no-install-recommends libdbus-1-dev libgirepository1.0-dev build-essential musl-dev bash dbus && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
RUN pip install --no-cache-dir dbus-python PyGObject
|
RUN pip install --no-cache-dir dbus-python "PyGObject==3.44.2"
|
||||||
|
|
||||||
# Apprise Setup
|
# Apprise Setup
|
||||||
VOLUME ["/apprise"]
|
VOLUME ["/apprise"]
|
||||||
|
|
|
@ -31,7 +31,7 @@ FROM python:3.11-buster
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends libdbus-1-dev libgirepository1.0-dev build-essential musl-dev bash dbus && \
|
apt-get install -y --no-install-recommends libdbus-1-dev libgirepository1.0-dev build-essential musl-dev bash dbus && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
RUN pip install --no-cache-dir dbus-python PyGObject
|
RUN pip install --no-cache-dir dbus-python "PyGObject==3.44.2"
|
||||||
|
|
||||||
# Apprise Setup
|
# Apprise Setup
|
||||||
VOLUME ["/apprise"]
|
VOLUME ["/apprise"]
|
||||||
|
|
|
@ -617,7 +617,7 @@ class NotifyAprs(NotifyBase):
|
||||||
# see https://www.aprs.org/doc/APRS101.PDF pg. 71
|
# see https://www.aprs.org/doc/APRS101.PDF pg. 71
|
||||||
payload = re.sub("[{}|~]+", "", payload)
|
payload = re.sub("[{}|~]+", "", payload)
|
||||||
|
|
||||||
payload = (
|
payload = ( # pragma: no branch
|
||||||
APRS_COMPILED_MAP.sub(
|
APRS_COMPILED_MAP.sub(
|
||||||
lambda x: APRS_BAD_CHARMAP[x.group()], payload)
|
lambda x: APRS_BAD_CHARMAP[x.group()], payload)
|
||||||
)
|
)
|
||||||
|
|
|
@ -248,7 +248,7 @@ class NotifyBulkSMS(NotifyBase):
|
||||||
|
|
||||||
if not (self.targets or self.groups):
|
if not (self.targets or self.groups):
|
||||||
# We have nothing to notify
|
# We have nothing to notify
|
||||||
self.logger.warning('There are no Twist targets to notify')
|
self.logger.warning('There are no BulkSMS targets to notify')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Send in batches if identified to do so
|
# Send in batches if identified to do so
|
||||||
|
|
|
@ -727,19 +727,29 @@ class NotifyMatrix(NotifyBase):
|
||||||
# "content_uri": "mxc://example.com/a-unique-key"
|
# "content_uri": "mxc://example.com/a-unique-key"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
if self.version == MatrixVersion.V3:
|
# FUTURE if self.version == MatrixVersion.V3:
|
||||||
# Prepare our payload
|
# FUTURE # Prepare our payload
|
||||||
payloads.append({
|
# FUTURE payloads.append({
|
||||||
"body": attachment.name,
|
# FUTURE "body": attachment.name,
|
||||||
"info": {
|
# FUTURE "info": {
|
||||||
"mimetype": attachment.mimetype,
|
# FUTURE "mimetype": attachment.mimetype,
|
||||||
"size": len(attachment),
|
# FUTURE "size": len(attachment),
|
||||||
},
|
# FUTURE },
|
||||||
"msgtype": "m.image",
|
# FUTURE "msgtype": "m.image",
|
||||||
"url": response.get('content_uri'),
|
# FUTURE "url": response.get('content_uri'),
|
||||||
})
|
# FUTURE })
|
||||||
|
|
||||||
|
# FUTURE else:
|
||||||
|
# FUTURE # Prepare our payload
|
||||||
|
# FUTURE payloads.append({
|
||||||
|
# FUTURE "info": {
|
||||||
|
# FUTURE "mimetype": attachment.mimetype,
|
||||||
|
# FUTURE },
|
||||||
|
# FUTURE "msgtype": "m.image",
|
||||||
|
# FUTURE "body": "tta.webp",
|
||||||
|
# FUTURE "url": response.get('content_uri'),
|
||||||
|
# FUTURE })
|
||||||
|
|
||||||
else:
|
|
||||||
# Prepare our payload
|
# Prepare our payload
|
||||||
payloads.append({
|
payloads.append({
|
||||||
"info": {
|
"info": {
|
||||||
|
@ -1131,10 +1141,11 @@ class NotifyMatrix(NotifyBase):
|
||||||
or self.port == default_port else f':{self.port}')
|
or self.port == default_port else f':{self.port}')
|
||||||
|
|
||||||
if path == '/upload':
|
if path == '/upload':
|
||||||
if self.version == MatrixVersion.V3:
|
# FUTURE if self.version == MatrixVersion.V3:
|
||||||
url += MATRIX_V3_MEDIA_PATH + path
|
# FUTURE url += MATRIX_V3_MEDIA_PATH + path
|
||||||
|
|
||||||
else:
|
# FUTURE else:
|
||||||
|
# FUTURE url += MATRIX_V2_MEDIA_PATH + path
|
||||||
url += MATRIX_V2_MEDIA_PATH + path
|
url += MATRIX_V2_MEDIA_PATH + path
|
||||||
|
|
||||||
params = {'filename': attachment.name}
|
params = {'filename': attachment.name}
|
||||||
|
|
|
@ -162,7 +162,7 @@ def test_plugin_bulksms_edge_cases(mock_post):
|
||||||
# Prepare Mock
|
# Prepare Mock
|
||||||
mock_post.return_value = response
|
mock_post.return_value = response
|
||||||
|
|
||||||
# Test our markdown
|
# Instantiate our object
|
||||||
obj = Apprise.instantiate(
|
obj = Apprise.instantiate(
|
||||||
'bulksms://{}:{}@{}?batch=n'.format(user, pwd, '/'.join(targets)))
|
'bulksms://{}:{}@{}?batch=n'.format(user, pwd, '/'.join(targets)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue