Skip to content

Commit

Permalink
Merge pull request #93 from ambitioninc/develop
Browse files Browse the repository at this point in the history
2.2.0
  • Loading branch information
somewes authored Jun 29, 2023
2 parents a7205da + 8094409 commit 199821d
Show file tree
Hide file tree
Showing 18 changed files with 236 additions and 197 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# copied from django-cte
name: entity_emailer tests
on:
push:
branches: [master]
pull_request:
branches: [master,develop]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9']
# Time to switch to pytest or nose2??
# nosetests is broken on 3.10
# AttributeError: module 'collections' has no attribute 'Callable'
# https://github.com/nose-devs/nose/issues/1099
django:
- 'Django~=3.2.0'
- 'Django~=4.0.0'
- 'Django~=4.1.0'
- 'Django~=4.2.0'
experimental: [false]
# include:
# - python: '3.9'
# django: 'https://github.com/django/django/archive/refs/heads/main.zip#egg=Django'
# experimental: true
# # NOTE this job will appear to pass even when it fails because of
# # `continue-on-error: true`. Github Actions apparently does not
# # have this feature, similar to Travis' allow-failure, yet.
# # https://github.com/actions/toolkit/issues/399
exclude:
- python: '3.7'
django: 'Django~=4.0.0'
- python: '3.7'
django: 'Django~=4.1.0'
- python: '3.7'
django: 'Django~=4.2.0'
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Setup
run: |
python --version
pip install --upgrade pip wheel
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-testing.txt
pip install "${{ matrix.django }}"
pip freeze
- name: Run tests
env:
DB_SETTINGS: >-
{
"ENGINE":"django.db.backends.postgresql_psycopg2",
"NAME":"entity_emailer",
"USER":"postgres",
"PASSWORD":"postgres",
"HOST":"localhost",
"PORT":"5432"
}
run: |
coverage run manage.py test entity_emailer
coverage report --fail-under=99
continue-on-error: ${{ matrix.experimental }}
- name: Check style
run: flake8 entity_emailer
2 changes: 0 additions & 2 deletions entity_emailer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# flake8: noqa
from .version import __version__

default_app_config = 'entity_emailer.apps.EntityEmailerConfig'
37 changes: 37 additions & 0 deletions entity_emailer/migrations/0001_0004_squashed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 3.2.19 on 2023-06-01 13:10

import datetime
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):
replaces = [('entity_emailer', '0001_initial'),
('entity_emailer', '0002_auto_20170919_1653'),
('entity_emailer', '0003_email_exception'),
('entity_emailer', '0004_email_num_tries')]

dependencies = [
('entity_event', '0001_initial'),
('entity', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Email',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('view_uid', models.UUIDField(default=uuid.uuid4, editable=False)),
('subject', models.CharField(max_length=256)),
('from_address', models.CharField(default='', max_length=256)),
('uid', models.CharField(default=None, max_length=100, null=True, unique=True)),
('scheduled', models.DateTimeField(default=datetime.datetime.utcnow, null=True)),
('sent', models.DateTimeField(default=None, null=True)),
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='entity_event.event')),
('recipients', models.ManyToManyField(to='entity.Entity')),
('exception', models.TextField(default=None, null=True)),
('num_tries', models.IntegerField(default=0)),
],
),
]
42 changes: 0 additions & 42 deletions entity_emailer/migrations/0001_initial.py

This file was deleted.

21 changes: 0 additions & 21 deletions entity_emailer/migrations/0002_auto_20170919_1653.py

This file was deleted.

18 changes: 0 additions & 18 deletions entity_emailer/migrations/0003_email_exception.py

This file was deleted.

18 changes: 0 additions & 18 deletions entity_emailer/migrations/0004_email_num_tries.py

This file was deleted.

6 changes: 4 additions & 2 deletions entity_emailer/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@


# An event that will be fired prior to an email being sent
pre_send = Signal(providing_args=['email', 'event', 'context', 'message'])
pre_send = Signal()
"""providing_args=['email', 'event', 'context', 'message']"""

# An event that will be fired if an exception occurs when trying to send an email
email_exception = Signal(providing_args=['email', 'exception'])
email_exception = Signal()
"""providing_args=['email', 'exception']"""
Loading

0 comments on commit 199821d

Please sign in to comment.