def test_EditText_message_prefill(monkeypatch): monkeypatch.setattr('click.edit', lambda t, *args, **kwargs: t) data = {'title': 'Some message'} assert template.edit_text('open', data) == data['title']
def test_EditText_message(monkeypatch): monkeypatch.setattr('click.edit', lambda *args, **kwargs: 'Some message') assert template.edit_text() == 'Some message'
def test_EditText_no_message(monkeypatch): monkeypatch.setattr('click.edit', lambda *args, **kwargs: None) with raises(template.EmptyMessageError): template.edit_text()
def test_message_prefill(self, check_call): check_call.return_value = True assert_equals(template.edit_text('open', data={'title': 'Some message'}), 'Some message')
def test_message_comments(self, check_call): def side_effect(args): open(args[1], 'w').write('Some message\n#Some comment') check_call.side_effect = side_effect assert_equals(template.edit_text(), 'Some message')
def test_no_message(self, check_call): check_call.return_value = True template.edit_text()