Commit f75aee4a9b3a13ab914bdd8f3672d94694e1f4b8
1 parent
a3ae545efe
Exists in
master
fix editflashcard test
Showing 2 changed files with 5 additions and 4 deletions Side-by-side Diff
flashcards/models.py
View file @
f75aee4
... | ... | @@ -351,14 +351,14 @@ |
351 | 351 | user != self.author or UserFlashcard.objects.filter(flashcard=self).exclude(user=user).exists()) |
352 | 352 | if create_new: |
353 | 353 | self.hide_by_user(user, 'replaced by new card') |
354 | - Flashcard.push(text=new_data.get('text', self.text), | |
354 | + return Flashcard.push(text=new_data.get('text', self.text), | |
355 | 355 | mask=new_mask, |
356 | 356 | material_date=new_data.get('material_date', self.material_date), |
357 | 357 | section=self.section, |
358 | 358 | previous=self, |
359 | 359 | author=user) |
360 | 360 | else: |
361 | - self.mask = FlashcardMask(new_data['mask']) | |
361 | + self.mask = new_mask | |
362 | 362 | if text_changed: self.text = new_data['text'] |
363 | 363 | if material_date_changed: self.material_date = new_data['material_date'] |
364 | 364 | self.save() |
... | ... | @@ -371,7 +371,7 @@ |
371 | 371 | import flashcards.pushes |
372 | 372 | |
373 | 373 | flashcards.pushes.push_deck_event('card_fixed', self, user) |
374 | - return self | |
374 | + return self | |
375 | 375 | |
376 | 376 | def hide_by_user(self, user, reason=None): |
377 | 377 |
flashcards/tests/test_models.py
View file @
f75aee4
... | ... | @@ -131,7 +131,8 @@ |
131 | 131 | flashcard.edit(user, {}) |
132 | 132 | self.assertIsNotNone(flashcard.pk) |
133 | 133 | UserFlashcard.objects.create(user=user2, flashcard=flashcard).save() |
134 | - flashcard.edit(user2, {'text': 'This is the new text'}) | |
134 | + flashcard = flashcard.edit(user2, {'text': 'This is the new text'}) | |
135 | + | |
135 | 136 | self.assertNotEqual(flashcard.pk, pk_backup) |
136 | 137 | self.assertEqual(flashcard.text, 'This is the new text') |
137 | 138 |