mirror of https://github.com/snachodog/mybuddy.git
Add "both breasts" option for Feeding method (#52).
This commit is contained in:
parent
a80662c4b1
commit
0261f39864
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2 on 2019-05-02 17:01
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0005_auto_20190416_2048'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='feeding',
|
||||||
|
name='method',
|
||||||
|
field=models.CharField(choices=[('bottle', 'Bottle'), ('left breast', 'Left breast'), ('right breast', 'Right breast'), ('both breasts', 'Both breasts')], max_length=255, verbose_name='Method'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -203,6 +203,7 @@ class Feeding(models.Model):
|
||||||
('bottle', _('Bottle')),
|
('bottle', _('Bottle')),
|
||||||
('left breast', _('Left breast')),
|
('left breast', _('Left breast')),
|
||||||
('right breast', _('Right breast')),
|
('right breast', _('Right breast')),
|
||||||
|
('both breasts', _('Both breasts')),
|
||||||
],
|
],
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_('Method')
|
verbose_name=_('Method')
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DiaperChangeTestCase(TestCase):
|
||||||
self.change.attributes(), ['wet', 'solid', 'black'])
|
self.change.attributes(), ['wet', 'solid', 'black'])
|
||||||
|
|
||||||
|
|
||||||
class FeedingChangeTestCase(TestCase):
|
class FeedingTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
call_command('migrate', verbosity=0)
|
call_command('migrate', verbosity=0)
|
||||||
self.child = models.Child.objects.create(
|
self.child = models.Child.objects.create(
|
||||||
|
@ -71,6 +71,18 @@ class FeedingChangeTestCase(TestCase):
|
||||||
self.assertEqual(str(feeding), 'Feeding')
|
self.assertEqual(str(feeding), 'Feeding')
|
||||||
self.assertEqual(feeding.duration, feeding.end - feeding.start)
|
self.assertEqual(feeding.duration, feeding.end - feeding.start)
|
||||||
|
|
||||||
|
def test_method_both_breasts(self):
|
||||||
|
feeding = models.Feeding.objects.create(
|
||||||
|
child=self.child,
|
||||||
|
start=timezone.localtime() - timezone.timedelta(minutes=30),
|
||||||
|
end=timezone.localtime(),
|
||||||
|
type='breast milk',
|
||||||
|
method='both breasts'
|
||||||
|
)
|
||||||
|
self.assertEqual(feeding, models.Feeding.objects.first())
|
||||||
|
self.assertEqual(str(feeding), 'Feeding')
|
||||||
|
self.assertEqual(feeding.method, 'both breasts')
|
||||||
|
|
||||||
|
|
||||||
class NoteTestCase(TestCase):
|
class NoteTestCase(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
Loading…
Reference in New Issue