Fix up tests.
This commit is contained in:
parent
779747b1bc
commit
5d4368f603
|
@ -16,7 +16,8 @@ steps:
|
||||||
- pip install --user --cache-dir ./cache/pip -r ./requirements/test.txt
|
- pip install --user --cache-dir ./cache/pip -r ./requirements/test.txt
|
||||||
- python manage.py compilescss
|
- python manage.py compilescss
|
||||||
- python manage.py collectstatic --no-input
|
- python manage.py collectstatic --no-input
|
||||||
- python manage.py test mhackspace --keepdb --verbosity 2
|
- pytest -v
|
||||||
|
# - python manage.py test mhackspace --keepdb --verbosity 2
|
||||||
|
|
||||||
- name: publish-stage
|
- name: publish-stage
|
||||||
pull: True
|
pull: True
|
||||||
|
|
|
@ -23,7 +23,7 @@ from mhackspace.blog.sitemaps import PostSitemap, CategorySitemap
|
||||||
from mhackspace.feeds.views import FeedViewSet, ArticleViewSet
|
from mhackspace.feeds.views import FeedViewSet, ArticleViewSet
|
||||||
from mhackspace.requests.views import RequestsForm, RequestsList, RequestsDetail, RequestsDetailForm
|
from mhackspace.requests.views import RequestsForm, RequestsList, RequestsDetail, RequestsDetailForm
|
||||||
from mhackspace.rfid.views import DeviceViewSet, AuthUserWithDeviceViewSet
|
from mhackspace.rfid.views import DeviceViewSet, AuthUserWithDeviceViewSet
|
||||||
from mhackspace.core.views import ChatView, AboutView
|
from mhackspace.core.views import ChatView, AboutView, StatusView
|
||||||
|
|
||||||
from mhackspace.register.views import RegisterForm
|
from mhackspace.register.views import RegisterForm
|
||||||
from mhackspace.wiki.urls import CustomWikiUrlPatterns
|
from mhackspace.wiki.urls import CustomWikiUrlPatterns
|
||||||
|
@ -49,6 +49,7 @@ sitemaps = {
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', TemplateView.as_view(template_name='pages/home.html'), name='home'),
|
url(r'^$', TemplateView.as_view(template_name='pages/home.html'), name='home'),
|
||||||
|
url(r'^status/$', StatusView.as_view(), name='status'),
|
||||||
url(r'^about/$', AboutView.as_view(template_name='pages/about.html'), name='about'),
|
url(r'^about/$', AboutView.as_view(template_name='pages/about.html'), name='about'),
|
||||||
url(r'^chat/$', ChatView.as_view(template_name='pages/chat.html'), name='chat'),
|
url(r'^chat/$', ChatView.as_view(template_name='pages/chat.html'), name='chat'),
|
||||||
url(r'^mailing-list/$', TemplateView.as_view(template_name='pages/mailing-list.html'), name='group'),
|
url(r'^mailing-list/$', TemplateView.as_view(template_name='pages/mailing-list.html'), name='group'),
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
from mhackspace.users.models import Membership
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ChatView(TemplateView):
|
class ChatView(TemplateView):
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, *args, **kwargs):
|
||||||
context = super().get_context_data(*args, **kwargs)
|
context = super().get_context_data(*args, **kwargs)
|
||||||
|
@ -12,6 +14,17 @@ class ChatView(TemplateView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
class StatusView(TemplateView):
|
||||||
|
template_name = "partials/status.html"
|
||||||
|
|
||||||
|
def get_context_data(self, *args, **kwargs):
|
||||||
|
membership_count = Membership.objects.all().count()
|
||||||
|
context = super().get_context_data(*args, **kwargs)
|
||||||
|
context["members"] = membership_count
|
||||||
|
context["atspace"] = membership_count
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class AboutView(TemplateView):
|
class AboutView(TemplateView):
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, *args, **kwargs):
|
||||||
context = super().get_context_data(*args, **kwargs)
|
context = super().get_context_data(*args, **kwargs)
|
||||||
|
|
|
@ -54,7 +54,7 @@ class gocardless_provider:
|
||||||
customer = self.client.customers.get(mandate.links.customer)
|
customer = self.client.customers.get(mandate.links.customer)
|
||||||
# TODO get the last couple of months not all time payments
|
# TODO get the last couple of months not all time payments
|
||||||
payments = self.client.payments.list(params={"customer": customer.id}).records
|
payments = self.client.payments.list(params={"customer": customer.id}).records
|
||||||
last_payments = None
|
last_payment = None
|
||||||
if len(payments):
|
if len(payments):
|
||||||
last_payment = payments[0].charge_date
|
last_payment = payments[0].charge_date
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ class gocardlessMocks(TestCase):
|
||||||
member = Membership()
|
member = Membership()
|
||||||
member.user = self.user1
|
member.user = self.user1
|
||||||
member.payment = '20.00'
|
member.payment = '20.00'
|
||||||
|
member.payment_date = self.date_now
|
||||||
member.date = self.date_now
|
member.date = self.date_now
|
||||||
member.save()
|
member.save()
|
||||||
return member
|
return member
|
||||||
|
@ -63,9 +64,10 @@ class gocardlessMocks(TestCase):
|
||||||
return_value={'status_code': '200'})
|
return_value={'status_code': '200'})
|
||||||
|
|
||||||
def mock_customer_success_responses(self):
|
def mock_customer_success_responses(self):
|
||||||
ApiCustomersGet = namedtuple('ApiCustomersGet', 'email')
|
ApiCustomersGet = namedtuple('ApiCustomersGet', 'email, id')
|
||||||
self.provider.client.customers.get = Mock(
|
self.provider.client.customers.get = Mock(
|
||||||
return_value=ApiCustomersGet(
|
return_value=ApiCustomersGet(
|
||||||
|
id='1',
|
||||||
email='test@test.com')
|
email='test@test.com')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<div>
|
||||||
|
<div>{{members}}</div>
|
||||||
|
<div>{{atspace}}</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.1.1 on 2019-01-14 19:19
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0013_increased_rfid_length'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='membership',
|
||||||
|
name='has_fob',
|
||||||
|
field=models.BooleanField(default=False, help_text='Member has fob access'),
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in New Issue