def test_delegate_positive_realtime(self, MockPullReqState): state = MockPullReqState() action.delegate_positive(state, 'delegate', True) self.assertEqual(state.delegate, 'delegate') state.add_comment.assert_called_once_with( ':v: @delegate can now approve this pull request') state.save.assert_called_once_with()
def test_delegate_positive_not_realtime(self, MockPullReqState): state = MockPullReqState() action.delegate_positive(state, 'delegate', False) self.assertEqual(state.delegate, 'delegate') state.save.assert_called_once_with() assert not state.add_comment.called, 'state.save was called and should never be.'