Пример #1
0
    def test_delegates_to_the_client(self):
        (flexmock(stampr.client.Client).should_receive("ping").once())
            
        stampr.authenticate("user", "pass")

        new_mailing = flexmock(stampr.mailing.Mailing)
        (flexmock(stampr.client.Client.current)
            .should_receive("mail")
            .with_args("from", "to", "body", None, None)
            .and_return(new_mailing))

        mailing = stampr.mail("from", "to", "body")
        assert mailing == new_mailing
Пример #2
0
 def test_no_authentication(self):
     stampr.client.Client._current = stampr.client.NullClient()
     with raises(stampr.exceptions.APIError):
         stampr.mail("from", "to", "body")