Skip to content

Commit

Permalink
Revert "Merge development to main (release from Dec 2023) (#1537)"
Browse files Browse the repository at this point in the history
This reverts commit 4e66d25.
  • Loading branch information
mwvolo authored Dec 20, 2023
1 parent 4e66d25 commit bfc2903
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 99 deletions.
7 changes: 5 additions & 2 deletions allies/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from allies.models import AllySubject, Ally
from snippets.models import Subject

from wagtail.test.utils import WagtailTestUtils, WagtailPageTestCase
from wagtail.test.utils import WagtailTestUtils, WagtailPageTests


class AlliesTests(WagtailPageTestCase):
class AlliesTests(WagtailPageTests):
def setUp(self):
self.math = Subject(name="Math", page_content="Math page content.", seo_title="Math SEO Title",
search_description="Math page description.")
Expand Down Expand Up @@ -42,5 +42,8 @@ def test_can_create_ally_subject(self):
self.assertEquals('Math', result.get_subject_name())

def test_can_create_ally(self):
#ally_subject = AllySubject(subject=self.math, ally=self.ally)
#ally_subject.save()
result = Ally.objects.all()[0]
#print('ally subject: ' + str(result))
self.assertEquals('Ally Heading', result.heading)
2 changes: 1 addition & 1 deletion books/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ class BookIndex(Page):

@property
def books(self):
books = Book.objects.live().filter(locale=self.locale).exclude(book_state='unlisted').order_by('title')
books = Book.objects.live().filter(locale=self.locale).filter(self.book_state is not 'unlisted').order_by('title')
book_data = []
for book in books:
has_faculty_resources = BookFacultyResources.objects.filter(book_faculty_resource=book).exists()
Expand Down
4 changes: 2 additions & 2 deletions books/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import vcr

from wagtail.test.utils import WagtailPageTestCase
from wagtail.test.utils import WagtailPageTests
from wagtail.models import Page

import snippets.models
Expand All @@ -14,7 +14,7 @@
import datetime


class BookTests(WagtailPageTestCase):
class BookTests(WagtailPageTests):

def setUp(self):
self.client = Client()
Expand Down
18 changes: 0 additions & 18 deletions donations/migrations/0008_thankyounote_source.py

This file was deleted.

1 change: 0 additions & 1 deletion donations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class ThankYouNote(models.Model):
created = models.DateField(auto_now_add=True)
consent_to_share_or_contact = models.BooleanField(default=False)
contact_email_address = models.EmailField(blank=True, null=True)
source = models.CharField(max_length=255, default="", blank=True)

class DonationPopup(models.Model):
download_image = models.ImageField(null=True, blank=True)
Expand Down
6 changes: 2 additions & 4 deletions donations/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ class Meta:
'institution',
'created',
'consent_to_share_or_contact',
'contact_email_address',
'source')
'contact_email_address')
read_only_fields = ('thank_you_note',
'first_name',
'last_name',
'institution',
'created',
'consent_to_share_or_contact',
'contact_email_address',
'source')
'contact_email_address')


class DonationPopupSerializer(serializers.ModelSerializer):
Expand Down
2 changes: 1 addition & 1 deletion donations/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_donation_api_get(self):
class ThankYouNoteTest(APITestCase, TestCase):

