def test_attribute_error_bug(self): """NoteSerializer: Should not raise AttributeError exeption""" note = Note(note='Hello', instance=self._first_xform_instance) note.save() data = NoteSerializer(note).data self.assertDictContainsSubset({ 'created_by': None, 'note': u'Hello', 'instance': note.instance_id, 'owner': None }, data)
def test_no_created_by(self): self._publish_transportation_form_and_submit_instance() instance = Instance.objects.first() note = Note( instance=instance, instance_field="", created_by=None, ) note.save() note_data = note.get_data() self.assertEqual(note_data['owner'], "") self.assertEqual(note_data['created_by'], "")
def test_no_created_by(self): """ Test: - Returns empty string when created_by is None """ self._publish_transportation_form_and_submit_instance() instance = Instance.objects.first() note = Note( instance=instance, instance_field="", created_by=None, ) note.save() note_data = note.get_data() self.assertEqual(note_data['owner'], "") self.assertEqual(note_data['created_by'], "")
def add_note(self, note): note = Note(instance=self.instance, note=note) note.save()
def add_note(self, note): print('\n\t(parsed_instance): adding new note..') note = Note(instance=self.instance, user_id=self.request.user.username, note=note) note.save()