Example #1
0
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']
Example #2
0
def test_EditText_message(monkeypatch):
    monkeypatch.setattr('click.edit', lambda *args, **kwargs: 'Some message')

    assert template.edit_text() == 'Some message'
Example #3
0
def test_EditText_no_message(monkeypatch):
    monkeypatch.setattr('click.edit', lambda *args, **kwargs: None)

    with raises(template.EmptyMessageError):
        template.edit_text()
Example #4
0
 def test_message_prefill(self, check_call):
     check_call.return_value = True
     assert_equals(template.edit_text('open',
                                      data={'title': 'Some message'}),
                   'Some message')
Example #5
0
 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')
Example #6
0
 def test_no_message(self, check_call):
     check_call.return_value = True
     template.edit_text()