Пример #1
0
def test__mail__MailAssignmentPreview_1(browser):
    """It can send Fehlende Arbeitsstunden."""
    from sw.allotmentclub import Message, User, Member, Assignment
    from sw.allotmentclub import AssignmentAttendee
    from sw.allotmentclub.conftest import import_members
    import_members()
    assignment = Assignment.find_or_create(
        day=datetime.now(),
        accounting_year=datetime.now().year
    )
    AssignmentAttendee.find_or_create(
        assignment=assignment,
        member=Member.query().filter(Member.lastname == 'Wehrmann').one(),
        hours=5)  # No letter
    AssignmentAttendee.find_or_create(
        assignment=assignment,
        member=Member.query().filter(Member.lastname == 'Hennig').one(),
        hours=3)  # Needs to pay less

    verein = Member.find_or_create(lastname="Verein")
    Message.create(id=245, members=[verein], user=User.create(),
                   accounting_year=2018,
                   subject="Fehlende Arbeitsstunden",
                   body=MISSING_ASSIGMENT_BODY)
    transaction.commit()
    browser.login()
    with mock.patch('sw.allotmentclub.browser.letter.datetime') as dt:
        dt.now.return_value = datetime(2016, 3, 25)
        browser.open('http://localhost/mail/245/preview')
    assertFileEqual(browser.contents, 'test_mail_fehlarbeitsstunden_1.pdf')
Пример #2
0
def setUp():
    from sw.allotmentclub import Depot, User
    user = User.create(username='******')
    Depot.create(date=datetime.datetime(2014, 11, 27, 7, 21, 45),
                 size=15, data=b'GIF89a????!?,D;', mimetype='image/gif',
                 name='test.gif', user=user)
    transaction.commit()
Пример #3
0
def test__mail__MailPreviewView_3(browser):
    """It does not print address and date if no member assigned to message."""
    from sw.allotmentclub import Message, User
    Message.create(id=244, user=User.create(), accounting_year=2015,
                   subject="Info-Brief", body="**Info** an alle Mitglieder")
    transaction.commit()
    browser.login()
    browser.open('http://localhost/mail/244/preview')
    assertFileEqual(browser.contents, 'test_mail_preview_3.pdf')
Пример #4
0
def test_displays_list_of_log_entries(browser):
    from sw.allotmentclub import Log, User
    User.create(id=2, username='******', vorname='Sebastian',
                nachname='Wehrmann')
    Log.create(user_id=2, name='user data', level='INFO',
               created=datetime.datetime.now(), msg='Test-Log-Eintrag')
    transaction.commit()

    browser.login()
    browser.open('http://localhost/')
    assert {
        'username': '******',
        'firstname': 'Sebastian',
        'lastname': 'Wehrmann',
        'gravatar_url': 'https://www.gravatar.com/avatar/'
                        'd41d8cd98f00b204e9800998ecf8427e',
        'detail': ['Test-Log-Eintrag'],
        'time': 'gerade eben'
    } in browser.json['data']['timeline']
Пример #5
0
def setUp():
    from sw.allotmentclub import Member, Message, User, SentMessageInfo
    mustermann = Member.create(lastname="Mustermann", firstname="Max",
                               email='*****@*****.**')
    user = User.create(username='******')
    msg = Message.create(id=242, members=[mustermann], user=user,
                         accounting_year=2016, subject="Test", body="")
    SentMessageInfo.create(message=msg, tag='*****@*****.**',
                           address='*****@*****.**')
    transaction.commit()
Пример #6
0
def test_send_mail_sends_text_mail(mailer, database):
    from ..letter import send_mail
    user = User.create(username='******', vorname='Hans', nachname='Wurst')
    send_mail('*****@*****.**', 'Betreff', 'Dies ist der Inhalt', user)
    assert 1 == len(mailer.outbox)
    message = mailer.outbox[0]
    assert ('Vorstand Leuna-Bungalowgemeinschaft Roter See '
            '<*****@*****.**>' == message.sender)
    assert ['*****@*****.**'] == message.recipients
    assert message.body == (
        '\nDies ist der Inhalt\n\nMit freundlichen Grüßen,\n'
        'Im Auftrag des Vorstandes\n\nHans Wurst (None)\n\n')
    assert message.html is None
    assert 'Anschreiben.pdf' == message.attachments[0].filename
Пример #7
0
def test__mail__MailElectricityPreview_1(browser):
    """It can send Energieabrechnungen."""
    from sw.allotmentclub import Message, User, Member
    from sw.allotmentclub.conftest import import_energy_meters, import_members
    import_members()
    import_energy_meters()
    verein = Member.find_or_create(lastname="Verein")
    Message.create(id=245, members=[verein], user=User.create(),
                   accounting_year=2014, subject="Energieabrechnung",
                   body=ENERGIEABRECHNUNG_BODY)
    transaction.commit()
    browser.login()
    with mock.patch('sw.allotmentclub.browser.letter.datetime') as dt:
        dt.now.return_value = datetime(2016, 3, 25)
        browser.open('http://localhost/mail/245/preview')
    assertFileEqual(browser.contents, 'test_mail_energieabrechnung_1.pdf')
Пример #8
0
def setUp():
    from sw.allotmentclub import Member, Message, User
    verein = Member.create(lastname="Verein")
    mustermann = Member.create(lastname="Mustermann", firstname="Max")
    user = User.create(username='******')
    greeting = ('Sehr geehrte{{deflection}} {{appellation}} '
                '{{title}} {{lastname}},\n\n')
    Message.create(id=242, members=[verein], user=user, accounting_year=2015,
                   subject="Info-Brief",
                   body=greeting+"**Info** an alle Mitglieder")
    Message.create(id=243, members=[mustermann], user=user,
                   accounting_year=2015, subject="Willkommen",
                   body=greeting+"Willkommen im Verein.")
    Message.create(id=244, members=[mustermann], user=user,
                   accounting_year=2016, subject="Beitragsabrechnung",
                   body=greeting)
    transaction.commit()
def setUp():
    from sw.allotmentclub import Bulletin, User
    user = User.create(username='******')
    Bulletin.create(
        date=datetime.datetime(2015, 3, 7, 10),
        subject='Ruhezeiten im Verein',
        user=user,
        content="""
### Mittagsruhe

- täglich 13.00 - 15.00 Uhr (ganzjährig)

### Nachtruhe

- Montag bis Freitag:      22.00 - 08.00 Uhr
- Samstag &amp; Sonntag:    24.00 - 08.00 Uhr

### Genereller Baustop

- jährlich vom 15. Juni bis 31. August.""")
    transaction.commit()