Esempio n. 1
0
 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)
Esempio n. 2
0
 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_note_text_property_method(self):
        """
        Test :
            - note_text property
            - get_note_text method
        """
        self._publish_transportation_form_and_submit_instance()
        instance = Instance.objects.first()
        note = Note(
            instance=instance,
            note='Hey there',
            instance_field="",
        )

        submission_review = SubmissionReview(instance=instance)

        # Returns None if Submission_Review has no note_text
        self.assertIsNone(submission_review.get_note_text())
        self.assertIsNone(submission_review.note_text)

        submission_review = SubmissionReview(instance=instance, note=note)

        # Returns correct note text when note is present
        self.assertEqual(note.note, submission_review.get_note_text())
        self.assertEqual(note.note, submission_review.note_text)
Esempio n. 4
0
 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'], "")
Esempio n. 5
0
 def add_note(self, note):
     note = Note(instance=self.instance, note=note)
     note.save()
Esempio n. 6
0
 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()