Exemplo n.º 1
0
    def test_email_on_order_paid(self, send_email_mock):
        with \
                current_party_set(self.app, self.party), \
                current_user_set(self.app, self.user), \
                self.app.app_context():
            order_email_service \
                .send_email_for_paid_order_to_orderer(self.order_id)

        expected_sender = '*****@*****.**'
        expected_recipients = [self.user.email_address]
        expected_subject = '\u2705 Deine Bestellung (AC-14-B00022) ist bezahlt worden.'
        expected_body = '''
Hallo Vorbild,

vielen Dank für deine Bestellung mit der Nummer AC-14-B00022 am 23.09.2014 über unsere Website.

Wir haben deine Zahlung erhalten und deine Bestellung als „bezahlt“ erfasst.

Für Fragen stehen wir gerne zur Verfügung.

Viele Grüße,
das Team der Acme Entertainment Convention

-- 
Acme Entertainment Convention

E-Mail: [email protected]
        '''.strip()

        send_email_mock.assert_called_once_with(
            expected_sender,
            expected_recipients,
            expected_subject,
            expected_body,
        )
Exemplo n.º 2
0
    def test_email_on_order_canceled(self, send_email_mock):
        with \
                current_party_set(self.app, self.party), \
                current_user_set(self.app, self.user), \
                self.app.app_context():
            order_email_service \
                .send_email_for_canceled_order_to_orderer(self.order_id)

        expected_sender = '*****@*****.**'
        expected_recipients = [self.user.email_address]
        expected_subject = '\u274c Deine Bestellung (AC-14-B00017) wurde storniert.'
        expected_body = '''
Hallo Versager,

deine Bestellung mit der Nummer AC-14-B00017 vom 06.11.2014 wurde von uns aus folgendem Grund storniert:

Du hast nicht rechtzeitig bezahlt.

Für Fragen stehen wir gerne zur Verfügung.

Viele Grüße,
das Team der Acme Entertainment Convention

-- 
Acme Entertainment Convention

E-Mail: [email protected]
        '''.strip()

        send_email_mock.assert_called_once_with(expected_sender,
                                                expected_recipients,
                                                expected_subject,
                                                expected_body)
Exemplo n.º 3
0
    def test_current_party_is_considered(self):
        snippet_info2014_version = self.create_snippet_with_version(self.party2014, 'info', '2014-10-23 14:55:00')
        snippet_info2015_version = self.create_snippet_with_version(self.party2015, 'info', '2014-10-23 18:21:00')

        with current_party_set(self.app, self.party2014), self.app.app_context():
            actual = get_current_version_of_snippet_with_name('info')
            self.assertEqual(actual, snippet_info2014_version)
Exemplo n.º 4
0
    def test_email_on_order_placed(self, send_email_mock):
        with \
                current_party_set(self.app, self.party), \
                current_user_set(self.app, self.user), \
                self.app.app_context():
            order_email_service \
                .send_email_for_incoming_order_to_orderer(self.order_id)

        expected_to_orderer_sender = '*****@*****.**'
        expected_to_orderer_recipients = [self.user.email_address]
        expected_to_orderer_subject = 'Deine Bestellung (AC-14-B00253) ist eingegangen.'
        expected_to_orderer_body = '''
Hallo Interessent,

vielen Dank für deine Bestellung mit der Nummer AC-14-B00253 am 15.08.2014 über unsere Website.

Folgende Artikel hast du bestellt:

  Bezeichnung: Einzelticket, Kategorie Loge
  Anzahl: 5
  Stückpreis: 99,00 €

  Bezeichnung: T-Shirt, Größe L
  Anzahl: 2
  Stückpreis: 14,95 €

  Gesamtbetrag: 524,90 €

Bitte überweise den Gesamtbetrag auf folgendes Konto:

  Zahlungsempfänger: <Name>
  IBAN: <IBAN>
  BIC: <BIC>
  Bank: <Kreditinstitut>
  Verwendungszweck: AC-14-B00253

Wir werden dich informieren, sobald wir deine Zahlung erhalten haben.

Hier kannst du deine Bestellungen einsehen: https://www.example.com/shop/orders

Für Fragen stehen wir gerne zur Verfügung.

Viele Grüße,
das Team der Acme Entertainment Convention

-- 
Acme Entertainment Convention

E-Mail: [email protected]
        '''.strip()

        send_email_mock.assert_called_once_with(
            expected_to_orderer_sender,
            expected_to_orderer_recipients,
            expected_to_orderer_subject,
            expected_to_orderer_body)
Exemplo n.º 5
0
    def test_image_url(self, slug, image_url_path, expected):
        item = self.create_item_with_version(slug, image_url_path)

        with current_party_set(self.app, self.party), self.app.app_context():
            self.assertEqual(item.image_url, expected)
Exemplo n.º 6
0
    def test_image_url(self, slug, image_url_path, expected):
        item = self.create_item_with_version(slug, image_url_path)

        with current_party_set(self.app, self.party), self.app.app_context():
            self.assertEqual(item.image_url, expected)
Exemplo n.º 7
0
    def test_image_url_without_image(self):
        item = self.create_item_with_version('without-image', None)

        with current_party_set(self.app, self.party), self.app.app_context():
            assert item.image_url is None
Exemplo n.º 8
0
    def test_image_url_with_image(self):
        item = self.create_item_with_version('with-image', 'breaking.png')

        with current_party_set(self.app, self.party), self.app.app_context():
            assert item.image_url == 'http://example.com/brand/news/breaking.png'
Exemplo n.º 9
0
 def test_unknown_name(self):
     with current_party_set(self.app, self.party2014), self.app.app_context():
         with self.assertRaises(SnippetNotFound):
             get_current_version_of_snippet_with_name('totally-unknown-snippet-name')