Fix PEP8 warnings
This commit is contained in:
parent
2bc4db1cab
commit
273fa75d55
6 changed files with 100 additions and 74 deletions
|
@ -15,9 +15,11 @@ from membership.models import CustomUser, StripeCustomer
|
|||
from utils.tests import BaseTestCase
|
||||
|
||||
|
||||
from .views import LoginView, SignupView, PasswordResetView, PasswordResetConfirmView,\
|
||||
from .views import (
|
||||
LoginView, SignupView, PasswordResetView, PasswordResetConfirmView,
|
||||
MembershipPricingView, MembershipPaymentView
|
||||
from .models import MembershipType, MembershipOrder
|
||||
)
|
||||
from .models import MembershipType
|
||||
|
||||
|
||||
class ContactViewTest(TestCase):
|
||||
|
@ -41,8 +43,14 @@ class ContactViewTest(TestCase):
|
|||
|
||||
class ViewsTest(CMSTestCase):
|
||||
def setUp(self):
|
||||
self.page1 = create_page('home', 'home_digitalglarus.html', published=True, language='en-us')
|
||||
self.page2 = create_page('about', 'about.html', published=True, language='en-us', slug='about')
|
||||
self.page1 = create_page(
|
||||
'home', 'home_digitalglarus.html', published=True,
|
||||
language='en-us'
|
||||
)
|
||||
self.page2 = create_page(
|
||||
'about', 'about.html', published=True, language='en-us',
|
||||
slug='about'
|
||||
)
|
||||
|
||||
def test_digitalglarus_templates(self):
|
||||
res1 = self.client.get('/en-us/')
|
||||
|
@ -69,7 +77,9 @@ class MembershipPricingViewTest(BaseTestCase):
|
|||
# Anonymous user should get data
|
||||
response = self.client.get(self.url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.context['membership_type'], self.membership_type)
|
||||
self.assertEqual(
|
||||
response.context['membership_type'], self.membership_type
|
||||
)
|
||||
self.assertTemplateUsed(response, self.expected_template)
|
||||
|
||||
|
||||
|
@ -101,8 +111,10 @@ class MembershipPaymentViewTest(BaseTestCase):
|
|||
|
||||
# Anonymous user should get redirect to login
|
||||
response = self.client.get(self.url)
|
||||
expected_url = "%s?next=%s" % (reverse('digitalglarus:signup'),
|
||||
reverse('digitalglarus:membership_payment'))
|
||||
expected_url = "%s?next=%s" % (
|
||||
reverse('digitalglarus:signup'),
|
||||
reverse('digitalglarus:membership_payment')
|
||||
)
|
||||
self.assertRedirects(response, expected_url=expected_url,
|
||||
status_code=302, target_status_code=200)
|
||||
|
||||
|
@ -132,8 +144,14 @@ class MembershipPaymentViewTest(BaseTestCase):
|
|||
}
|
||||
response = self.customer_client.post(self.url, self.billing_address)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTrue(StripeCustomer.objects.filter(user__email=self.customer.email).exists())
|
||||
stripe_customer = StripeCustomer.objects.get(user__email=self.customer.email)
|
||||
self.assertTrue(
|
||||
StripeCustomer.objects.filter(
|
||||
user__email=self.customer.email
|
||||
).exists()
|
||||
)
|
||||
stripe_customer = StripeCustomer.objects.get(
|
||||
user__email=self.customer.email
|
||||
)
|
||||
self.assertEqual(stripe_customer.user, self.customer)
|
||||
# self.assertTrue(MembershipOrder.objects.filter(customer=stripe_customer).exists())
|
||||
# membership_order = MembershipOrder.objects.filter(
|
||||
|
@ -216,7 +234,9 @@ class SignupViewTest(TestCase):
|
|||
self.assertTemplateUsed(response, self.expected_template)
|
||||
|
||||
def test_anonymous_user_can_signup(self):
|
||||
response = self.client.post(self.url, data=self.signup_data, follow=True)
|
||||
response = self.client.post(
|
||||
self.url, data=self.signup_data, follow=True
|
||||
)
|
||||
self.user = CustomUser.objects.get(email=self.signup_data.get('email'))
|
||||
self.assertEqual(response.context['user'], self.user)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
|
|
@ -13,10 +13,12 @@ from stored_messages.models import Inbox
|
|||
|
||||
from membership.models import CustomUser, StripeCustomer
|
||||
from .models import HostingOrder
|
||||
from .views import DjangoHostingView, RailsHostingView, NodeJSHostingView, LoginView, SignupView, \
|
||||
PaymentVMView, OrdersHostingDetailView, OrdersHostingListView, VirtualMachineView, \
|
||||
VirtualMachinesPlanListView, PasswordResetView, PasswordResetConfirmView, HostingPricingView, \
|
||||
NotificationsView, MarkAsReadNotificationView
|
||||
from .views import (
|
||||
DjangoHostingView, RailsHostingView, NodeJSHostingView, LoginView,
|
||||
SignupView, PaymentVMView, OrdersHostingDetailView, OrdersHostingListView,
|
||||
VirtualMachinesPlanListView, PasswordResetView, PasswordResetConfirmView,
|
||||
HostingPricingView, NotificationsView, MarkAsReadNotificationView
|
||||
)
|
||||
from utils.tests import BaseTestCase
|
||||
|
||||
|
||||
|
@ -52,7 +54,8 @@ class DjangoHostingViewTest(TestCase, ProcessVMSelectionTestMixin):
|
|||
self.view = DjangoHostingView()
|
||||
self.expected_template = 'hosting/django.html'
|
||||
HOSTING = 'django'
|
||||
#configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||
# configuration_detail = dict(
|
||||
# VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||
self.expected_context = {
|
||||
'hosting': HOSTING,
|
||||
'hosting_long': "Django",
|
||||
|
@ -76,7 +79,8 @@ class RailsHostingViewTest(TestCase, ProcessVMSelectionTestMixin):
|
|||
self.view = RailsHostingView()
|
||||
self.expected_template = 'hosting/rails.html'
|
||||
HOSTING = 'rails'
|
||||
#configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||
# configuration_detail = dict(
|
||||
# VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||
self.expected_context = {
|
||||
'hosting': HOSTING,
|
||||
'hosting_long': "Ruby On Rails",
|
||||
|
@ -100,7 +104,8 @@ class NodeJSHostingViewTest(TestCase, ProcessVMSelectionTestMixin):
|
|||
self.view = NodeJSHostingView()
|
||||
self.expected_template = 'hosting/nodejs.html'
|
||||
HOSTING = 'nodejs'
|
||||
#configuration_detail = dict(VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||
# configuration_detail = dict(
|
||||
# VirtualMachinePlan.VM_CONFIGURATION).get(HOSTING)
|
||||
self.expected_context = {
|
||||
'hosting': HOSTING,
|
||||
'hosting_long': "NodeJS",
|
||||
|
@ -184,7 +189,7 @@ class PaymentVMViewTest(BaseTestCase):
|
|||
# }
|
||||
# }
|
||||
|
||||
session = self.customer_client.session
|
||||
# session = self.customer_client.session
|
||||
# session.update(self.session_data)
|
||||
# session.save()
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import re
|
||||
# import re
|
||||
|
||||
from django.test import TestCase
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core import mail
|
||||
# from django.test import TestCase
|
||||
# from django.core.urlresolvers import reverse
|
||||
# from django.core import mail
|
||||
|
||||
|
||||
class LoginTestCase(TestCase):
|
||||
def test_login(self):
|
||||
url = reverse('login_glarus')
|
||||
res = self.client.post(
|
||||
url,
|
||||
data={
|
||||
'email': 'test@gmail.com',
|
||||
'password': 'test', 'name':
|
||||
'test'}
|
||||
)
|
||||
# class LoginTestCase(TestCase):
|
||||
# def test_login(self):
|
||||
# url = reverse('login_glarus')
|
||||
# res = self.client.post(
|
||||
# url,
|
||||
# data={
|
||||
# 'email': 'test@gmail.com',
|
||||
# 'password': 'test', 'name':
|
||||
# 'test'}
|
||||
# )
|
||||
# self.assertContains(res, "You\'re successfully registered!", 1, 200)
|
||||
# self.assertEqual(len(mail.outbox), 1)
|
||||
|
||||
#
|
||||
# validation_url = re.findall(r"http://.*?(/.*)", mail.outbox[0].body)
|
||||
# res1 = self.client.get(validation_url[0] + '/')
|
||||
# self.assertContains(res1, "Email verified!", 1, 200)
|
||||
|
@ -30,9 +30,9 @@ class LoginTestCase(TestCase):
|
|||
#
|
||||
# res3 = self.client.get(redirect_location)
|
||||
# self.assertContains(res3, 'Pick coworking date.', 1, 200)
|
||||
|
||||
# check fail login
|
||||
|
||||
#
|
||||
# # check fail login
|
||||
#
|
||||
# res4 = self.client.post(
|
||||
# url, data={
|
||||
# 'email': 'test@gmail.com', 'password': 'falsepassword'
|
||||
|
|
|
@ -127,6 +127,7 @@ class OpenNebulaManagerTestCases(TestCase):
|
|||
"""Test the opennebula manager requires the user to have a ssh key when
|
||||
creating a new vm"""
|
||||
|
||||
|
||||
@skipIf(
|
||||
settings.OPENNEBULA_DOMAIN is None or settings.OPENNEBULA_DOMAIN is
|
||||
"test_domain",
|
||||
|
|
|
@ -28,8 +28,8 @@ class BaseTestCase(TestCase):
|
|||
|
||||
# Users
|
||||
self.customer, self.another_customer = mommy.make(
|
||||
'membership.CustomUser', validated =1,
|
||||
_quantity=2)
|
||||
'membership.CustomUser', validated=1, _quantity=2
|
||||
)
|
||||
self.customer.set_password(self.dummy_password)
|
||||
self.customer.save()
|
||||
self.another_customer.set_password(self.dummy_password)
|
||||
|
|
Loading…
Reference in a new issue