예제 #1
0
    def test_creates_client(self):
        (flexmock(stampr.client.Client)
                .should_receive("_api")
                .once()
                .with_args("get", ("test", "ping"))
                .and_return({ "pong": datetime.datetime.now().isoformat() }))

        stampr.authenticate("user", "pass")
예제 #2
0
    def setup(self):
        (flexmock(stampr.client.Client).should_receive("ping").once())
        stampr.authenticate("user", "pass")

        self.created = stampr.batch.Batch(batch_id=2, config_id=1)
        self.uncreated = stampr.batch.Batch(config_id=1)

        self.start = datetime.datetime(1900, 1, 1, 0, 0, 0)
        self.finish = datetime.datetime(2000, 1, 1, 0, 0, 0)
예제 #3
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
예제 #4
0
    def setup(self):
        (flexmock(stampr.client.Client).should_receive("ping").once())
        stampr.authenticate("user", "pass")

        self.uncreated = stampr.config.Config()
        self.created = stampr.config.Config(config_id=1)