Skip to content

Commit

Permalink
Merge pull request #133 from rebkwok/upgrade
Browse files Browse the repository at this point in the history
Upgrade all the other things
  • Loading branch information
rebkwok authored Aug 16, 2024
2 parents 2a45783 + 5596cfc commit 34d9f24
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 81 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ jobs:
pytest --cov-config=.coveragerc --cov=. -k 'serial'
pytest --cov-config=.coveragerc --cov=. --cov-append -n auto -k 'not serial'
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run coverage
run: |
source ${{ github.workspace }}/venv/bin/activate
coverage report
# - name: Coveralls
# uses: AndreMiras/coveralls-python-action@develop
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 4 additions & 5 deletions accounts/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ class AccountBanAdminTests(TestCase):
def test_currently_banned_filter(self):
current = baker.make(AccountBan, end_date=timezone.now() + timedelta(2))
past = baker.make(AccountBan, end_date=timezone.now() - timedelta(2))

filter = CurrentlyBannedListFilter(
None, {'currently_banned': 'currently_banned'}, AccountBan, AccountBanAdmin
None, {'currently_banned': ['currently_banned']}, AccountBan, AccountBanAdmin
)
assert filter.queryset(None, AccountBan.objects.all()).count() == 1
ban = filter.queryset(None, AccountBan.objects.all())[0]
assert ban.id == current.id

filter = CurrentlyBannedListFilter(
None, {'currently_banned': 'previously_banned'}, AccountBan, AccountBanAdmin
None, {'currently_banned': ['previously_banned']}, AccountBan, AccountBanAdmin
)
assert filter.queryset(None, AccountBan.objects.all()).count() == 1
ban = filter.queryset(None, AccountBan.objects.all())[0]
Expand Down Expand Up @@ -59,14 +58,14 @@ def test_currently_banned_filter(self):
baker.make(AccountBan, user=user1, end_date=timezone.now() - timedelta(2))

filter = CurrentlyBannedUserListFilter(
None, {'currently_banned': 'currently_banned'}, User, CustomUserAdmin
None, {'currently_banned': ['currently_banned']}, User, CustomUserAdmin
)
assert filter.queryset(None, User.objects.all()).count() == 1
user = filter.queryset(None, User.objects.all())[0]
assert user.id == user.id

filter = CurrentlyBannedUserListFilter(
None, {'currently_banned': 'not_banned'}, User, CustomUserAdmin
None, {'currently_banned': ['not_banned']}, User, CustomUserAdmin
)
assert filter.queryset(None, User.objects.all()).count() == 2
past_banned_user = filter.queryset(None, User.objects.all())[0]
Expand Down
2 changes: 1 addition & 1 deletion accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def form_valid(self, form):
disclaimer = form.save(commit=False)
disclaimer.version = form.disclaimer_content.version
email = disclaimer.email
host = 'https://{}'.format(self.request.META.get('HTTP_HOST'))
host = 'https://{}'.format(self.request.get_host())
ctx = {
'host': host,
'contact_email': settings.DEFAULT_STUDIO_EMAIL
Expand Down
20 changes: 10 additions & 10 deletions booking/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def test_event_date_list_filter(self):
future_event = baker.make_recipe('booking.future_EV', name='future')

filter = admin.EventDateListFilter(
None, {'date': 'past'}, Event, admin.EventAdmin
None, {'date': ['past']}, Event, admin.EventAdmin
)
event = filter.queryset(None, Event.objects.all())[0]
self.assertEqual(event.name, 'past')

filter = admin.EventDateListFilter(
None, {'date': 'upcoming'}, Event, admin.EventAdmin
None, {'date': ['upcoming']}, Event, admin.EventAdmin
)
event = filter.queryset(None, Event.objects.all())[0]
self.assertEqual(event.name, 'future')
Expand All @@ -42,15 +42,15 @@ def test_event_type_list_filter(self):
pclass = baker.make_recipe('booking.future_PC', name='pole class')

filter = admin.EventTypeListFilter(
None, {'type': 'class'}, Event, admin.EventAdmin
None, {'type': ['class']}, Event, admin.EventAdmin
)

result = filter.queryset(None, Event.objects.all())
self.assertEqual(result.count(), 1)
self.assertEqual(result[0].name, 'pole class')

filter = admin.EventTypeListFilter(
None, {'type': 'event'}, Event, admin.EventAdmin
None, {'type': ['event']}, Event, admin.EventAdmin
)

result = filter.queryset(None, Event.objects.all())
Expand Down Expand Up @@ -87,13 +87,13 @@ def test_booking_date_list_filter(self):
baker.make_recipe('booking.booking', user=self.user, event=future_event)

filter = admin.BookingDateListFilter(
None, {'event__date': 'past'}, Booking, admin.BookingAdmin
None, {'event__date': ['past']}, Booking, admin.BookingAdmin
)
booking = filter.queryset(None, Booking.objects.all())[0]
self.assertEqual(booking.event.name, 'past')

filter = admin.BookingDateListFilter(
None, {'event__date': 'upcoming'}, Booking, admin.BookingAdmin
None, {'event__date': ['upcoming']}, Booking, admin.BookingAdmin
)
booking = filter.queryset(None, Booking.objects.all())[0]
self.assertEqual(booking.event.name, 'future')
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_paypal_booking_user_filter(self):
)

