Esempio n. 1
0
    def test_save_error(self):

        class SomeError(Exception):
            pass
        put = self.mocker.mock()
        put("provider-state", MATCH(self.is_expected_yaml))
        self.mocker.result(fail(SomeError("blah")))
        self.mocker.replay()

        provider = DummyProvider(put=put)
        save_state = SaveState(provider)
        d = save_state.run({"some": "thing"})
        self.assertFailure(d, SomeError)
        return d
Esempio n. 2
0
    def test_save(self):
        put = self.mocker.mock()
        put("provider-state", MATCH(self.is_expected_yaml))
        self.mocker.result(succeed(True))
        self.mocker.replay()

        provider = DummyProvider(put=put)
        save_state = SaveState(provider)
        d = save_state.run({"some": "thing"})

        def verify_true(result):
            self.assertEquals(result, True)
        d.addCallback(verify_true)
        return d