def test_unstub_returns_back_original_method_even_in_multiple_stubs(self): other_value = object() stubydoo.stub(self.object.method) stubydoo.stub(self.object.method).with_args('arg', 1, foo='bar').\ and_return(other_value) stubydoo.unstub(self.object.method) self.assertTrue(self.object.method() is self.original_value)
def test_unstubbing(self): stubydoo.stub(self.double, 'method') stubydoo.unstub(self.double.method) try: self.double.method except AttributeError: pass else: self.fail()
def test_unstub_non_existing_attribute(self): stubydoo.stub(self.double, foo='baz') stubydoo.unstub(self.double, 'foo') self.assertTrue(not hasattr(self.double, 'foo'))
def test_unstub_existing_attribute(self): self.double.foo = 'bar' stubydoo.stub(self.double, foo='baz') stubydoo.unstub(self.double, 'foo') self.assertEquals(self.double.foo, 'bar')
def test_unstub_returns_back_original_method(self): stubydoo.stub(self.object.method) stubydoo.unstub(self.object.method) self.assertTrue(self.object.method() is self.original_value)
def test_fails_silently(self): stubydoo.unstub(self.object.method)