Skip to content

Commit

Permalink
Make code black formatter compliant
Browse files Browse the repository at this point in the history
The default formatter was not in line with the repository's
  • Loading branch information
ThomasBow committed Feb 22, 2025
1 parent 72ea6f8 commit f07928f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
15 changes: 6 additions & 9 deletions stregsystem/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
from stregsystem.purchase_heatmap import prepare_heatmap_template_context
from stregsystem.templatetags.stregsystem_extras import caffeine_emoji_render
from stregsystem.utils import (
mobile_payment_exact_match_member,
strip_emoji,
mobile_payment_exact_match_member,
strip_emoji,
PaymentToolException,
insert_gdpr_span,
)
Expand Down Expand Up @@ -2289,25 +2289,22 @@ def test_welcome_mail_paid_approved(self, mock_mail_method: MagicMock):
signup_request.approve()
mock_mail_method.assert_called_once()


class MiscUtilTests(TestCase):
fixtures = ['initial_data']

def test_gdpr_is_inserted(self):
assumed_user = "jokke"
assumed_non_user = "nonuser"

simple_quickbuy = assumed_user
simple_gdpr_quickbuy = insert_gdpr_span(simple_quickbuy)
expected_simple_gdpr_quickbuy = (
'<span class="username">' + assumed_user + '</span>'
)
expected_simple_gdpr_quickbuy = '<span class="username">' + assumed_user + '</span>'

self.assertEqual(simple_gdpr_quickbuy, expected_simple_gdpr_quickbuy)

advanced_quickbuy = assumed_user + " " + assumed_non_user
advanced_gdpr_quickbuy = insert_gdpr_span(advanced_quickbuy)
expected_advanced_gdpr_quickbuy = (
'<span class="username">' + assumed_user + '</span> ' + assumed_non_user
)
expected_advanced_gdpr_quickbuy = '<span class="username">' + assumed_user + '</span> ' + assumed_non_user

self.assertEqual(advanced_gdpr_quickbuy, expected_advanced_gdpr_quickbuy)
5 changes: 2 additions & 3 deletions stregsystem/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def mobilepay_launch_uri(comment: str, amount: float) -> str:

return 'mobilepay://send?{}'.format(urllib.parse.urlencode(query))


def insert_gdpr_span(text: str) -> str:
from stregsystem.models import Member

Expand All @@ -190,10 +191,8 @@ def insert_gdpr_span(text: str) -> str:
parts[i] = '<span class="username">' + part + '</span>'
except Member.DoesNotExist:
continue

return " ".join(parts)


return " ".join(parts)


class stregsystemTestRunner(DiscoverRunner):
Expand Down

0 comments on commit f07928f

Please sign in to comment.