utbone
Make templates for faster unit testing.
Bones for
unittesting
.unittesting
already withmock
andddt
.- django testing.
- django testing already with
mock
andddt
.
Install
Following command in your terminal:
pip install utbone
Or install source code and follow this:
python setup.py install
Quick start or how to use
For creating this bone
with name test_views
in mysite/polls/tests
use next command:
utbone mysite/polls/tests test_views django --topping
--topping
here means, that you need ready mock
and ddt
.
Result is next:
"""
Tests for
"""
from ddt import ddt, data, unpack
from mock import patch
from django.test import TestCase
class Test(TestCase):
"""
Tests for
"""
def setUp(self):
"""
Initialize
"""
pass
def test_first(self):
"""
Verify that
"""
self.assertEqual(1, '1')
@patch('')
def test_second(self, mock_):
"""
Assert that
"""
pass
@data(
('first', 'second', 'expected'),
('first', 'second', 'expected'),
)
@unpack
def test_third(self, first, second, expected):
"""
Make sure when
"""
pass
CLI
utbone
is easy to understand: utbone [path to append bone] [name for test] [type of test] -[t]/--[topping].
-t
or --topping
(the same option) is an optional parameter.
Follow this command to call full guide how to use this tool:
utbone --help