Skip to content

Commit

Permalink
Merge pull request PyAr#169 from PyAr/free-those-deps
Browse files Browse the repository at this point in the history
Changed the reqs.txt
  • Loading branch information
facundobatista authored Mar 16, 2020
2 parents 7a7dc41 + a40843c commit b0856ae
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 44 deletions.
29 changes: 13 additions & 16 deletions config/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
certg==4.2
django-configurations==2.0
django-crispy-forms==1.7.2
django-extensions==2.0.7
django-reversion-compare==0.8.6
django-reversion==3.0.3
django-storages[azure]==1.8
django==2.0.12
django-configurations==2.2
django-crispy-forms==1.9.0
django-extensions==2.2.8
django-reversion-compare==0.12.0
django-storages[azure]==1.9.1
django==2.2.11
google-api-python-client-py3==1.2
gunicorn==19.8.0
httplib2==0.12.3
mercadopago==0.3.4
gunicorn==20.0.4
mercadopago==1.1.1
oauth2client==4.1.3
Pillow==6.2.0
psycopg2_binary==2.7.4
python-stdnum==1.12
python-dateutil==2.7.2
rapidtables==0.1.7
sentry-sdk==0.8.0
Pillow==7.0.0
psycopg2_binary==2.8.4
python-stdnum==1.13
rapidtables==0.1.11
sentry-sdk==0.14.2
3 changes: 3 additions & 0 deletions website/events/helpers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,6 @@ def assertContainsMessage(self, response, message_text):
compare_messages = ((message == message_text) for message in messages)
self.assertTrue(any(compare_messages),
_(f"Mensaje: '{message_text}' no encontrado en la lista de mensajes."))

def assertForbidden(self, response):
self.assertEqual(response.status_code, 403)
4 changes: 2 additions & 2 deletions website/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import stdnum
import reversion

from stdnum.exceptions import InvalidChecksum, InvalidLength, InvalidFormat
from stdnum.exceptions import InvalidChecksum, InvalidLength, InvalidFormat, InvalidComponent
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
Expand Down Expand Up @@ -43,7 +43,7 @@ def validate_cuit(cuit_to_validate):
try:
validator = stdnum.get_cc_module('ar', 'cuit')
return validator.validate(cuit_to_validate)
except (InvalidChecksum, InvalidFormat):
except (InvalidChecksum, InvalidFormat, InvalidComponent):
raise ValidationError(
_('El CUIT ingresado no es correcto')
)
Expand Down
35 changes: 9 additions & 26 deletions website/events/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,7 @@ def test_organizer_cant_set_sponsors_enabled(self):
url = reverse('sponsor_set_enabled', kwargs={'pk': sponsor.pk})
self.client.login(username='organizer01', password='organizer01')
response = self.client.post(url)
redirect_to_login_url = reverse('login') + '?next=' + url
self.assertRedirects(response, redirect_to_login_url)
self.assertForbidden(response)

def test_can_set_sponsors_enabled_with_perms(self):
sponsor = Sponsor.objects.create(**sponsor_data)
Expand Down Expand Up @@ -641,8 +640,7 @@ def test_organizer_cant_close_sponsoring(self):
url = reverse('sponsoring_set_close', kwargs={'pk': sponsoring.pk})
self.client.login(username='organizer01', password='organizer01')
response = self.client.post(url)
redirect_to_login_url = reverse('login') + '?next=' + url
self.assertRedirects(response, redirect_to_login_url)
self.assertForbidden(response)

def test_super_organizer_can_close_sponsoring(self):
# Test 'close' state from 'unbilled'.
Expand All @@ -666,8 +664,7 @@ def test_organizer_cant_set_complete_payment(self):
url = reverse('invoice_set_complete_payment', kwargs={'pk': invoice.pk})
self.client.login(username='organizer01', password='organizer01')
response = self.client.post(url)
redirect_to_login_url = reverse('login') + '?next=' + url
self.assertRedirects(response, redirect_to_login_url)
self.assertForbidden(response)

def test_super_organizer_can_set_complete_payment(self):
invoice = create_sponsoring_invoice(auto_create_sponsoring_and_sponsor=True)
Expand All @@ -690,8 +687,7 @@ def test_organizer_cant_set_partial_payment(self):
url = reverse('invoice_set_partial_payment', kwargs={'pk': invoice.pk})
self.client.login(username='organizer01', password='organizer01')
response = self.client.post(url)
redirect_to_login_url = reverse('login') + '?next=' + url
self.assertRedirects(response, redirect_to_login_url)
self.assertForbidden(response)

def test_super_organizer_can_set_partial_payment(self):
invoice = create_sponsoring_invoice(auto_create_sponsoring_and_sponsor=True)
Expand Down Expand Up @@ -729,8 +725,7 @@ def test_organizer_cant_add_invoice(self):
'document': StringIO('test'),
}
response = self.client.post(url, data)
redirect_to_login_url = reverse('login') + '?next=' + url
self.assertRedirects(response, redirect_to_login_url)
self.assertForbidden(response)

@patch('django.core.files.storage.FileSystemStorage.save')
def test_super_user_can_add_invoice(self, mock_save):
Expand Down Expand Up @@ -912,7 +907,7 @@ def test_can_create_provider_with_perms(self):
self.assertEqual(Provider.objects.all().count(), providers_count + 1)
self.assertEqual(response.status_code, 302)

def test_create_provider_redirects_without_perms(self):
def test_create_provider_forbidden_without_perms(self):
url = reverse('provider_create')
perm = Permission.objects.get(
content_type__app_label='events',
Expand All @@ -921,13 +916,7 @@ def test_create_provider_redirects_without_perms(self):
user.user_permissions.remove(perm)
self.client.login(username='organizer01', password='organizer01')
response = self.client.post(url, data=provider_data)

# View redirect.
self.assertEqual(response.status_code, 302)

# And redirect to login.
redirect_to_login_url = reverse('login') + '?next=' + reverse('provider_create')
self.assertEqual(response.url, redirect_to_login_url)
self.assertForbidden(response)


class ProviderExpenseViewsTest(TestCase, CustomAssertMethods):
Expand Down Expand Up @@ -968,7 +957,7 @@ def test_can_create_provider_expense_with_perms(self, mock_save):
self.assertEqual(ProviderExpense.objects.all().count(), provider_expense_count + 1)
self.assertEqual(response.status_code, 302)

def test_create_provider_expense_redirects_without_perms(self):
def test_create_provider_expense_forbidden_without_perms(self):
url = reverse(
'provider_expense_create',
kwargs={'event_pk': Event.objects.filter(name='MyTest01').first().pk}
Expand All @@ -989,13 +978,7 @@ def test_create_provider_expense_redirects_without_perms(self):
user.user_permissions.remove(perm)
self.client.login(username='organizer01', password='organizer01')
response = self.client.post(url, data=provider_expense_data)

# View redirect.
self.assertEqual(response.status_code, 302)

# And redirect to login.
redirect_to_login_url = reverse('login') + '?next=' + url
self.assertEqual(response.url, redirect_to_login_url)
self.assertForbidden(response)


class ProviderExpenseSwitchStateTest(TestCase, CustomAssertMethods):
Expand Down

0 comments on commit b0856ae

Please sign in to comment.