def test_thank_you_note_api_post(self):
data = {"thank_you_note":"OpenStax is the best! Loved not paying for a book", "last_name": "Drew", "first_name": "Jessica", "institution": "Rice University", "consent_to_share_or_contact": "True", "contact_email_address": "[email protected]", "source": "PDF download"}
data = {"thank_you_note":"OpenStax is the best! Loved not paying for a book", "last_name": "Drew", "first_name": "Jessica", "institution": "Rice University", "consent_to_share_or_contact": "True", "contact_email_address": "[email protected]"}
response = self.client.post('/apps/cms/api/donations/thankyounote/', data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
tyn = ThankYouNote.objects.filter(last_name='Drew').values()
Expand Down
4 changes: 1 addition & 3 deletions donations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ def post(self, request):
institution = request.data['institution']
consent_to_share_or_contact = request.data.get('consent_to_share_or_contact', False)
contact_email_address = request.data.get('contact_email_address', '')
source = request.data.get('source', '')

ty_note = ThankYouNote.objects.create(thank_you_note=thank_you_note,
first_name=first_name,
last_name=last_name,
institution=institution,
consent_to_share_or_contact=consent_to_share_or_contact,
contact_email_address=contact_email_address,
source=source)
contact_email_address=contact_email_address)

serializer = ThankYouNoteSerializer(data=request.data)
if serializer.is_valid():
Expand Down
6 changes: 3 additions & 3 deletions errata/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class Meta:
class CustomExportResource(resources.ModelResource):
location = Field(attribute='location', column_name='Location')
detail = Field(attribute='detail', column_name='Detail')
resolution_notes = Field(attribute='resolution_notes', column_name='Resolution Notes')
resolution = Field(attribute='resolution', column_name='Resolution')
error_type = Field(attribute='error_type', column_name='Error Type')

class Meta:
model = Errata
fields = ('location', 'detail', 'resolution_notes', 'error_type')
export_order = ('location', 'detail', 'resolution_notes', 'error_type')
fields = ('location', 'detail', 'resolution', 'error_type')
export_order = ('location', 'detail', 'resolution', 'error_type')

def custom_export_action(modeladmin, request, queryset):
resource = CustomExportResource()
Expand Down
17 changes: 0 additions & 17 deletions errata/migrations/0056_alter_errata_options.py

This file was deleted.

6 changes: 3 additions & 3 deletions news/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.utils import timezone
from django.test import TestCase
from wagtail.test.utils import WagtailPageTestCase
from wagtail.test.utils import WagtailPageTests
from wagtail.models import Page
from pages.models import HomePage
from shared.test_utilities import assertPathDoesNotRedirectToTrailingSlash
Expand All @@ -12,7 +12,7 @@
from snippets.models import Subject, BlogContentType, BlogCollection


class NewsTests(WagtailPageTestCase, TestCase):
class NewsTests(WagtailPageTests, TestCase):
def setUp(self):
# create collections
self.learning = BlogCollection(name='Teaching and Learning', description='this is a collection')
Expand Down Expand Up @@ -258,7 +258,7 @@ def test_search_blog_collection_and_two_subjects(self):
self.assertContains(response, 'Math')