userfilter = admin.UserFilter(
None, {'user': self.user.id}, Booking, admin.BookingAdmin
None, {'user': [self.user.id]}, Booking, admin.BookingAdmin
)
result = userfilter.queryset(None, Booking.objects.all())
self.assertEqual(result.count(), 5)
Expand Down Expand Up @@ -242,15 +242,15 @@ def test_block_list_filter(self):
baker.make_recipe('booking.booking', block=full_block, _quantity=5)

filter = admin.BlockFilter(
None, {'status': 'active'}, Block, admin.BlockAdmin
None, {'status': ['active']}, Block, admin.BlockAdmin
)
block_qset = filter.queryset(None, Block.objects.all())
self.assertEqual(block_qset.count(), 1)
block = block_qset[0]
self.assertEqual(block.id, paid_block.id)

filter = admin.BlockFilter(
None, {'status': 'inactive'}, Block, admin.BlockAdmin
None, {'status': ['inactive']}, Block, admin.BlockAdmin
)
block_qset = filter.queryset(None, Block.objects.all())
self.assertEqual(block_qset.count(), 3)
Expand All @@ -261,7 +261,7 @@ def test_block_list_filter(self):
)

filter = admin.BlockFilter(
None, {'status': 'unpaid'}, Block, admin.BlockAdmin
None, {'status': ['unpaid']}, Block, admin.BlockAdmin
)
block_qset = filter.queryset(None, Block.objects.all())
self.assertEqual(block_qset.count(), 1)
Expand Down
2 changes: 1 addition & 1 deletion booking/views/block_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def form_valid(self, form):
)
)

host = 'http://{}'.format(self.request.META.get('HTTP_HOST'))
host = 'http://{}'.format(self.request.get_host())
# send email to user
ctx = {
'host': host,
Expand Down
10 changes: 5 additions & 5 deletions booking/views/booking_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def form_valid(self, form):
if booking.block:
# send email to user if they used block to book (paypal payment
# sends separate emails
host = 'http://{}'.format(self.request.META.get('HTTP_HOST'))
host = 'http://{}'.format(self.request.get_host())
if booking.event.event_type.event_type == 'EV':
ev_type = 'event'
elif booking.event.event_type.event_type == 'CL':
Expand Down Expand Up @@ -366,7 +366,7 @@ def _email_free_class_request(request, booking, booking_status):
booking.block = None

# send email and set messages
host = 'http://{}'.format(request.META.get('HTTP_HOST'))
host = 'http://{}'.format(request.get_host())
# send email to studio
ctx = {
'host': host,
Expand Down Expand Up @@ -452,7 +452,7 @@ def form_valid(self, _form):
# Check here so we can adjust the email message
block_or_membership_booked_within_allowed_time = self._block_or_membership_booked_within_allowed_time(booking)

host = 'http://{}'.format(self.request.META.get('HTTP_HOST'))
host = 'http://{}'.format(self.request.get_host())

# email if this isn't an unpaid/non-rebooked booking
# send email to user
Expand Down Expand Up @@ -650,7 +650,7 @@ def form_valid(self, _form):
send_waiting_list_email(
event,
[wluser.user for wluser in waiting_list_users],
host='http://{}'.format(self.request.META.get('HTTP_HOST'))
host='http://{}'.format(self.request.get_host())
)
ActivityLog.objects.create(
log='Waiting list email sent to user(s) {} for '
Expand Down Expand Up @@ -917,7 +917,7 @@ def assign_block(booking):
booking.event, booking.user.username)
)

host = 'http://{}'.format(request.META.get('HTTP_HOST'))
host = 'http://{}'.format(request.get_host())

# send email to user ONLY IF PAID
# If it's unpaid, they'll get the email with payment/update
Expand Down
2 changes: 1 addition & 1 deletion booking/views/shopping_basket_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def update_block_bookings(request):
messages.info(request, "Blocks used for {} bookings".format(len(block_booked)))

# send email to user
host = 'http://{}'.format(request.META.get('HTTP_HOST'))
host = 'http://{}'.format(request.get_host())
ctx = {
'host': host,
'bookings': block_booked,
Expand Down
4 changes: 2 additions & 2 deletions booking/views/ticketed_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def post(self, request, *args, **kwargs):
)
)

