mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add missing migration file
This commit is contained in:
parent
ae7fbd6112
commit
f239c8f8c8
@ -39,13 +39,13 @@ script:
|
||||
- invoke translate
|
||||
- invoke style
|
||||
# Create an empty database and fill it with test data
|
||||
- rm InvenTree/inventree_default_db.sqlite3
|
||||
- rm inventree_default_db.sqlite3
|
||||
- invoke migrate
|
||||
- invoke import-fixtures
|
||||
# Export database records
|
||||
- invoke export-records -f data.json
|
||||
# Create a new empty database and import the saved data
|
||||
- rm InvenTree/inventree_default_db.sqlite3
|
||||
- rm inventree_default_db.sqlite3
|
||||
- invoke migrate
|
||||
- invoke import-records -f data.json
|
||||
|
||||
|
@ -50,17 +50,10 @@ class CompanyViewTestBase(TestCase):
|
||||
|
||||
self.client.login(username='username', password='password')
|
||||
|
||||
|
||||
class SupplierPartViewTests(CompanyViewTestBase):
|
||||
"""
|
||||
Tests for the SupplierPart views.
|
||||
"""
|
||||
|
||||
def post(self, data, valid=None):
|
||||
def post(self, url, data, valid=None):
|
||||
"""
|
||||
POST against this form and return the response (as a JSON object)
|
||||
"""
|
||||
url = reverse('supplier-part-create')
|
||||
|
||||
response = self.client.post(url, data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||
|
||||
@ -79,6 +72,14 @@ class SupplierPartViewTests(CompanyViewTestBase):
|
||||
|
||||
return json_data, form_errors
|
||||
|
||||
|
||||
|
||||
class SupplierPartViewTests(CompanyViewTestBase):
|
||||
"""
|
||||
Tests for the SupplierPart views.
|
||||
"""
|
||||
|
||||
|
||||
def test_supplier_part_create(self):
|
||||
"""
|
||||
Test the SupplierPartCreate view.
|
||||
@ -103,13 +104,13 @@ class SupplierPartViewTests(CompanyViewTestBase):
|
||||
}
|
||||
|
||||
# SKU is required! (form should fail)
|
||||
(response, errors) = self.post(data, valid=False)
|
||||
(response, errors) = self.post(url, data, valid=False)
|
||||
|
||||
self.assertIsNotNone(errors.get('SKU', None))
|
||||
|
||||
data['SKU'] = 'TEST-ME-123'
|
||||
|
||||
(response, errors) = self.post(data, valid=True)
|
||||
(response, errors) = self.post(url, data, valid=True)
|
||||
|
||||
# Check that the SupplierPart was created!
|
||||
self.assertEqual(n + 1, SupplierPart.objects.all().count())
|
||||
@ -120,7 +121,7 @@ class SupplierPartViewTests(CompanyViewTestBase):
|
||||
self.assertEqual(supplier_part.price_breaks.count(), 0)
|
||||
|
||||
# Duplicate SKU is prohibited
|
||||
(response, errors) = self.post(data, valid=False)
|
||||
(response, errors) = self.post(url, data, valid=False)
|
||||
|
||||
self.assertIsNotNone(errors.get('__all__', None))
|
||||
|
||||
@ -129,7 +130,7 @@ class SupplierPartViewTests(CompanyViewTestBase):
|
||||
data['single_pricing_0'] = '123.4'
|
||||
data['single_pricing_1'] = 'CAD'
|
||||
|
||||
(response, errors) = self.post(data, valid=True)
|
||||
(response, errors) = self.post(url, data, valid=True)
|
||||
|
||||
pk = response.get('pk')
|
||||
|
||||
@ -186,3 +187,20 @@ class CompanyViewTest(CompanyViewTestBase):
|
||||
|
||||
response = self.client.get(reverse('company-index'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_company_create(self):
|
||||
"""
|
||||
Test the view for creating a company
|
||||
"""
|
||||
|
||||
url = reverse('company-create')
|
||||
|
||||
# Check that different company types return different form titles
|
||||
response = self.client.get(reverse('supplier-create'), HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||
self.assertContains(response, 'Create new Supplier')
|
||||
|
||||
response = self.client.get(reverse('manufacturer-create'), HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||
self.assertContains(response, 'Create new Manufacturer')
|
||||
|
||||
response = self.client.get(reverse('customer-create'), HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||
self.assertContains(response, 'Create new Customer')
|
||||
|
19
InvenTree/order/migrations/0039_auto_20201112_2203.py
Normal file
19
InvenTree/order/migrations/0039_auto_20201112_2203.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.0.7 on 2020-11-12 11:03
|
||||
|
||||
from django.db import migrations
|
||||
import djmoney.models.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('order', '0038_auto_20201112_1737'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='purchaseorderlineitem',
|
||||
name='purchase_price',
|
||||
field=djmoney.models.fields.MoneyField(blank=True, decimal_places=4, default_currency='USD', help_text='Unit purchase price', max_digits=19, null=True, verbose_name='Purchase Price'),
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue
Block a user