From b0a543934cc445841a42924b988ba8de3dc95ea7 Mon Sep 17 00:00:00 2001 From: Alex Toff Date: Fri, 16 Feb 2024 17:44:28 +0000 Subject: [PATCH] emergency: Disable booking confirmation emails (#717) --- Makefile | 10 +-- README.md | 17 +---- precommit_config_generator.py | 75 ------------------- requirements/base.txt | 8 +- .../addresses/migrations/0001_initial.py | 1 - .../migrations/0002_auto_20210805_1525.py | 1 - uobtheatre/addresses/test/factories.py | 1 - .../bookings/migrations/0001_initial.py | 1 - .../bookings/migrations/0002_initial.py | 1 - .../migrations/0003_auto_20210923_2223.py | 1 - .../migrations/0004_auto_20211128_2108.py | 1 - .../migrations/0005_alter_booking_status.py | 1 - .../0006_alter_ticket_checkin_to_datetime.py | 1 - .../0007_booking_accessibility_info.py | 1 - uobtheatre/bookings/models.py | 10 +-- uobtheatre/bookings/mutations.py | 1 - uobtheatre/bookings/schema.py | 1 - uobtheatre/bookings/test/factories.py | 3 - uobtheatre/bookings/test/test_models.py | 31 ++++---- uobtheatre/bookings/test/test_mutations.py | 10 --- uobtheatre/bookings/test/test_schema.py | 7 -- .../discounts/migrations/0001_initial.py | 1 - ...ter_discountrequirement_concession_type.py | 1 - .../migrations/0003_alter_discount_name.py | 1 - .../0004_alter_discount_percentage.py | 1 - .../0005_alter_discountrequirement_number.py | 1 - uobtheatre/discounts/test/factories.py | 3 - uobtheatre/finance/migrations/0001_initial.py | 1 - uobtheatre/images/migrations/0001_initial.py | 1 - uobtheatre/images/schema.py | 1 - uobtheatre/images/test/factories.py | 1 - uobtheatre/mail/test/test_tasks.py | 1 - .../payments/migrations/0001_initial.py | 1 - .../migrations/0002_alter_payment_provider.py | 1 - .../migrations/0003_alter_payment_provider.py | 1 - .../migrations/0004_auto_20210929_1707.py | 1 - .../migrations/0005_payment_status.py | 1 - .../0006_alter_payment_provider_payment_id.py | 1 - .../migrations/0007_auto_20211231_1219.py | 1 - .../migrations/0008_alter_payment_provider.py | 1 - .../0009_rename_payment_transaction.py | 1 - .../migrations/0010_alter_transaction_type.py | 1 - .../migrations/0011_auto_20220108_2216.py | 1 - .../0012_alter_transaction_provider_name.py | 1 - ...013_rename_purchase_type_on_transaction.py | 1 - .../migrations/0014_financialtransfer.py | 1 - .../0015_delete_financialtransfer.py | 1 - uobtheatre/payments/payables.py | 1 + uobtheatre/payments/test/factories.py | 1 - uobtheatre/payments/test/test_schema.py | 1 - uobtheatre/payments/transaction_providers.py | 2 +- .../productions/migrations/0001_initial.py | 1 - .../migrations/0002_auto_20210805_1525.py | 1 - .../migrations/0003_production_status.py | 1 - .../0004_alter_production_options.py | 1 - .../0005_alter_production_description.py | 1 - .../0006_alter_production_options.py | 1 - .../migrations/0007_alter_production_slug.py | 1 - .../0008_alter_production_options.py | 1 - .../migrations/0008_auto_20211202_1601.py | 1 - .../0009_alter_production_status.py | 1 - .../migrations/0009_auto_20211113_1930.py | 1 - .../migrations/0010_auto_20211124_2227.py | 1 - .../0011_alter_production_options.py | 1 - .../0012_alter_production_status.py | 1 - .../0013_alter_production_facebook_event.py | 1 - .../migrations/0014_merge_20220101_1347.py | 1 - .../migrations/0015_auto_20220101_1348.py | 1 - .../migrations/0016_auto_20220113_1416.py | 1 - .../migrations/0016_merge_20220102_0940.py | 1 - .../0017_alter_production_status.py | 1 - .../migrations/0018_merge_20220113_1935.py | 1 - .../migrations/0019_production_venues.py | 1 - ...020_performance_interval_length_minutes.py | 1 - ...lter_performance_interval_duration_mins.py | 1 - .../migrations/0021_auto_20220612_1317.py | 1 - .../migrations/0022_auto_20220612_1331.py | 1 - .../migrations/0023_auto_20220707_1722.py | 1 - .../migrations/0024_merge_20220808_2050.py | 1 - .../migrations/0025_auto_20220904_1804.py | 1 - .../migrations/0026_auto_20221210_2056.py | 1 - uobtheatre/productions/test/factories.py | 2 - uobtheatre/productions/test/test_schema.py | 1 - uobtheatre/productions/test/test_system.py | 1 - uobtheatre/reports/migrations/0001_initial.py | 1 - uobtheatre/reports/models.py | 1 - uobtheatre/reports/reports.py | 1 - .../societies/migrations/0001_initial.py | 1 - .../migrations/0002_society_members.py | 1 - .../0003_alter_society_description.py | 1 - .../migrations/0004_alter_society_members.py | 1 - .../migrations/0005_auto_20210924_1401.py | 1 - .../migrations/0006_alter_society_options.py | 1 - uobtheatre/users/migrations/0001_initial.py | 1 - uobtheatre/users/models.py | 3 +- uobtheatre/users/test/test_abilities.py | 1 - uobtheatre/users/test/test_backends.py | 2 - uobtheatre/users/test/test_models.py | 1 + uobtheatre/users/test/test_schema.py | 1 - .../utils/celery_migrations/0001_initial.py | 1 - uobtheatre/utils/exceptions.py | 4 +- uobtheatre/utils/forms.py | 2 +- uobtheatre/utils/test/factories.py | 1 - uobtheatre/venues/migrations/0001_initial.py | 1 - .../migrations/0002_auto_20210805_1525.py | 1 - .../0003_alter_venue_description.py | 1 - .../0004_alter_venue_internal_capacity.py | 1 - uobtheatre/venues/schema.py | 1 - uobtheatre/venues/test/factories.py | 2 - 109 files changed, 36 insertions(+), 247 deletions(-) delete mode 100644 precommit_config_generator.py diff --git a/Makefile b/Makefile index 035acdfaa..b3f60af1c 100644 --- a/Makefile +++ b/Makefile @@ -34,15 +34,9 @@ setup: make collect-static python -m venv .venv source .venv/bin/activate - make setup-precommit make up -setup-precommit: - pip install pre-commit - pre-commit install - setup-devcontainer: - make setup-precommit make migrate pip install -r requirements/local.txt @@ -154,12 +148,12 @@ mypy: ## Type checking - mypy schema: ## Dumps graphql schema in schema.json $(COMMAND_PREFIX) ./manage.py graphql_schema --schema uobtheatre.schema.schema --out schema.graphql -pr: ## Runs everything required (that is not included in precommit) for a pr +pr: ## Runs everything required for a pr make schema + make lint make test build: - python precommit_config_generator.py docker-compose build api celery django-shell: ## Open django shell diff --git a/README.md b/README.md index 5599ca5db..43425ec42 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This will: - Pull all the docker images - Build the api image - Collect the static files -- Setup a venv and precommit +- Setup a venv - Start the api and db (If you are on windows you will need to copy the commands into git bash from the makefile or use wsl) @@ -27,19 +27,6 @@ This will: - [docker](https://docs.docker.com/get-docker/) - [docker-compose](https://docs.docker.com/compose/install/) -## Pre-commit - -Pre-commit is required to format code and do lots of nice checks. - -It should be installed by `make setup`. - -Otherwise, it can be installed manually with: -``` -pip install pre-commit -pre-commit install -``` - -If this case every commit should trigger the precommit hook. You will always need to be commit from within the venv for this to work. ## Visual Studio Dev Container @@ -134,7 +121,7 @@ make build ``` This does the following: -- Set the requirements for mypy precommit +- Set the requirements for mypy - Rebuild the api If mypy gives an error about not being able to find the new package, add it to the list of "additional_dependencies" in `.pre-commit-config.yaml`. diff --git a/precommit_config_generator.py b/precommit_config_generator.py deleted file mode 100644 index 528194000..000000000 --- a/precommit_config_generator.py +++ /dev/null @@ -1,75 +0,0 @@ -import yaml - -REQUIREMENTS_DIRECTORY = "requirements" - -ignores = [ - "mypy", - "psycopg2", -] - -extras = [ - "psycopg2-binary", -] - - -def clean_line(line: str): - """ - Clean the line - """ - if any(ignore in line for ignore in ignores): - return None - - output = "" - for char in line: - if char == "#": - break - if char: - output += char - return output.strip() - - -def get_requirements_from_requirements_file(requirements_file: str): - """ - Get the requirements from the requirements file - """ - requirements = [] - with open( - f"{REQUIREMENTS_DIRECTORY}/{requirements_file}", encoding="utf8" - ) as req_file: - for line in req_file.readlines(): - line = line.strip() - if line.startswith("-r"): - requirements.extend(get_requirements_from_requirements_file(line[3:])) - else: - line = clean_line(line) - if line: - requirements.append(line) - - return requirements - - -def write_requirements_to_precommit_config( - requirements: list, precommit_config_file: str -): - """ - Write the requirements to the precommit config file - """ - print(requirements) - with open(precommit_config_file, "r", encoding="utf8") as config_file: - config = yaml.safe_load(config_file) - - repos = config["repos"] - mypy_repo = next( - repo - for repo in repos - if repo["repo"] == "https://github.com/pre-commit/mirrors-mypy" - ) - - mypy_repo["hooks"][0]["additional_dependencies"] = requirements - - with open(precommit_config_file, "w", encoding="utf8") as config_file: - yaml.dump(config, config_file) - - -all_requirements = get_requirements_from_requirements_file("local.txt") + extras -write_requirements_to_precommit_config(all_requirements, ".pre-commit-config.yaml") diff --git a/requirements/base.txt b/requirements/base.txt index 7bf3e15e2..913bf87ac 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -25,7 +25,7 @@ django-configurations==2.4 django-environ==0.10.0 # https://github.com/joke2k/django-environ # Spreadsheet generation -xlsxwriter==3.0.8 +xlsxwriter==3.0.9 # Text formatting html2text==2020.1.16 @@ -63,11 +63,11 @@ squareup>=9.0.0.20210226 #=== Logging ===# -sentry-sdk==1.16.0 +sentry-sdk==1.19.1 whitenoise==6.4.0 # https://github.com/evansd/whitenoise #=== Email ===# -django-anymail[amazon_ses]==9.0 # https://github.com/anymail/django-anymail +django-anymail[amazon_ses]==9.1 # https://github.com/anymail/django-anymail django-inlinecss==0.3.0 #=== Timezones ===# @@ -76,4 +76,4 @@ pytz==2022.7.1 #=== Task Queue ===# django-celery-results==2.2.0 -redis==4.5.1 +redis==4.5.4 diff --git a/uobtheatre/addresses/migrations/0001_initial.py b/uobtheatre/addresses/migrations/0001_initial.py index b426ea6d4..3296df9f1 100644 --- a/uobtheatre/addresses/migrations/0001_initial.py +++ b/uobtheatre/addresses/migrations/0001_initial.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/uobtheatre/addresses/migrations/0002_auto_20210805_1525.py b/uobtheatre/addresses/migrations/0002_auto_20210805_1525.py index 81041d400..1bbd6639b 100644 --- a/uobtheatre/addresses/migrations/0002_auto_20210805_1525.py +++ b/uobtheatre/addresses/migrations/0002_auto_20210805_1525.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("addresses", "0001_initial"), ] diff --git a/uobtheatre/addresses/test/factories.py b/uobtheatre/addresses/test/factories.py index 88313a2b5..4cc9db3aa 100644 --- a/uobtheatre/addresses/test/factories.py +++ b/uobtheatre/addresses/test/factories.py @@ -4,7 +4,6 @@ class AddressFactory(factory.django.DjangoModelFactory): - street = factory.Faker("street_name") building_name = factory.Faker("sentence", nb_words=2) building_number = factory.Faker("bothify", text="##") diff --git a/uobtheatre/bookings/migrations/0001_initial.py b/uobtheatre/bookings/migrations/0001_initial.py index 184aab693..caaebab5c 100644 --- a/uobtheatre/bookings/migrations/0001_initial.py +++ b/uobtheatre/bookings/migrations/0001_initial.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/bookings/migrations/0002_initial.py b/uobtheatre/bookings/migrations/0002_initial.py index 03b135fc8..f0b9313e7 100644 --- a/uobtheatre/bookings/migrations/0002_initial.py +++ b/uobtheatre/bookings/migrations/0002_initial.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/bookings/migrations/0003_auto_20210923_2223.py b/uobtheatre/bookings/migrations/0003_auto_20210923_2223.py index 616e16588..db5d22c52 100644 --- a/uobtheatre/bookings/migrations/0003_auto_20210923_2223.py +++ b/uobtheatre/bookings/migrations/0003_auto_20210923_2223.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("bookings", "0002_initial"), ] diff --git a/uobtheatre/bookings/migrations/0004_auto_20211128_2108.py b/uobtheatre/bookings/migrations/0004_auto_20211128_2108.py index 3143c38e9..ded2383e5 100644 --- a/uobtheatre/bookings/migrations/0004_auto_20211128_2108.py +++ b/uobtheatre/bookings/migrations/0004_auto_20211128_2108.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("bookings", "0003_auto_20210923_2223"), ] diff --git a/uobtheatre/bookings/migrations/0005_alter_booking_status.py b/uobtheatre/bookings/migrations/0005_alter_booking_status.py index 4f49f6507..c6d83690f 100644 --- a/uobtheatre/bookings/migrations/0005_alter_booking_status.py +++ b/uobtheatre/bookings/migrations/0005_alter_booking_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("bookings", "0004_auto_20211128_2108"), ] diff --git a/uobtheatre/bookings/migrations/0006_alter_ticket_checkin_to_datetime.py b/uobtheatre/bookings/migrations/0006_alter_ticket_checkin_to_datetime.py index c5f7bab2d..640c365a0 100644 --- a/uobtheatre/bookings/migrations/0006_alter_ticket_checkin_to_datetime.py +++ b/uobtheatre/bookings/migrations/0006_alter_ticket_checkin_to_datetime.py @@ -19,7 +19,6 @@ def ticket_check_in_to_datetime(apps, _): class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("bookings", "0005_alter_booking_status"), diff --git a/uobtheatre/bookings/migrations/0007_booking_accessibility_info.py b/uobtheatre/bookings/migrations/0007_booking_accessibility_info.py index 54abb89a1..e23885291 100644 --- a/uobtheatre/bookings/migrations/0007_booking_accessibility_info.py +++ b/uobtheatre/bookings/migrations/0007_booking_accessibility_info.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("bookings", "0006_alter_ticket_checkin_to_datetime"), ] diff --git a/uobtheatre/bookings/models.py b/uobtheatre/bookings/models.py index 827f52633..086c30d64 100644 --- a/uobtheatre/bookings/models.py +++ b/uobtheatre/bookings/models.py @@ -12,7 +12,7 @@ from django.utils.functional import cached_property from graphql_relay.node.node import to_global_id -import uobtheatre.bookings.emails as booking_emails +#import uobtheatre.bookings.emails as booking_emails from uobtheatre.discounts.models import ConcessionType, DiscountCombination from uobtheatre.payments.exceptions import ( CantBePaidForException, @@ -206,6 +206,7 @@ def generate_expires_at(): BookingManager = models.Manager.from_queryset(BookingQuerySet) + # pylint: disable=too-many-public-methods class Booking(TimeStampedMixin, Payable): """A booking for a performance @@ -519,7 +520,6 @@ def get_ticket_diff( # find tickets to delete for ticket in self.tickets.all(): - if existing_tickets.get(ticket.id): # if a given booking ticket is in the requested tickets - you keep it - existing_tickets.pop(ticket.id, None) @@ -548,9 +548,9 @@ def complete(self, payment: Transaction = None): """ super().complete() - booking_emails.send_booking_confirmation_email(self, payment) - if self.accessibility_info: - booking_emails.send_booking_accessibility_info_email(self) + # booking_emails.send_booking_confirmation_email(self, payment) + # if self.accessibility_info: + # booking_emails.send_booking_accessibility_info_email(self) def clone(self): clone = super().clone() diff --git a/uobtheatre/bookings/mutations.py b/uobtheatre/bookings/mutations.py index 993d8a6f3..6c57c773f 100644 --- a/uobtheatre/bookings/mutations.py +++ b/uobtheatre/bookings/mutations.py @@ -185,7 +185,6 @@ def resolve_mutation( # pylint: disable=too-many-arguments, too-many-branches verify_token=None, **kwargs, ): - # Get the performance and if it doesn't exist throw an error booking = Booking.objects.get(id=kwargs["id"]) diff --git a/uobtheatre/bookings/schema.py b/uobtheatre/bookings/schema.py index f93592ead..2c84b8a34 100644 --- a/uobtheatre/bookings/schema.py +++ b/uobtheatre/bookings/schema.py @@ -86,7 +86,6 @@ def resolve_tickets_discounted_price(self, _): return self.subtotal def resolve_tickets(self, _): - # Group the ticket together, this returns a list of tuples. # The first element of the tuple is itself a tuple which contains the # seat_group and concession_type, the second element of the typle diff --git a/uobtheatre/bookings/test/factories.py b/uobtheatre/bookings/test/factories.py index f49588291..187ab8a37 100644 --- a/uobtheatre/bookings/test/factories.py +++ b/uobtheatre/bookings/test/factories.py @@ -30,7 +30,6 @@ class Meta: class BookingFactory(factory.django.DjangoModelFactory): - user = factory.SubFactory(UserFactory) creator = factory.SubFactory(UserFactory) performance = factory.SubFactory(PerformanceFactory) @@ -41,7 +40,6 @@ class Meta: class PerformanceSeatingFactory(factory.django.DjangoModelFactory): - price = factory.Faker("pyint") performance = factory.SubFactory(PerformanceFactory) capacity = factory.Faker("pyint") @@ -52,7 +50,6 @@ class Meta: class TicketFactory(factory.django.DjangoModelFactory): - seat_group = factory.SubFactory(SeatGroupFactory) booking = factory.SubFactory(BookingFactory) concession_type = factory.SubFactory( diff --git a/uobtheatre/bookings/test/test_models.py b/uobtheatre/bookings/test/test_models.py index e2bd3351e..08222e300 100644 --- a/uobtheatre/bookings/test/test_models.py +++ b/uobtheatre/bookings/test/test_models.py @@ -1043,7 +1043,6 @@ def test_booking_can_be_refunded(is_refunded, status, production_status, expecte "uobtheatre.bookings.models.Booking.is_refunded", new_callable=PropertyMock(return_value=is_refunded), ): - booking = BookingFactory( performance=PerformanceFactory(production=production), status=status ) @@ -1069,21 +1068,21 @@ def test_complete(with_payment, with_accessibility): status=Payable.Status.IN_PROGRESS, accessibility_info=("Something" if with_accessibility else None), ) - with patch( - "uobtheatre.bookings.emails.send_booking_confirmation_email" - ) as mock_send_email, patch( - "uobtheatre.bookings.emails.send_booking_accessibility_info_email" - ) as mock_send_accessibility_email: - kwargs = {} - if with_payment: - kwargs["payment"] = TransactionFactory() - booking.complete(**kwargs) - mock_send_email.assert_called_once() - - if with_accessibility: - mock_send_accessibility_email.assert_called_once() - else: - mock_send_accessibility_email.assert_not_called() + # with patch( + # "uobtheatre.bookings.emails.send_booking_confirmation_email" + # ) as mock_send_email, patch( + # "uobtheatre.bookings.emails.send_booking_accessibility_info_email" + # ) as mock_send_accessibility_email: + kwargs = {} + if with_payment: + kwargs["payment"] = TransactionFactory() + booking.complete(**kwargs) + # mock_send_email.assert_called_once() + + # if with_accessibility: + # mock_send_accessibility_email.assert_called_once() + # else: + # mock_send_accessibility_email.assert_not_called() booking.refresh_from_db() assert booking.status == Payable.Status.PAID diff --git a/uobtheatre/bookings/test/test_mutations.py b/uobtheatre/bookings/test/test_mutations.py index aacd66283..348f69d42 100644 --- a/uobtheatre/bookings/test/test_mutations.py +++ b/uobtheatre/bookings/test/test_mutations.py @@ -141,7 +141,6 @@ def test_create_booking_mutation( data, seat_group_capacity, performance_capacity, is_valid, gql_client ): - performance = PerformanceFactory(id=1, capacity=performance_capacity) seat_group = SeatGroupFactory(id=1) PerformanceSeatingFactory( @@ -328,7 +327,6 @@ def test_cant_create_booking_with_unbookable_performance(gql_client): @pytest.mark.django_db def test_create_booking_with_taget_user_without_perms(gql_client): - psg = PerformanceSeatingFactory() request = """ mutation { @@ -371,7 +369,6 @@ def test_create_booking_with_taget_user_without_perms(gql_client): @pytest.mark.django_db def test_create_booking_with_taget_user(gql_client): - user = UserFactory(email="abc@email.com") psg = PerformanceSeatingFactory() request = """ @@ -412,7 +409,6 @@ def test_create_booking_with_taget_user(gql_client): @pytest.mark.django_db def test_create_booking_with_new_taget_user(gql_client): - psg = PerformanceSeatingFactory() request = """ mutation { @@ -828,7 +824,6 @@ def test_create_booking_with_invalid_seat_group(gql_client): ], ) def test_update_booking(current_tickets, planned_tickets, expected_tickets, gql_client): - seat_group_1 = SeatGroupFactory(id=1) seat_group_2 = SeatGroupFactory(id=2) performance = PerformanceFactory() @@ -1118,7 +1113,6 @@ def test_update_booking_set_target_user(gql_client): @pytest.mark.django_db def test_update_booking_set_target_user_to_same_user(gql_client): - user = UserFactory(email="user@email.com") creator = gql_client.login().user booking = BookingFactory(user=user, status=Payable.Status.IN_PROGRESS) @@ -1304,7 +1298,6 @@ def test_update_booking_without_permission(gql_client): @pytest.mark.django_db def test_update_booking_capacity_error(gql_client): - seat_group = SeatGroupFactory(name="Seat Group 1") concession_type = ConcessionTypeFactory() booking = BookingFactory( @@ -1364,7 +1357,6 @@ def test_update_booking_capacity_error(gql_client): @pytest.mark.django_db def test_update_paid_booking_fails(gql_client): - seat_group = SeatGroupFactory() concession_type = ConcessionTypeFactory() booking = BookingFactory(user=gql_client.login().user, status=Payable.Status.PAID) @@ -2229,7 +2221,6 @@ def test_paybooking_unsupported_payment_provider(info): @pytest.mark.django_db def test_pay_booking_fails_if_already_paid(gql_client): - booking = BookingFactory(user=gql_client.login().user, status=Payable.Status.PAID) request_query = """ mutation { @@ -2285,7 +2276,6 @@ def test_check_in_booking( non_booking_ticket_id_list, gql_client, ): - """ What are we testing? that only the expected tickets are checked in diff --git a/uobtheatre/bookings/test/test_schema.py b/uobtheatre/bookings/test/test_schema.py index 9bdf6a45e..0b3345c68 100644 --- a/uobtheatre/bookings/test/test_schema.py +++ b/uobtheatre/bookings/test/test_schema.py @@ -29,7 +29,6 @@ @pytest.mark.django_db def test_tickets_schema(gql_client): - gql_client.login().user booking = BookingFactory() tickets = [TicketFactory(booking=booking) for _ in range(1)] @@ -140,7 +139,6 @@ def test_tickets_schema(gql_client): @pytest.mark.django_db def test_ticket_checked_in_by_perm(gql_client): - user = gql_client.login().user booking = BookingFactory(user=user) tickets = [TicketFactory(booking=booking) for _ in range(1)] @@ -188,7 +186,6 @@ def test_ticket_checked_in_by_perm(gql_client): @pytest.mark.django_db def test_bookings_schema(gql_client): - booking = BookingFactory(status=Payable.Status.IN_PROGRESS) # Create a booking that is not owned by the same user BookingFactory(status=Payable.Status.IN_PROGRESS) @@ -844,7 +841,6 @@ def test_bookings_qs(gql_client): @pytest.mark.django_db def test_booking_filter_checked_in(gql_client): - # No tickets booking _ = BookingFactory(user=gql_client.login().user) @@ -900,7 +896,6 @@ def test_booking_filter_checked_in(gql_client): @pytest.mark.django_db def test_booking_filter_active(gql_client): - now = timezone.now() production = ProductionFactory() @@ -950,7 +945,6 @@ def test_booking_filter_active(gql_client): @pytest.mark.django_db def test_booking_order_checked_in(gql_client): - # None checked in booking_none = BookingFactory(user=gql_client.login().user) TicketFactory(booking=booking_none) @@ -1008,7 +1002,6 @@ def test_booking_order_checked_in(gql_client): @pytest.mark.django_db def test_booking_order_start(gql_client): - now = timezone.now() # First diff --git a/uobtheatre/discounts/migrations/0001_initial.py b/uobtheatre/discounts/migrations/0001_initial.py index 2902b7755..0da466d90 100644 --- a/uobtheatre/discounts/migrations/0001_initial.py +++ b/uobtheatre/discounts/migrations/0001_initial.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/discounts/migrations/0002_alter_discountrequirement_concession_type.py b/uobtheatre/discounts/migrations/0002_alter_discountrequirement_concession_type.py index 6100aab4b..9143ec952 100644 --- a/uobtheatre/discounts/migrations/0002_alter_discountrequirement_concession_type.py +++ b/uobtheatre/discounts/migrations/0002_alter_discountrequirement_concession_type.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("discounts", "0001_initial"), ] diff --git a/uobtheatre/discounts/migrations/0003_alter_discount_name.py b/uobtheatre/discounts/migrations/0003_alter_discount_name.py index 9ec4b7400..504deeb65 100644 --- a/uobtheatre/discounts/migrations/0003_alter_discount_name.py +++ b/uobtheatre/discounts/migrations/0003_alter_discount_name.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("discounts", "0002_alter_discountrequirement_concession_type"), ] diff --git a/uobtheatre/discounts/migrations/0004_alter_discount_percentage.py b/uobtheatre/discounts/migrations/0004_alter_discount_percentage.py index 96da93e93..06c9a9c23 100644 --- a/uobtheatre/discounts/migrations/0004_alter_discount_percentage.py +++ b/uobtheatre/discounts/migrations/0004_alter_discount_percentage.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("discounts", "0003_alter_discount_name"), ] diff --git a/uobtheatre/discounts/migrations/0005_alter_discountrequirement_number.py b/uobtheatre/discounts/migrations/0005_alter_discountrequirement_number.py index 31da33ed2..020e0a227 100644 --- a/uobtheatre/discounts/migrations/0005_alter_discountrequirement_number.py +++ b/uobtheatre/discounts/migrations/0005_alter_discountrequirement_number.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("discounts", "0004_alter_discount_percentage"), ] diff --git a/uobtheatre/discounts/test/factories.py b/uobtheatre/discounts/test/factories.py index 471604d37..d98ea71ce 100644 --- a/uobtheatre/discounts/test/factories.py +++ b/uobtheatre/discounts/test/factories.py @@ -4,7 +4,6 @@ class DiscountFactory(factory.django.DjangoModelFactory): - name = factory.Faker("sentence", nb_words=2) percentage = 0.2 @@ -13,7 +12,6 @@ class Meta: class ConcessionTypeFactory(factory.django.DjangoModelFactory): - name = factory.Faker("sentence", nb_words=2) class Meta: @@ -21,7 +19,6 @@ class Meta: class DiscountRequirementFactory(factory.django.DjangoModelFactory): - number = 1 concession_type = factory.SubFactory(ConcessionTypeFactory) discount = factory.SubFactory("uobtheatre.discounts.test.factories.DiscountFactory") diff --git a/uobtheatre/finance/migrations/0001_initial.py b/uobtheatre/finance/migrations/0001_initial.py index 229461095..f5d7d35e5 100644 --- a/uobtheatre/finance/migrations/0001_initial.py +++ b/uobtheatre/finance/migrations/0001_initial.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/images/migrations/0001_initial.py b/uobtheatre/images/migrations/0001_initial.py index 387923952..fe0001ea9 100644 --- a/uobtheatre/images/migrations/0001_initial.py +++ b/uobtheatre/images/migrations/0001_initial.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/uobtheatre/images/schema.py b/uobtheatre/images/schema.py index d7c32565a..4d47158ec 100644 --- a/uobtheatre/images/schema.py +++ b/uobtheatre/images/schema.py @@ -6,7 +6,6 @@ class ImageNode(DjangoObjectType): - url = graphene.String() def resolve_url(self, info): diff --git a/uobtheatre/images/test/factories.py b/uobtheatre/images/test/factories.py index 6bc647b63..08cc03734 100644 --- a/uobtheatre/images/test/factories.py +++ b/uobtheatre/images/test/factories.py @@ -4,7 +4,6 @@ class ImageFactory(factory.django.DjangoModelFactory): - alt_text = factory.Faker("sentence", nb_words=3) file = factory.django.ImageField(color="blue", use_url=True) diff --git a/uobtheatre/mail/test/test_tasks.py b/uobtheatre/mail/test/test_tasks.py index 8f0f247bb..4b4fed6f4 100644 --- a/uobtheatre/mail/test/test_tasks.py +++ b/uobtheatre/mail/test/test_tasks.py @@ -5,7 +5,6 @@ @pytest.mark.django_db def test_send_emails_task(mailoutbox): - send_emails( ["joe@example.org", "jill@example.org"], "Subject", "Yes", "

Yes!

" ) diff --git a/uobtheatre/payments/migrations/0001_initial.py b/uobtheatre/payments/migrations/0001_initial.py index 1c9cb74ea..b987e32fb 100644 --- a/uobtheatre/payments/migrations/0001_initial.py +++ b/uobtheatre/payments/migrations/0001_initial.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/payments/migrations/0002_alter_payment_provider.py b/uobtheatre/payments/migrations/0002_alter_payment_provider.py index d3bb3e547..c6bf85b49 100644 --- a/uobtheatre/payments/migrations/0002_alter_payment_provider.py +++ b/uobtheatre/payments/migrations/0002_alter_payment_provider.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0001_initial"), ] diff --git a/uobtheatre/payments/migrations/0003_alter_payment_provider.py b/uobtheatre/payments/migrations/0003_alter_payment_provider.py index 865eab961..905b31053 100644 --- a/uobtheatre/payments/migrations/0003_alter_payment_provider.py +++ b/uobtheatre/payments/migrations/0003_alter_payment_provider.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0002_alter_payment_provider"), ] diff --git a/uobtheatre/payments/migrations/0004_auto_20210929_1707.py b/uobtheatre/payments/migrations/0004_auto_20210929_1707.py index 3fc39c221..14b5a6fb2 100644 --- a/uobtheatre/payments/migrations/0004_auto_20210929_1707.py +++ b/uobtheatre/payments/migrations/0004_auto_20210929_1707.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0003_alter_payment_provider"), ] diff --git a/uobtheatre/payments/migrations/0005_payment_status.py b/uobtheatre/payments/migrations/0005_payment_status.py index 758f137fa..691ca9013 100644 --- a/uobtheatre/payments/migrations/0005_payment_status.py +++ b/uobtheatre/payments/migrations/0005_payment_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0004_auto_20210929_1707"), ] diff --git a/uobtheatre/payments/migrations/0006_alter_payment_provider_payment_id.py b/uobtheatre/payments/migrations/0006_alter_payment_provider_payment_id.py index ebea9e502..ec31753d5 100644 --- a/uobtheatre/payments/migrations/0006_alter_payment_provider_payment_id.py +++ b/uobtheatre/payments/migrations/0006_alter_payment_provider_payment_id.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0005_payment_status"), ] diff --git a/uobtheatre/payments/migrations/0007_auto_20211231_1219.py b/uobtheatre/payments/migrations/0007_auto_20211231_1219.py index 7722da141..8015eab18 100644 --- a/uobtheatre/payments/migrations/0007_auto_20211231_1219.py +++ b/uobtheatre/payments/migrations/0007_auto_20211231_1219.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0006_alter_payment_provider_payment_id"), ] diff --git a/uobtheatre/payments/migrations/0008_alter_payment_provider.py b/uobtheatre/payments/migrations/0008_alter_payment_provider.py index 1389f34f6..31fc3fee4 100644 --- a/uobtheatre/payments/migrations/0008_alter_payment_provider.py +++ b/uobtheatre/payments/migrations/0008_alter_payment_provider.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0007_auto_20211231_1219"), ] diff --git a/uobtheatre/payments/migrations/0009_rename_payment_transaction.py b/uobtheatre/payments/migrations/0009_rename_payment_transaction.py index 6da8fc0f8..ff7510189 100644 --- a/uobtheatre/payments/migrations/0009_rename_payment_transaction.py +++ b/uobtheatre/payments/migrations/0009_rename_payment_transaction.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("contenttypes", "0002_remove_content_type_name"), ("payments", "0008_alter_payment_provider"), diff --git a/uobtheatre/payments/migrations/0010_alter_transaction_type.py b/uobtheatre/payments/migrations/0010_alter_transaction_type.py index db02fb871..305597ed4 100644 --- a/uobtheatre/payments/migrations/0010_alter_transaction_type.py +++ b/uobtheatre/payments/migrations/0010_alter_transaction_type.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0009_rename_payment_transaction"), ] diff --git a/uobtheatre/payments/migrations/0011_auto_20220108_2216.py b/uobtheatre/payments/migrations/0011_auto_20220108_2216.py index 270c493f4..27551dfda 100644 --- a/uobtheatre/payments/migrations/0011_auto_20220108_2216.py +++ b/uobtheatre/payments/migrations/0011_auto_20220108_2216.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0010_alter_transaction_type"), ] diff --git a/uobtheatre/payments/migrations/0012_alter_transaction_provider_name.py b/uobtheatre/payments/migrations/0012_alter_transaction_provider_name.py index 9516b996f..1d79887b7 100644 --- a/uobtheatre/payments/migrations/0012_alter_transaction_provider_name.py +++ b/uobtheatre/payments/migrations/0012_alter_transaction_provider_name.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0011_auto_20220108_2216"), ] diff --git a/uobtheatre/payments/migrations/0013_rename_purchase_type_on_transaction.py b/uobtheatre/payments/migrations/0013_rename_purchase_type_on_transaction.py index 427f9e621..ed9d71eb8 100644 --- a/uobtheatre/payments/migrations/0013_rename_purchase_type_on_transaction.py +++ b/uobtheatre/payments/migrations/0013_rename_purchase_type_on_transaction.py @@ -10,7 +10,6 @@ def convert_purcahse_to_payment(apps, _): class Migration(migrations.Migration): - dependencies = [ ("payments", "0012_alter_transaction_provider_name"), ] diff --git a/uobtheatre/payments/migrations/0014_financialtransfer.py b/uobtheatre/payments/migrations/0014_financialtransfer.py index ba4a56e35..f8609a16d 100644 --- a/uobtheatre/payments/migrations/0014_financialtransfer.py +++ b/uobtheatre/payments/migrations/0014_financialtransfer.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("societies", "0006_alter_society_options"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), diff --git a/uobtheatre/payments/migrations/0015_delete_financialtransfer.py b/uobtheatre/payments/migrations/0015_delete_financialtransfer.py index 56ecfdf49..bc43c82de 100644 --- a/uobtheatre/payments/migrations/0015_delete_financialtransfer.py +++ b/uobtheatre/payments/migrations/0015_delete_financialtransfer.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("payments", "0014_financialtransfer"), ] diff --git a/uobtheatre/payments/payables.py b/uobtheatre/payments/payables.py index 31cff27ee..b335670fd 100644 --- a/uobtheatre/payments/payables.py +++ b/uobtheatre/payments/payables.py @@ -53,6 +53,7 @@ def refunded(self, bool_val=True) -> QuerySet: PayableManager = models.Manager.from_queryset(PayableQuerySet) + # pylint: disable=too-many-public-methods class Payable(BaseModel, metaclass=AbstractModelMeta): # type: ignore """ diff --git a/uobtheatre/payments/test/factories.py b/uobtheatre/payments/test/factories.py index e5a67daca..5dbe6c37e 100644 --- a/uobtheatre/payments/test/factories.py +++ b/uobtheatre/payments/test/factories.py @@ -8,7 +8,6 @@ class TransactionFactory(factory.django.DjangoModelFactory): - pay_object = factory.SubFactory(BookingFactory) type = Transaction.Type.PAYMENT provider_name = transaction_providers.SquareOnline.name diff --git a/uobtheatre/payments/test/test_schema.py b/uobtheatre/payments/test/test_schema.py index ea5b73265..de77fefc5 100644 --- a/uobtheatre/payments/test/test_schema.py +++ b/uobtheatre/payments/test/test_schema.py @@ -275,7 +275,6 @@ def test_list_devices_empty_response(gql_client, mock_square): def test_filter_list_devices( gql_client, mock_square, filters, expect_called, expected_args ): - PerformanceFactory() gql_client.login() assign_perm("productions.boxoffice", gql_client.user) diff --git a/uobtheatre/payments/transaction_providers.py b/uobtheatre/payments/transaction_providers.py index 57b9d6dbe..50966bf99 100644 --- a/uobtheatre/payments/transaction_providers.py +++ b/uobtheatre/payments/transaction_providers.py @@ -93,7 +93,7 @@ class RefundProvider(TransactionProvider, abc.ABC): def __init_subclass__(cls) -> None: super().__init_subclass__() - cls.__all__ = cls.__all__.append(cls) # type: ignore + cls.__all__ = cls.__all__.append(cls) # type: ignore #pylint: disable=assignment-from-no-return @classmethod @property diff --git a/uobtheatre/productions/migrations/0001_initial.py b/uobtheatre/productions/migrations/0001_initial.py index 18606232d..3e6fb2fd7 100644 --- a/uobtheatre/productions/migrations/0001_initial.py +++ b/uobtheatre/productions/migrations/0001_initial.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/productions/migrations/0002_auto_20210805_1525.py b/uobtheatre/productions/migrations/0002_auto_20210805_1525.py index ebd7f261b..42185b152 100644 --- a/uobtheatre/productions/migrations/0002_auto_20210805_1525.py +++ b/uobtheatre/productions/migrations/0002_auto_20210805_1525.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0001_initial"), ] diff --git a/uobtheatre/productions/migrations/0003_production_status.py b/uobtheatre/productions/migrations/0003_production_status.py index b78392409..23a21a126 100644 --- a/uobtheatre/productions/migrations/0003_production_status.py +++ b/uobtheatre/productions/migrations/0003_production_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0002_auto_20210805_1525"), ] diff --git a/uobtheatre/productions/migrations/0004_alter_production_options.py b/uobtheatre/productions/migrations/0004_alter_production_options.py index 5ec42c663..74c63e187 100644 --- a/uobtheatre/productions/migrations/0004_alter_production_options.py +++ b/uobtheatre/productions/migrations/0004_alter_production_options.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0003_production_status"), ] diff --git a/uobtheatre/productions/migrations/0005_alter_production_description.py b/uobtheatre/productions/migrations/0005_alter_production_description.py index c3b9c234b..7c7ad0973 100644 --- a/uobtheatre/productions/migrations/0005_alter_production_description.py +++ b/uobtheatre/productions/migrations/0005_alter_production_description.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0004_alter_production_options"), ] diff --git a/uobtheatre/productions/migrations/0006_alter_production_options.py b/uobtheatre/productions/migrations/0006_alter_production_options.py index dd5971b2e..7a6217c59 100644 --- a/uobtheatre/productions/migrations/0006_alter_production_options.py +++ b/uobtheatre/productions/migrations/0006_alter_production_options.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0005_alter_production_description"), ] diff --git a/uobtheatre/productions/migrations/0007_alter_production_slug.py b/uobtheatre/productions/migrations/0007_alter_production_slug.py index 500fedc41..a0d772006 100644 --- a/uobtheatre/productions/migrations/0007_alter_production_slug.py +++ b/uobtheatre/productions/migrations/0007_alter_production_slug.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0006_alter_production_options"), ] diff --git a/uobtheatre/productions/migrations/0008_alter_production_options.py b/uobtheatre/productions/migrations/0008_alter_production_options.py index bacbe0662..e436e4c0b 100644 --- a/uobtheatre/productions/migrations/0008_alter_production_options.py +++ b/uobtheatre/productions/migrations/0008_alter_production_options.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0007_alter_production_slug"), ] diff --git a/uobtheatre/productions/migrations/0008_auto_20211202_1601.py b/uobtheatre/productions/migrations/0008_auto_20211202_1601.py index 610aa29a5..4dc35857b 100644 --- a/uobtheatre/productions/migrations/0008_auto_20211202_1601.py +++ b/uobtheatre/productions/migrations/0008_auto_20211202_1601.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0007_alter_production_slug"), ] diff --git a/uobtheatre/productions/migrations/0009_alter_production_status.py b/uobtheatre/productions/migrations/0009_alter_production_status.py index a06f0ba12..89e89137d 100644 --- a/uobtheatre/productions/migrations/0009_alter_production_status.py +++ b/uobtheatre/productions/migrations/0009_alter_production_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0008_auto_20211202_1601"), ] diff --git a/uobtheatre/productions/migrations/0009_auto_20211113_1930.py b/uobtheatre/productions/migrations/0009_auto_20211113_1930.py index 53fb00e9c..04c21d77d 100644 --- a/uobtheatre/productions/migrations/0009_auto_20211113_1930.py +++ b/uobtheatre/productions/migrations/0009_auto_20211113_1930.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("societies", "0006_alter_society_options"), ("productions", "0008_alter_production_options"), diff --git a/uobtheatre/productions/migrations/0010_auto_20211124_2227.py b/uobtheatre/productions/migrations/0010_auto_20211124_2227.py index 86a5ab592..d4d4428bf 100644 --- a/uobtheatre/productions/migrations/0010_auto_20211124_2227.py +++ b/uobtheatre/productions/migrations/0010_auto_20211124_2227.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0009_auto_20211113_1930"), ] diff --git a/uobtheatre/productions/migrations/0011_alter_production_options.py b/uobtheatre/productions/migrations/0011_alter_production_options.py index b047fcb06..f3b714d29 100644 --- a/uobtheatre/productions/migrations/0011_alter_production_options.py +++ b/uobtheatre/productions/migrations/0011_alter_production_options.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0010_auto_20211124_2227"), ] diff --git a/uobtheatre/productions/migrations/0012_alter_production_status.py b/uobtheatre/productions/migrations/0012_alter_production_status.py index b7eecc2e4..ddc61db52 100644 --- a/uobtheatre/productions/migrations/0012_alter_production_status.py +++ b/uobtheatre/productions/migrations/0012_alter_production_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0011_alter_production_options"), ] diff --git a/uobtheatre/productions/migrations/0013_alter_production_facebook_event.py b/uobtheatre/productions/migrations/0013_alter_production_facebook_event.py index a1ccee4e8..6ec803574 100644 --- a/uobtheatre/productions/migrations/0013_alter_production_facebook_event.py +++ b/uobtheatre/productions/migrations/0013_alter_production_facebook_event.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0012_alter_production_status"), ] diff --git a/uobtheatre/productions/migrations/0014_merge_20220101_1347.py b/uobtheatre/productions/migrations/0014_merge_20220101_1347.py index 91d746b0b..60197bbd0 100644 --- a/uobtheatre/productions/migrations/0014_merge_20220101_1347.py +++ b/uobtheatre/productions/migrations/0014_merge_20220101_1347.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0008_auto_20211202_1601"), ("productions", "0013_alter_production_facebook_event"), diff --git a/uobtheatre/productions/migrations/0015_auto_20220101_1348.py b/uobtheatre/productions/migrations/0015_auto_20220101_1348.py index 1e60a76e8..1e84f5899 100644 --- a/uobtheatre/productions/migrations/0015_auto_20220101_1348.py +++ b/uobtheatre/productions/migrations/0015_auto_20220101_1348.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("societies", "0006_alter_society_options"), ("productions", "0014_merge_20220101_1347"), diff --git a/uobtheatre/productions/migrations/0016_auto_20220113_1416.py b/uobtheatre/productions/migrations/0016_auto_20220113_1416.py index e1b894220..718fc941d 100644 --- a/uobtheatre/productions/migrations/0016_auto_20220113_1416.py +++ b/uobtheatre/productions/migrations/0016_auto_20220113_1416.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0015_auto_20220101_1348"), ] diff --git a/uobtheatre/productions/migrations/0016_merge_20220102_0940.py b/uobtheatre/productions/migrations/0016_merge_20220102_0940.py index 42ae183c1..d68ec8b36 100644 --- a/uobtheatre/productions/migrations/0016_merge_20220102_0940.py +++ b/uobtheatre/productions/migrations/0016_merge_20220102_0940.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0009_alter_production_status"), ("productions", "0015_auto_20220101_1348"), diff --git a/uobtheatre/productions/migrations/0017_alter_production_status.py b/uobtheatre/productions/migrations/0017_alter_production_status.py index e1cc8f440..e1032fd0f 100644 --- a/uobtheatre/productions/migrations/0017_alter_production_status.py +++ b/uobtheatre/productions/migrations/0017_alter_production_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0016_merge_20220102_0940"), ] diff --git a/uobtheatre/productions/migrations/0018_merge_20220113_1935.py b/uobtheatre/productions/migrations/0018_merge_20220113_1935.py index 3a311b7bf..40f236ee7 100644 --- a/uobtheatre/productions/migrations/0018_merge_20220113_1935.py +++ b/uobtheatre/productions/migrations/0018_merge_20220113_1935.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0016_auto_20220113_1416"), ("productions", "0017_alter_production_status"), diff --git a/uobtheatre/productions/migrations/0019_production_venues.py b/uobtheatre/productions/migrations/0019_production_venues.py index cf625b7df..4c8640f78 100644 --- a/uobtheatre/productions/migrations/0019_production_venues.py +++ b/uobtheatre/productions/migrations/0019_production_venues.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("venues", "0004_alter_venue_internal_capacity"), ("productions", "0018_merge_20220113_1935"), diff --git a/uobtheatre/productions/migrations/0020_performance_interval_length_minutes.py b/uobtheatre/productions/migrations/0020_performance_interval_length_minutes.py index e43286161..dbb2fbd7f 100644 --- a/uobtheatre/productions/migrations/0020_performance_interval_length_minutes.py +++ b/uobtheatre/productions/migrations/0020_performance_interval_length_minutes.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0019_production_venues"), ] diff --git a/uobtheatre/productions/migrations/0021_alter_performance_interval_duration_mins.py b/uobtheatre/productions/migrations/0021_alter_performance_interval_duration_mins.py index 936a6334e..7d50f82e2 100644 --- a/uobtheatre/productions/migrations/0021_alter_performance_interval_duration_mins.py +++ b/uobtheatre/productions/migrations/0021_alter_performance_interval_duration_mins.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0020_performance_interval_length_minutes"), ] diff --git a/uobtheatre/productions/migrations/0021_auto_20220612_1317.py b/uobtheatre/productions/migrations/0021_auto_20220612_1317.py index 87b487021..9a7a80f62 100644 --- a/uobtheatre/productions/migrations/0021_auto_20220612_1317.py +++ b/uobtheatre/productions/migrations/0021_auto_20220612_1317.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0020_performance_interval_length_minutes"), ] diff --git a/uobtheatre/productions/migrations/0022_auto_20220612_1331.py b/uobtheatre/productions/migrations/0022_auto_20220612_1331.py index 20fa9c665..a495a76a9 100644 --- a/uobtheatre/productions/migrations/0022_auto_20220612_1331.py +++ b/uobtheatre/productions/migrations/0022_auto_20220612_1331.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0021_auto_20220612_1317"), ] diff --git a/uobtheatre/productions/migrations/0023_auto_20220707_1722.py b/uobtheatre/productions/migrations/0023_auto_20220707_1722.py index 9d7057415..546aa8fa8 100644 --- a/uobtheatre/productions/migrations/0023_auto_20220707_1722.py +++ b/uobtheatre/productions/migrations/0023_auto_20220707_1722.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0022_auto_20220612_1331"), ] diff --git a/uobtheatre/productions/migrations/0024_merge_20220808_2050.py b/uobtheatre/productions/migrations/0024_merge_20220808_2050.py index 02956fb22..e324814a0 100644 --- a/uobtheatre/productions/migrations/0024_merge_20220808_2050.py +++ b/uobtheatre/productions/migrations/0024_merge_20220808_2050.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0021_alter_performance_interval_duration_mins"), ("productions", "0023_auto_20220707_1722"), diff --git a/uobtheatre/productions/migrations/0025_auto_20220904_1804.py b/uobtheatre/productions/migrations/0025_auto_20220904_1804.py index 625426ccf..80ebb0d56 100644 --- a/uobtheatre/productions/migrations/0025_auto_20220904_1804.py +++ b/uobtheatre/productions/migrations/0025_auto_20220904_1804.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0024_merge_20220808_2050"), ] diff --git a/uobtheatre/productions/migrations/0026_auto_20221210_2056.py b/uobtheatre/productions/migrations/0026_auto_20221210_2056.py index ea69e0690..649f3c538 100644 --- a/uobtheatre/productions/migrations/0026_auto_20221210_2056.py +++ b/uobtheatre/productions/migrations/0026_auto_20221210_2056.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("productions", "0025_auto_20220904_1804"), ] diff --git a/uobtheatre/productions/test/factories.py b/uobtheatre/productions/test/factories.py index 9e22c03a9..d4268749d 100644 --- a/uobtheatre/productions/test/factories.py +++ b/uobtheatre/productions/test/factories.py @@ -20,7 +20,6 @@ class ProductionFactory(factory.django.DjangoModelFactory): - name = factory.Faker("sentence", nb_words=3) subtitle = factory.Faker("sentence", nb_words=6) description = factory.Faker("sentence", nb_words=20) @@ -37,7 +36,6 @@ class Meta: class PerformanceFactory(factory.django.DjangoModelFactory): - doors_open = factory.Faker( "future_datetime", tzinfo=timezone.get_current_timezone() ) diff --git a/uobtheatre/productions/test/test_schema.py b/uobtheatre/productions/test/test_schema.py index 9fd3ba91a..b3040c8d3 100644 --- a/uobtheatre/productions/test/test_schema.py +++ b/uobtheatre/productions/test/test_schema.py @@ -39,7 +39,6 @@ @pytest.mark.django_db def test_productions_schema(gql_client): - production = ProductionFactory() performances = [PerformanceFactory(production=production) for i in range(2)] diff --git a/uobtheatre/productions/test/test_system.py b/uobtheatre/productions/test/test_system.py index b1743d53d..7611ddd15 100644 --- a/uobtheatre/productions/test/test_system.py +++ b/uobtheatre/productions/test/test_system.py @@ -333,7 +333,6 @@ def test_total_production_creation_workflow(gql_client): @pytest.mark.django_db def test_correct_capacities(gql_client): - venue_capacity = 207 venue = VenueFactory(internal_capacity=venue_capacity) sg_all_capacity = venue_capacity # 207 diff --git a/uobtheatre/reports/migrations/0001_initial.py b/uobtheatre/reports/migrations/0001_initial.py index 5a5bec9b3..ba13d0ef5 100644 --- a/uobtheatre/reports/migrations/0001_initial.py +++ b/uobtheatre/reports/migrations/0001_initial.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/uobtheatre/reports/models.py b/uobtheatre/reports/models.py index 639149976..1449c5a96 100644 --- a/uobtheatre/reports/models.py +++ b/uobtheatre/reports/models.py @@ -5,7 +5,6 @@ class Reports(models.Model): """A pseudo model to store report permissions""" class Meta: - managed = False # No database table creation or deletion \ # operations will be performed for this model. diff --git a/uobtheatre/reports/reports.py b/uobtheatre/reports/reports.py index b2a68cafe..dc2a5ebd7 100644 --- a/uobtheatre/reports/reports.py +++ b/uobtheatre/reports/reports.py @@ -212,7 +212,6 @@ class OutstandingSocietyPayments(Report): """Generates a report on outstanding balances to be paid to societies""" def run(self): - productions_dataset = DataSet( "Productions", [ diff --git a/uobtheatre/societies/migrations/0001_initial.py b/uobtheatre/societies/migrations/0001_initial.py index 11f68885d..a3460459d 100644 --- a/uobtheatre/societies/migrations/0001_initial.py +++ b/uobtheatre/societies/migrations/0001_initial.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/societies/migrations/0002_society_members.py b/uobtheatre/societies/migrations/0002_society_members.py index 54576c831..ade394ad3 100644 --- a/uobtheatre/societies/migrations/0002_society_members.py +++ b/uobtheatre/societies/migrations/0002_society_members.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("societies", "0001_initial"), diff --git a/uobtheatre/societies/migrations/0003_alter_society_description.py b/uobtheatre/societies/migrations/0003_alter_society_description.py index a68397d79..a00a6b879 100644 --- a/uobtheatre/societies/migrations/0003_alter_society_description.py +++ b/uobtheatre/societies/migrations/0003_alter_society_description.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("societies", "0002_society_members"), ] diff --git a/uobtheatre/societies/migrations/0004_alter_society_members.py b/uobtheatre/societies/migrations/0004_alter_society_members.py index 5a6da23e4..6ba1d3bb1 100644 --- a/uobtheatre/societies/migrations/0004_alter_society_members.py +++ b/uobtheatre/societies/migrations/0004_alter_society_members.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("societies", "0003_alter_society_description"), diff --git a/uobtheatre/societies/migrations/0005_auto_20210924_1401.py b/uobtheatre/societies/migrations/0005_auto_20210924_1401.py index af2fa1f67..1da8ed8db 100644 --- a/uobtheatre/societies/migrations/0005_auto_20210924_1401.py +++ b/uobtheatre/societies/migrations/0005_auto_20210924_1401.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("societies", "0004_alter_society_members"), ] diff --git a/uobtheatre/societies/migrations/0006_alter_society_options.py b/uobtheatre/societies/migrations/0006_alter_society_options.py index 8e5b61972..0dde8a9cd 100644 --- a/uobtheatre/societies/migrations/0006_alter_society_options.py +++ b/uobtheatre/societies/migrations/0006_alter_society_options.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("societies", "0005_auto_20210924_1401"), ] diff --git a/uobtheatre/users/migrations/0001_initial.py b/uobtheatre/users/migrations/0001_initial.py index 1d8e35d8d..5b11e5957 100644 --- a/uobtheatre/users/migrations/0001_initial.py +++ b/uobtheatre/users/migrations/0001_initial.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/users/models.py b/uobtheatre/users/models.py index d46863d48..dc6cddcda 100644 --- a/uobtheatre/users/models.py +++ b/uobtheatre/users/models.py @@ -8,7 +8,6 @@ from uobtheatre.users.abilities import AbilitiesMixin, OpenAdmin, OpenBoxoffice from uobtheatre.utils.models import BaseModel - if TYPE_CHECKING: pass @@ -57,7 +56,7 @@ def has_perm(self, perm: str, obj=None) -> bool: bool: Whether the user has permission to access the object/model. """ if not "." in perm and obj: - perm = obj._meta.app_label + "." + perm # pylint: disable=protected-access + perm = obj._meta.app_label + "." + perm # pylint: disable=protected-access return super().has_perm(perm) or (super().has_perm(perm, obj) if obj else False) diff --git a/uobtheatre/users/test/test_abilities.py b/uobtheatre/users/test/test_abilities.py index 996de7621..fd3da12af 100644 --- a/uobtheatre/users/test/test_abilities.py +++ b/uobtheatre/users/test/test_abilities.py @@ -24,7 +24,6 @@ def test_ability_mixin_perms(): assign_perm("change_production", user, production) with patch.object(OpenBoxoffice, "user_has_for", return_value=True): - assert ( user.get_perms(user, production).sort() == [ diff --git a/uobtheatre/users/test/test_backends.py b/uobtheatre/users/test/test_backends.py index 59fd50999..b4fa5ab5b 100644 --- a/uobtheatre/users/test/test_backends.py +++ b/uobtheatre/users/test/test_backends.py @@ -31,7 +31,6 @@ def test_graphql_jwt_auth_backend( return_value=get_user_response, side_effect=JSONWebTokenError() if raise_jwt_exception else None, ) as mock_get_user_by_token: - if exception: with pytest.raises(AuthenticationFailed, match=exception): backend.authenticate(request) @@ -65,7 +64,6 @@ def test_graphql_jwt_auth_backend_invalid_header(meta, exception): with mock.patch( "uobtheatre.users.backends.get_user_by_token" ) as mock_get_user_by_token: - if exception: with pytest.raises(AuthenticationFailed, match=exception): response = backend.authenticate(request) diff --git a/uobtheatre/users/test/test_models.py b/uobtheatre/users/test/test_models.py index 0322456e1..e47ba972a 100644 --- a/uobtheatre/users/test/test_models.py +++ b/uobtheatre/users/test/test_models.py @@ -36,6 +36,7 @@ def test_has_perm_via_object(): assert user.has_perm("change_production", production) assert user.has_perm("productions.change_production", production) + @pytest.mark.django_db def test_has_perm_via_group(): user = UserFactory() diff --git a/uobtheatre/users/test/test_schema.py b/uobtheatre/users/test/test_schema.py index 231ee00d8..d63c19360 100644 --- a/uobtheatre/users/test/test_schema.py +++ b/uobtheatre/users/test/test_schema.py @@ -11,7 +11,6 @@ @pytest.mark.django_db def test_user_schema(gql_client): - user = gql_client.login().user # Create some booking diff --git a/uobtheatre/utils/celery_migrations/0001_initial.py b/uobtheatre/utils/celery_migrations/0001_initial.py index 0e280a1c0..d884cefe4 100644 --- a/uobtheatre/utils/celery_migrations/0001_initial.py +++ b/uobtheatre/utils/celery_migrations/0001_initial.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/uobtheatre/utils/exceptions.py b/uobtheatre/utils/exceptions.py index 54ab25c2f..a18e36dfa 100644 --- a/uobtheatre/utils/exceptions.py +++ b/uobtheatre/utils/exceptions.py @@ -18,6 +18,7 @@ from django.db import transaction from graphene.utils.str_converters import to_camel_case from graphene_django.types import ErrorType +from sentry_sdk import capture_exception class ExceptionMiddleware: # pragma: no cover @@ -28,6 +29,7 @@ class ExceptionMiddleware: # pragma: no cover def on_error(self, exc): traceback.print_tb(exc.__traceback__) + capture_exception(exc) raise exc def resolve(self, next, root, info, **kwargs): # pylint: disable=redefined-builtin @@ -90,7 +92,7 @@ def resolve_errors(self, info): ] return non_field_errors + field_errors - raise Exception("Internal error") # pylint: disable=broad-exception-raised + raise Exception("Internal error") # pylint: disable=broad-exception-raised class MutationException(Exception): diff --git a/uobtheatre/utils/forms.py b/uobtheatre/utils/forms.py index db8fab70a..f9cb60be1 100644 --- a/uobtheatre/utils/forms.py +++ b/uobtheatre/utils/forms.py @@ -58,7 +58,7 @@ def __init__(self, *args, user: User = None, **kwargs): self.user = user if len(self.data.keys()) == 0 or "id" in self.data: - for (key, _) in list(self.fields.items()): + for key, _ in list(self.fields.items()): self.fields[key].required = False def _clean_fields(self): diff --git a/uobtheatre/utils/test/factories.py b/uobtheatre/utils/test/factories.py index cb9cac5b5..3dded2834 100644 --- a/uobtheatre/utils/test/factories.py +++ b/uobtheatre/utils/test/factories.py @@ -3,7 +3,6 @@ class TaskResultFactory(factory.django.DjangoModelFactory): - status = "SUCCESS" task_name = factory.Faker("sentence", nb_words=2) task_id = factory.Faker("uuid4") diff --git a/uobtheatre/venues/migrations/0001_initial.py b/uobtheatre/venues/migrations/0001_initial.py index b685dc5da..b03657702 100644 --- a/uobtheatre/venues/migrations/0001_initial.py +++ b/uobtheatre/venues/migrations/0001_initial.py @@ -6,7 +6,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/uobtheatre/venues/migrations/0002_auto_20210805_1525.py b/uobtheatre/venues/migrations/0002_auto_20210805_1525.py index d2d218a55..605bd35ce 100644 --- a/uobtheatre/venues/migrations/0002_auto_20210805_1525.py +++ b/uobtheatre/venues/migrations/0002_auto_20210805_1525.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("addresses", "0002_auto_20210805_1525"), ("venues", "0001_initial"), diff --git a/uobtheatre/venues/migrations/0003_alter_venue_description.py b/uobtheatre/venues/migrations/0003_alter_venue_description.py index 1a4e7fc5f..5096ec374 100644 --- a/uobtheatre/venues/migrations/0003_alter_venue_description.py +++ b/uobtheatre/venues/migrations/0003_alter_venue_description.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("venues", "0002_auto_20210805_1525"), ] diff --git a/uobtheatre/venues/migrations/0004_alter_venue_internal_capacity.py b/uobtheatre/venues/migrations/0004_alter_venue_internal_capacity.py index 0a27c79e6..078553371 100644 --- a/uobtheatre/venues/migrations/0004_alter_venue_internal_capacity.py +++ b/uobtheatre/venues/migrations/0004_alter_venue_internal_capacity.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("venues", "0003_alter_venue_description"), ] diff --git a/uobtheatre/venues/schema.py b/uobtheatre/venues/schema.py index e7dfbf4ff..7619995ab 100644 --- a/uobtheatre/venues/schema.py +++ b/uobtheatre/venues/schema.py @@ -23,7 +23,6 @@ class Meta: class VenueNode(DjangoObjectType): - productions = DjangoFilterConnectionField( "uobtheatre.productions.schema.ProductionNode" ) diff --git a/uobtheatre/venues/test/factories.py b/uobtheatre/venues/test/factories.py index b597f3737..5d38a7cfc 100644 --- a/uobtheatre/venues/test/factories.py +++ b/uobtheatre/venues/test/factories.py @@ -6,7 +6,6 @@ class VenueFactory(factory.django.DjangoModelFactory): - name = factory.Faker("sentence", nb_words=2) description = factory.Faker("paragraph", nb_sentences=3) internal_capacity = factory.Faker("pyint") @@ -18,7 +17,6 @@ class Meta: class SeatGroupFactory(factory.django.DjangoModelFactory): - name = factory.Faker("sentence", nb_words=2) venue = factory.SubFactory(VenueFactory) capacity = factory.Faker("pyint")