From b2e30d34d3ddcf5fd3c01bb9fc0c7a7d858baff2 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Sun, 19 Feb 2017 12:10:04 -0600 Subject: [PATCH] Add build visit (#36) * Add build sign-in option. * Test can signin in with build. * Add build option. --- .../assets/js/components/Purpose.jsx | 1 + .../migrations/0003_auto_20170219_1741.py | 20 +++++++++++++++++++ bikeshop_project/core/models.py | 4 +++- .../registration/tests/test_views.py | 11 ++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 bikeshop_project/core/migrations/0003_auto_20170219_1741.py diff --git a/bikeshop_project/assets/js/components/Purpose.jsx b/bikeshop_project/assets/js/components/Purpose.jsx index 040291e..776d93e 100644 --- a/bikeshop_project/assets/js/components/Purpose.jsx +++ b/bikeshop_project/assets/js/components/Purpose.jsx @@ -10,6 +10,7 @@ const Purpose = ({ initialValue, handleChange }) => ( > + diff --git a/bikeshop_project/core/migrations/0003_auto_20170219_1741.py b/bikeshop_project/core/migrations/0003_auto_20170219_1741.py new file mode 100644 index 0000000..97f84bd --- /dev/null +++ b/bikeshop_project/core/migrations/0003_auto_20170219_1741.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.4 on 2017-02-19 17:41 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_auto_20170101_2054'), + ] + + operations = [ + migrations.AlterField( + model_name='visit', + name='purpose', + field=models.CharField(choices=[('VOLUNTEER', 'volunteer'), ('FIX', 'fix bike'), ('BUILD', 'build bike'), ('WORKSHOP', 'workshop'), ('VISIT', 'visit'), ('DONATE', 'donate'), ('STAFF', 'staff')], max_length=50), + ), + ] diff --git a/bikeshop_project/core/models.py b/bikeshop_project/core/models.py index 042f07f..c1efc75 100644 --- a/bikeshop_project/core/models.py +++ b/bikeshop_project/core/models.py @@ -49,6 +49,7 @@ class Payment(models.Model): class Visit(models.Model): VOLUNTEER = 'VOLUNTEER' FIX = 'FIX' + BUILD = 'BUILD' WORKSHOP = 'WORKSHOP' VISIT = 'VISIT' DONATE = 'DONATE' @@ -56,7 +57,8 @@ class Visit(models.Model): visit_choices = ( (VOLUNTEER, 'volunteer'), - (FIX, 'fix bike'), # fix + (FIX, 'fix bike'), + (BUILD, 'build bike'), (WORKSHOP, 'workshop'), (VISIT, 'visit'), (DONATE, 'donate'), diff --git a/bikeshop_project/registration/tests/test_views.py b/bikeshop_project/registration/tests/test_views.py index be2678c..5b15d96 100644 --- a/bikeshop_project/registration/tests/test_views.py +++ b/bikeshop_project/registration/tests/test_views.py @@ -143,3 +143,14 @@ class TestMemberSignIn(TestCase): self.assertTrue(len(data), 3) self.assertTrue('banned' in data[0]['member']) self.assertTrue('suspended' in data[0]['member']) + + def test_signin_visit(self): + """ + Sign-in with 'BUILD' works. + """ + url = reverse('member_signin') + c = Client() + c.force_login(self.user) + + response = c.post(url, data={'id': self.members[0].id, 'purpose': 'BUILD'}) + self.assertEqual(response.status_code, 201)