Пример #1
0
    def test_gengo_daily_activities_warning(self):
        """Tests warning email is sent"""
        # Add recipients to mailing list
        ml = MailingList.objects.get(name='gengo_balance')
        ml.members = u'*****@*****.**'
        ml.save()

        ght = GengoHumanTranslator()

        with patch('fjord.translations.gengo_utils.Gengo') as GengoMock:
            # FIXME: This returns the same thing both times, but to
            # make the test "more kosher" we'd have this return two
            # different order_id values.
            mocker = GengoMock.return_value
            mocker.getAccountBalance.return_value = {
                u'opstat': u'ok',
                u'response': {
                    # Enough for one order, but dips below threshold
                    # for the second one.
                    u'credits': '30.00',
                    u'currency': u'USD'
                }
            }

            ght.run_daily_activities()

            # The "balance is low warning" email only.
            assert len(mail.outbox) == 1
Пример #2
0
    def test_gengo_daily_activities_warning(self):
        """Tests warning email is sent"""
        # Add recipients to mailing list
        ml = MailingList.objects.get(name='gengo_balance')
        ml.members = u'*****@*****.**'
        ml.save()

        ght = GengoHumanTranslator()

        with patch('fjord.translations.gengo_utils.Gengo') as GengoMock:
            # FIXME: This returns the same thing both times, but to
            # make the test "more kosher" we'd have this return two
            # different order_id values.
            mocker = GengoMock.return_value
            mocker.getAccountBalance.return_value = {
                u'opstat': u'ok',
                u'response': {
                    # Enough for one order, but dips below threshold
                    # for the second one.
                    u'credits': '30.00',
                    u'currency': u'USD'
                }
            }

            ght.run_daily_activities()

            # The "balance is low warning" email only.
            assert len(mail.outbox) == 1
Пример #3
0
    def test_gengo_daily_activities_warning(self):
        """Tests warning email is sent"""
        ght = GengoHumanTranslator()

        with patch('fjord.translations.gengo_utils.Gengo') as GengoMock:
            # FIXME: This returns the same thing both times, but to
            # make the test "more kosher" we'd have this return two
            # different order_id values.
            mocker = GengoMock.return_value
            mocker.getAccountBalance.return_value = {
                u'opstat': u'ok',
                u'response': {
                    # Enough for one order, but dips below threshold
                    # for the second one.
                    u'credits': '30.00',
                    u'currency': u'USD'
                }
            }

            ght.run_daily_activities()

            # The "balance is low warning" email only.
            eq_(len(mail.outbox), 1)
Пример #4
0
    def test_gengo_daily_activities_warning(self):
        """Tests warning email is sent"""
        ght = GengoHumanTranslator()

        with patch('fjord.translations.gengo_utils.Gengo') as GengoMock:
            # FIXME: This returns the same thing both times, but to
            # make the test "more kosher" we'd have this return two
            # different order_id values.
            mocker = GengoMock.return_value
            mocker.getAccountBalance.return_value = {
                u'opstat': u'ok',
                u'response': {
                    # Enough for one order, but dips below threshold
                    # for the second one.
                    u'credits': '30.00',
                    u'currency': u'USD'
                }
            }

            ght.run_daily_activities()

            # The "balance is low warning" email only.
            eq_(len(mail.outbox), 1)