added tests
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
90b9fcdde0
commit
21a6eb656c
18
.drone.yml
18
.drone.yml
|
@ -8,8 +8,16 @@ platform:
|
|||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
commands:
|
||||
- dnf install -y python3 python3-pip
|
||||
- pip3 install -U Django
|
||||
- python3 manage.py test
|
||||
- name: install deps
|
||||
commands:
|
||||
- dnf install -y python3 python3-pip
|
||||
- pip3 install -U Django coverage flake8 pylint django-coverage-plugin pylint-django
|
||||
- name: run unittests
|
||||
commands:
|
||||
- coverage run --source='.' manage.py test --noinput --parallel
|
||||
- name: run flake8
|
||||
commands:
|
||||
- flake8
|
||||
- name: run pylint
|
||||
commands:
|
||||
- pylint --rcfile=.pylintrc -- **/*.py
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
[MASTER]
|
||||
load-plugins=pylint_django
|
||||
|
||||
[FORMAT]
|
||||
max-line-length=120
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=missing-docstring,invalid-name
|
||||
|
||||
[DESIGN]
|
||||
max-parents=13
|
||||
|
||||
[TYPECHECK]
|
||||
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete
|
|
@ -38,6 +38,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'inventory.apps.InventoryConfig',
|
||||
'linttest',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -100,6 +101,10 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
},
|
||||
]
|
||||
|
||||
# enabling this may speed up testing
|
||||
#PASSWORD_HASHERS = [
|
||||
# 'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||
#]
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.1/topics/i18n/
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
from django.test import TestCase
|
||||
from django.test import Client
|
||||
|
||||
# Create your tests here.
|
||||
from inventory.models import PantryItem, Category
|
||||
|
||||
|
||||
class PantryItemTestCase(TestCase):
|
||||
""" simple test case for a model"""
|
||||
def setUp(self):
|
||||
cat = Category.objects.create(name="UNCATEGORIZED")
|
||||
PantryItem.objects.create(name="testitem", category=cat)
|
||||
|
||||
def test_pantryitem_looksok(self):
|
||||
"""Pantryitems to string is ok"""
|
||||
testitem = PantryItem.objects.get(name="testitem")
|
||||
self.assertEqual(str(testitem), 'testitem')
|
||||
|
||||
|
||||
class InterFaceTestCase(TestCase):
|
||||
"""Simple test case for the web interface"""
|
||||
|
||||
def test_consume_view_exists(self):
|
||||
c = Client()
|
||||
response = c.get('/consume/')
|
||||
self.assertTrue("TODO" not in response)
|
||||
|
|
Loading…
Reference in New Issue