예제 #1
0
def test_from_user_works_with_letter_request():
    lr = LetterRequestFactory()
    fields = Fields.from_user(lr.user)
    assert fields.letter_request__will_we_mail is True
    assert fields.letter_request__created_at == datetime.datetime.utcnow().date().isoformat()
    assert strip_locale(fields.letter_request__admin_pdf_url) == \
        f'https://example.com/loc/admin/{lr.user.pk}/letter.pdf'
예제 #2
0
def test_from_user_works_with_letter_request():
    lr = LetterRequestFactory(letter_sent_at=make_aware(
        datetime.datetime(2018, 5, 6)),
                              rejection_reason='INCRIMINATING',
                              tracking_number='boop')
    fields = Fields.from_user(lr.user)
    assert fields.letter_request__will_we_mail is True
    assert fields.letter_request__created_at == datetime.datetime.utcnow(
    ).date().isoformat()
    assert strip_locale(fields.letter_request__admin_pdf_url) == \
        f'https://example.com/loc/admin/{lr.user.pk}/letter.pdf'
    assert fields.letter_request__letter_sent_at == '2018-05-06'
    assert fields.letter_request__rejection_reason == 'INCRIMINATING'
    assert fields.letter_request__tracking_number == 'boop'
예제 #3
0
 def test_get_upload_url_works(self, db):
     token = UploadToken(id="boop")
     url = strip_locale(token.get_upload_url())
     assert url == "https://example.com/hp/upload/boop"
예제 #4
0
def test_print_loc_envelopes_works():
    user = UserFactory()
    redirect = print_loc_envelopes(None, None, JustfixUser.objects.all())
    url = strip_locale(redirect.url)
    assert url == f'/loc/admin/envelopes.pdf?user_ids={user.pk}'