Пример #1
0
 def test_confirm_with_payment_comment(self):
     comment = self.create_payment_comment(u'foo')
     self.assertEqual(comment.comment, u'foo')
     editor = NoteEditor(self.store, comment, 'comment', label_text='Notes')
     editor.notes.update('bar')
     self.click(editor.main_dialog.ok_button)
     self.assertEqual(comment.comment, u'bar')
Пример #2
0
 def test_warn_note_below_min_length(self, warning):
     sale = self.create_sale()
     sale_comment = self.create_sale_comment(sale, u'teste')
     editor = NoteEditor(self.store,
                         sale_comment,
                         attr_name='comment',
                         ok_button_label=u"Cancel sale",
                         cancel_button_label=u"Don't cancel",
                         min_length=10)
     self.click(editor.main_dialog.ok_button)
     warning.assert_called_once_with(
         "The note must have at least 10 characters.")
Пример #3
0
 def test_button_label(self):
     sale = self.create_sale()
     sale_comment = self.create_sale_comment(sale, u'teste')
     sale.status = sale.STATUS_QUOTE
     editor = NoteEditor(self.store,
                         sale_comment,
                         attr_name='comment',
                         ok_button_label=u"Cancel sale",
                         cancel_button_label=u"Don't cancel")
     cancel_sale_button = editor.main_dialog.ok_button.get_label()
     not_cancel_button = editor.main_dialog.cancel_button.get_label()
     self.assertEqual(cancel_sale_button, u"Cancel sale")
     self.assertEqual(not_cancel_button, u"Don't cancel")
Пример #4
0
    def test_cancel_with_non_domain(self):
        class TempNote(object):
            obs = u'bin'

        obj = TempNote()
        self.assertEqual(obj.obs, u'bin')
        editor = NoteEditor(self.store, obj, 'obs', label_text='Notes')
        editor.notes.update('foo')

        # Cancelling the dialog should manually revert the changes (since the
        # object edited is not a domain object)
        self.click(editor.main_dialog.cancel_button)
        self.assertEqual(obj.obs, u'bin')
Пример #5
0
 def test_show(self):
     person = self.create_person()
     editor = NoteEditor(self.store, person, 'notes', label_text='Notes')
     self.check_editor(editor, 'editor-note-show')