def create_model(self, store): return Calls(date=localtoday().date(), description=u'', message=u'', person=self.person, attendant=api.get_current_user(self.store), store=store)
def create_call(self, person=None, attendant=None): from stoqlib.domain.person import Calls return Calls(date=localdate(2011, 1, 1).date(), message=u"Test call message", person=person or self.create_person(), attendant=attendant or self.create_user(), description=u"Test call", store=self.store)
def _dialog_call(self, id): from stoqlib.domain.person import Calls from stoqlib.gui.editors.callseditor import CallsEditor store = api.new_store() model = Calls.get(int(id), store) retval = run_dialog(CallsEditor, self.app, store, model, None, None) if store.confirm(retval): self.refresh() store.close()
def test_calls(self): person = self.create_person() user = self.create_user() self.assertEquals(len(list(person.calls)), 0) call = Calls(store=self.store, date=localnow(), description=u'', message=u'', person=person, attendant=user) self.assertEquals(len(list(person.calls)), 1) self.assertEquals(list(person.calls)[0], call)