|
@@ -2,7 +2,7 @@ from oscar.core.loading import get_model
|
2
|
2
|
from django.core.urlresolvers import reverse
|
3
|
3
|
|
4
|
4
|
from oscar.test.testcases import WebTestCase, add_permissions
|
5
|
|
-from oscar.test.factories import create_product, create_stockrecord
|
|
5
|
+from oscar.test.factories import create_product, create_stockrecord, ProductAttributeFactory
|
6
|
6
|
|
7
|
7
|
from django_dynamic_fixture import G
|
8
|
8
|
|
|
@@ -90,6 +90,22 @@ class TestAStaffUser(WebTestCase):
|
90
|
90
|
if product.has_stockrecords:
|
91
|
91
|
self.fail('Product has stock records but should not')
|
92
|
92
|
|
|
93
|
+ def test_can_create_product_with_required_attributes(self):
|
|
94
|
+ category = G(Category)
|
|
95
|
+ attribute = ProductAttributeFactory(required=True)
|
|
96
|
+ product_class = attribute.product_class
|
|
97
|
+ page = self.get(reverse('dashboard:catalogue-product-create',
|
|
98
|
+ args=(product_class.slug,)))
|
|
99
|
+ form = page.form
|
|
100
|
+ form['upc'] = '123456'
|
|
101
|
+ form['title'] = 'new product'
|
|
102
|
+ form['attr_weight'] = '5'
|
|
103
|
+ form['productcategory_set-0-category'] = category.id
|
|
104
|
+
|
|
105
|
+ page = form.submit()
|
|
106
|
+
|
|
107
|
+ self.assertEqual(Product.objects.count(), 1)
|
|
108
|
+
|
93
|
109
|
def test_can_delete_an_individual_product(self):
|
94
|
110
|
product = create_product()
|
95
|
111
|
stockrecord = create_stockrecord(product, partner_users=[self.user, ])
|
|
@@ -174,12 +190,17 @@ class TestANonStaffUser(TestAStaffUser):
|
174
|
190
|
assert product1 in products_on_page
|
175
|
191
|
assert product2 not in products_on_page
|
176
|
192
|
|
|
193
|
+ # Tests below can't work because they don't create a stockrecord
|
|
194
|
+
|
177
|
195
|
def test_can_create_a_product_without_stockrecord(self):
|
178
|
196
|
pass
|
179
|
197
|
|
180
|
198
|
def test_can_update_a_product_without_stockrecord(self):
|
181
|
199
|
pass
|
182
|
200
|
|
|
201
|
+ def test_can_create_product_with_required_attributes(self):
|
|
202
|
+ pass
|
|
203
|
+
|
183
|
204
|
def test_can_submit_an_invalid_product_update_and_returns_to_update_page(self):
|
184
|
205
|
pass
|
185
|
206
|
|