host = 'http://{}'.format(request.META.get('HTTP_HOST'))
host = 'http://{}'.format(request.get_host())
ctx = {
'host': host,
'ticketed_event': self.ticketed_event,
Expand Down Expand Up @@ -516,7 +516,7 @@ def form_valid(self, form):

try:
# send email and set messages
host = 'http://{}'.format(self.request.META.get('HTTP_HOST'))
host = 'http://{}'.format(self.request.get_host())
# send email to user; no need to send to studio as cancelled
# before payment
ctx = {
Expand Down
18 changes: 9 additions & 9 deletions payments/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def test_paypal_booking_user_filter(self):
)

userfilter = admin.PaypalBookingUserFilter(
None, {'user': self.user.id}, PaypalBookingTransaction,
None, {'user': [self.user.id]}, PaypalBookingTransaction,
admin.PaypalBookingTransactionAdmin
)
result = userfilter.queryset(
Expand Down Expand Up @@ -363,7 +363,7 @@ def test_paypal_ticket_booking_user_filter(self):
)

userfilter = admin.PaypalTicketBookingUserFilter(
None, {'user': self.user.id}, PaypalTicketBookingTransaction,
None, {'user': [self.user.id]}, PaypalTicketBookingTransaction,
admin.PaypalTicketBookingTransactionAdmin
)
result = userfilter.queryset(
Expand Down Expand Up @@ -399,7 +399,7 @@ def test_paypal_block_user_filter(self):
)

userfilter = admin.PaypalBlockUserFilter(
None, {'user': self.user.id}, PaypalBlockTransaction,
None, {'user': [self.user.id]}, PaypalBlockTransaction,
admin.PaypalBlockTransactionAdmin
)
result = userfilter.queryset(
Expand Down Expand Up @@ -444,7 +444,7 @@ def test_paypal_booking_check_filter_queryset(self):
self.assertEqual(result.count(), 10)

bk_check_filter = admin.PaypalBookingCheckFilter(
None, {'unpaid_with_txn': 'all'}, PaypalBookingTransaction,
None, {'unpaid_with_txn': ['all']}, PaypalBookingTransaction,
admin.PaypalBookingTransactionAdmin
)
result = bk_check_filter.queryset(
Expand Down Expand Up @@ -498,7 +498,7 @@ def test_paypal_booking_check_filter_queryset(self):
unpaid_autocancelled_with_txn, unpaid_no_show_with_txn
]
bk_check_filter = admin.PaypalBookingCheckFilter(
None, {'unpaid_with_txn': 'all'}, PaypalBookingTransaction,
None, {'unpaid_with_txn': ['all']}, PaypalBookingTransaction,
admin.PaypalBookingTransactionAdmin
)
result = bk_check_filter.queryset(
Expand All @@ -511,7 +511,7 @@ def test_paypal_booking_check_filter_queryset(self):
)

bk_check_filter = admin.PaypalBookingCheckFilter(
None, {'unpaid_with_txn': 'open'}, PaypalBookingTransaction,
None, {'unpaid_with_txn': ['open']}, PaypalBookingTransaction,
admin.PaypalBookingTransactionAdmin
)
result = bk_check_filter.queryset(
Expand All @@ -526,7 +526,7 @@ def test_paypal_booking_check_filter_queryset(self):
]

bk_check_filter = admin.PaypalBookingCheckFilter(
None, {'unpaid_with_txn': 'cancelled'}, PaypalBookingTransaction,
None, {'unpaid_with_txn': ['cancelled']}, PaypalBookingTransaction,
admin.PaypalBookingTransactionAdmin
)
result = bk_check_filter.queryset(
Expand All @@ -539,7 +539,7 @@ def test_paypal_booking_check_filter_queryset(self):
)

bk_check_filter = admin.PaypalBookingCheckFilter(
None, {'unpaid_with_txn': 'autocancelled'}, PaypalBookingTransaction,
None, {'unpaid_with_txn': ['autocancelled']}, PaypalBookingTransaction,
admin.PaypalBookingTransactionAdmin
)
result = bk_check_filter.queryset(
Expand Down Expand Up @@ -569,7 +569,7 @@ def test_paypal_block_check_filter_queryset(self):
self.assertEqual(result.count(), 10)

block_check_filter = admin.PaypalBlockCheckFilter(
None, {'unpaid_with_txn': 'yes'}, PaypalBlockTransaction,
None, {'unpaid_with_txn': ['yes']}, PaypalBlockTransaction,
admin.PaypalBlockTransactionAdmin
)
result = block_check_filter.queryset(
Expand Down
3 changes: 0 additions & 3 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ python_files = test*.py

DJANGO_SETTINGS_MODULE = pipsevents.settings

filterwarnings =
ignore::django.utils.deprecation.RemovedInDjango50Warning:model_bakery

markers =
serial

Expand Down
4 changes: 2 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django<5
Django
coverage
coveralls
dj-database-url
Expand Down Expand Up @@ -35,7 +35,7 @@ pytest
pytest-django
pytest-cov
pytest-env
pytest-freezegun
pytest-freezer
pytest-xdist
pymemcache
stripe
Expand Down
Loading

0 comments on commit 34d9f24

Please sign in to comment.