Просмотр исходного кода

Add tests for saving category instances

(cherry picked from commit 270319e33f)
master
Michael van Tellingen 11 лет назад
Родитель
Сommit
28186aab1d
1 измененных файлов: 13 добавлений и 2 удалений
  1. 13
    2
      tests/integration/catalogue/category_tests.py

+ 13
- 2
tests/integration/catalogue/category_tests.py Просмотреть файл

@@ -1,7 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2
-from django.test import TestCase
3
-from django.core.exceptions import ValidationError
4 2
 from django import template
3
+from django.core.exceptions import ValidationError
4
+from django.test import TestCase
5 5
 
6 6
 from oscar.apps.catalogue import models
7 7
 from oscar.apps.catalogue.categories import create_from_breadcrumbs
@@ -27,6 +27,17 @@ class TestCategory(TestCase):
27 27
         with self.assertRaises(ValidationError):
28 28
             self.products.add_child(name=u"Bücher")
29 29
 
30
+    def test_save_update_slug(self):
31
+        with self.assertNumQueries(2):
32
+            self.books.name = 'Books'
33
+            self.books.save()
34
+
35
+    def test_save_update_fields(self):
36
+        with self.assertNumQueries(1):
37
+            self.books.description = 'Something new'
38
+            self.books.save(update_fields=['description'])
39
+
40
+
30 41
 
31 42
 class TestMovingACategory(TestCase):
32 43
 

Загрузка…
Отмена
Сохранить