From 9f91797f4224b805f1f3dc6683a82b2414a4da53 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 3 Sep 2019 09:19:37 +1000 Subject: [PATCH] Simple test case for currency --- InvenTree/common/admin.py | 2 +- InvenTree/common/fixtures/currency.yaml | 16 ++++++++++++++++ InvenTree/common/tests.py | 18 +++++++++++++++++- InvenTree/common/views.py | 2 -- 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 InvenTree/common/fixtures/currency.yaml diff --git a/InvenTree/common/admin.py b/InvenTree/common/admin.py index faf6dd578e..1628f811a7 100644 --- a/InvenTree/common/admin.py +++ b/InvenTree/common/admin.py @@ -7,4 +7,4 @@ class CurrencyAdmin(admin.ModelAdmin): list_display = ('symbol', 'suffix', 'description', 'value', 'base') -admin.site.register(Currency, CurrencyAdmin) \ No newline at end of file +admin.site.register(Currency, CurrencyAdmin) diff --git a/InvenTree/common/fixtures/currency.yaml b/InvenTree/common/fixtures/currency.yaml new file mode 100644 index 0000000000..639b0751df --- /dev/null +++ b/InvenTree/common/fixtures/currency.yaml @@ -0,0 +1,16 @@ +# Test fixtures for Currency objects + +- model: common.currency + fields: + symbol: '$' + suffix: 'AUD' + description: 'Australian Dollars' + base: True + +- model: common.currency + fields: + symbol: '$' + suffix: 'USD' + description: 'US Dollars' + base: False + value: 1.4 \ No newline at end of file diff --git a/InvenTree/common/tests.py b/InvenTree/common/tests.py index 7ce503c2dd..5c6171a65c 100644 --- a/InvenTree/common/tests.py +++ b/InvenTree/common/tests.py @@ -1,3 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + from django.test import TestCase -# Create your tests here. +from .models import Currency + + +class CurrencyTest(TestCase): + """ Tests for Currency model """ + + fixtures = [ + 'currency', + ] + + def test_currency(self): + # Simple test for now (improve this later!) + + self.assertEqual(Currency.objects.count(), 2) diff --git a/InvenTree/common/views.py b/InvenTree/common/views.py index 91ea44a218..60f00ef0ef 100644 --- a/InvenTree/common/views.py +++ b/InvenTree/common/views.py @@ -1,3 +1 @@ -from django.shortcuts import render - # Create your views here.