<reponame>bopopescu/fjord
from fjord.base.tests import TestCase
from fjord.mailinglist.tests import MailingListFactory
from fjord.mailinglist.utils import get_recipients


class TestGetRecipients(TestCase):
    def test_doesnt_exist(self):
        """Getting recipients from a non-existent mailing list is an empty list
        """
        assert get_recipients('foo') == []

    def test_no_members(self):
        ml = MailingListFactory(members=u'')
        assert get_recipients(ml.name) == []

    def test_has_members(self):
        ml = MailingListFactory(members=u'<EMAIL>\<EMAIL>')
        assert (
            get_recipients(ml.name) ==
            ['<EMAIL>', '<EMAIL>']
        )

from fjord.base.tests import TestCase
from fjord.mailinglist.tests import MailingListFactory
from fjord.mailinglist.utils import get_recipients


class TestGetRecipients(TestCase):
    def test_doesnt_exist(self):
        """Getting recipients from a non-existent mailing list is an empty list
        """
        assert get_recipients('foo') == []

    def test_no_members(self):
        ml = MailingListFactory(members=u'')
        assert get_recipients(ml.name) == []

    def test_has_members(self):
        ml = MailingListFactory(members=u'<EMAIL>\<EMAIL>')
        assert (
            get_recipients(ml.name) ==
            ['<EMAIL>', '<EMAIL>']
        )
Getting recipients from a non-existent mailing list is an empty list