class PressTests(WagtailPageTestCase):
class PressTests(WagtailPageTests):
def setUp(self):
press_index = PressIndex.objects.all()[0]
self.press_release = PressRelease(title='Press release',
Expand Down
4 changes: 2 additions & 2 deletions oxmenus/tests.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json

from django.test import TestCase
from wagtail.test.utils import WagtailPageTestCase
from wagtail.test.utils import WagtailPageTests
from oxmenus.models import Menus


class OXMenuTests(WagtailPageTestCase, TestCase):
class OXMenuTests(WagtailPageTests, TestCase):
def setUp(self):
oxmenu = Menus(name="What we do",
menu=json.dumps(
Expand Down
12 changes: 6 additions & 6 deletions pages/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django.test import TestCase, Client
from django.core.management import call_command
from wagtail.test.utils import WagtailTestUtils, WagtailPageTestCase
from wagtail.test.utils import WagtailTestUtils, WagtailPageTests
from wagtail.models import Page
from pages.models import (HomePage,
ContactUs,
Expand Down Expand Up @@ -45,7 +45,7 @@
from shared.test_utilities import assertPathDoesNotRedirectToTrailingSlash, mock_user_login
from http import cookies

class HomePageTests(WagtailPageTestCase):
class HomePageTests(WagtailPageTests):

def setUp(self):
mock_user_login()
Expand Down Expand Up @@ -106,7 +106,7 @@ def test_allowed_subpages(self):
Assignable,
})

class PageTests(WagtailPageTestCase):
class PageTests(WagtailPageTests):
def setUp(self):
mock_user_login()
root_page = Page.objects.get(title="Root")
Expand Down Expand Up @@ -497,7 +497,7 @@ def test_can_create_assignable_page(self):
self.assertEqual(retrieved_page.title, "Assignable Page")


class ErrataListTest(WagtailPageTestCase):
class ErrataListTest(WagtailPageTests):

def setUp(self):
mock_user_login()
Expand All @@ -522,7 +522,7 @@ def test_can_create_errata_list_page(self):
self.assertEqual(retrieved_page.title, "Errata List Template")


class SubjectsPageTest(WagtailPageTestCase):
class SubjectsPageTest(WagtailPageTests):

def setUp(self):
mock_user_login()
Expand All @@ -544,7 +544,7 @@ def test_can_create_subjects_page(self):
self.assertEqual(retrieved_page.title, "Subjects")


class SubjectPageTest(WagtailPageTestCase):
class SubjectPageTest(WagtailPageTests):

def setUp(self):
mock_user_login()
Expand Down
7 changes: 3 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ django-import-export==2.8.0
django-libsass==0.9
django-rest-auth==0.9.5
django-reversion==5.0.0
djangorestframework==3.14.0
django-ses==3.0.1
django-storages==1.12.3
django-taggit>=3.1.0
django-taggit>=3.0.0
future==0.18.2
html2text==2020.1.16 # used in news feed
jsonfield==3.1.0
mapbox==0.18.1
MarkupPy==1.14
odfpy==1.4.1
openpyxl==3.0.10
psycopg2>=2.9.9
psycopg2>=2.9.5
pycryptodome==3.14.1 # for using the SSO cookie from accounts
PyJWE==1.0.0
sentry-sdk
Expand All @@ -31,7 +30,7 @@ ua_parser==0.16.1
unicodecsv==0.14.1
Unidecode==1.3.4
vcrpy==4.1.1 # for recording test interactions with third-party APIs
wagtail==4.1.9
wagtail==4.0.4
Wand==0.6.7 # for supporting animated gifs
whitenoise==6.1.0
xlrd==2.0.1
Expand Down
4 changes: 2 additions & 2 deletions salesforce/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from rest_framework.test import APITestCase
from rest_framework.test import APIRequestFactory

from wagtail.test.utils import WagtailPageTestCase
from wagtail.test.utils import WagtailPageTests
from wagtail.models import Page
from wagtail.documents.models import Document

Expand Down Expand Up @@ -104,7 +104,7 @@ def test_all_partners_no_reviews(self):
# self.assertEqual(response.data['status'], 'Deleted')


class SalesforceTest(LiveServerTestCase, WagtailPageTestCase):
class SalesforceTest(LiveServerTestCase, WagtailPageTests):

def setUp(self):
mock_user_login()
Expand Down
14 changes: 0 additions & 14 deletions snippets/migrations/0031_merge_20231101_1313.py

This file was deleted.

14 changes: 0 additions & 14 deletions snippets/migrations/0032_merge_20231117_0830.py

This file was deleted.

4 changes: 2 additions & 2 deletions webinars/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

from django.test import TestCase
from django.utils import timezone
from wagtail.test.utils import WagtailPageTestCase
from wagtail.test.utils import WagtailPageTests

from snippets.models import Subject, WebinarCollection
from webinars.models import Webinar


class WebinarTests(WagtailPageTestCase, TestCase):
class WebinarTests(WagtailPageTests, TestCase):
def setUp(self):
# create subjects
self.math = Subject(name="Math", page_content="Math page content.", seo_title="Math SEO Title",
Expand Down

0 comments on commit bfc2903

Please sign in to comment.