Skip to content

Commit

Permalink
Merge Release v6.17.0 into main (#1507)
Browse files Browse the repository at this point in the history
* Added Ally Logo page (#1354)

* Removed dbbackup because it does not solve to intended problem (#1355)

* Removed ScoutAPM since it is no longer used (#1360)

* only upload book data if the resource has a salesforce abbr (#1364)

* Added cache clearing for general pages and fixed sticky note (#1365)

* Changed query to sort by title instead of path (#1368)

* Updated Partner query, removed reviews and updated tests (#1371)

* Updated partner query, removed review sync and made all visible on website

* Removed reviews and updated tests

* Bump pillow from 9.1.1 to 9.3.0 in /requirements (#1366)

Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.1.1 to 9.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@9.1.1...9.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Volo <[email protected]>

* adding k12 pages, subjects

* Add check on queryset for Resources (#1375)

* Add check on queryset for Resources

* Added test for bad slug

* Removed Testimonial fields from School listing (#1377)

* Clear resources on page save (#1381)

* Added checks for book before creating resource download or sending to Salesforce (#1384)

* Added checks for book before creating or sending to Salesforce

* Edited if statement

* Model and migration for new learning research page

* Add new research page to home subpages

* Add page to test

* Python spacing

* Update help text for some fields

* fix class naming convention

* added student and instructor resources to k12 subject pages

* Tidy pages/model.py

* Remove old research page in favor of new learning-research page

* Remove unused field

* remove seo title and search description from snippets/models

* reverted update_partners.py

* Added Ally Logo page (#1354)

* Added cache clearing for general pages and fixed sticky note (#1365)

* Ne wmigration for learningresearch page

* Upgrade to Wagtail 3 (#1398)

* Added Ally Logo page (#1354)

* Changed wagtail.core to wagtail

* Changed wagtail.tests to wagtail.test

* Set StreamField to have use_json_field parameter

* FieldPanel changes

* Update to Wagtail 3.0.3

* merge migrations after rebase

* Updated merged code for Wagtail 3

* Updated base.txt and locked-requirements.txt

* Updated mapbox to 0.18.1 (#1403)

* change schools/mapbox to sync monthly instead of daily (#1404)

* Merge migration per wagtail

* Remove all geneeral pages from sitemap except kinetic (#1402)

* adjusting k12 data for frontend needs (#1405)

* adjusting data for frontend needs

- add label to subject dropdown
- split name field in testimonials
- fix images coming from snippets
- modify subject category labels
- add titles and icons to resources
- move resources to book level

* fix resource icons for k12 pages

* add link_document_url to k12 subject pages

* Added links to documentation in Confluence, Added Contributing file (#1414)

* Fix import export (#1415)

* Fixed translation and locale in export

* More improvements

* Lookup documents by title when importing

* Uncommented save of a page

* All documents now included

* sort by book and git ignore icloud files (#1418)

* subject sort in release added to development (#1420)

* Errata form hotfix (#1423)

* Removed /general/ from kinetic page sitemap entry (#1421)

* Link preview fix (#1416)

* Added page template to blog posts

* Added page template to news app

* Moved page template to blog folder

* Folder to match FE URL with page template

* Removed folders that did not work and put page template under news

* middleware to create link preview

* All bots working now

* Added ua_parser to base.txt

* Looked up correct object based on url path

* Home page working and wrote tests

* Removed NewsArticle use of template since it is not needed

* Cleaned up template HTML

* Improved HTML formatting

* Remove all isbn 10 fields from books (#1428)

* K12 tags fix into development (#1429)

* Assignable page added to CMS (#1430)

* First pass at assignables page

* Assignable page added

* Tweaked Assignable fields based on new text document (#1431)

* Tweaked fields based on new text document

* Latest round of changes

* renamed book columns

* Remove reference to assignable_book_link

* Errata Export hotfix in development branch (#1440)

* add resource_unlocked to k12 faculty resource lists (#1436)

* Remove one page limitation on FAQ (#1441)

* Replaced heading with heading_title_image (#1442)

* Added add assignable cta fields (#1443)

* Added add assignable cta fields

* Added FAQ section

* update readme versions and docker configs (#1447)

* add cnx_id to book data (#1446)

* Added field to resource API to match old Book API resource field (#1445)

* Added resource_category field to resource snippets (#1448)

* Added resource_category field to resource snippets

* Added missing resource category on FacultyResource model for books

* adding assignable resource (#1452)

* adding assignable resource

* Update 0053_alter_errata_resource.py

* Update query for Opps to fetch UUID through the contact (#1453)

* Added image carousel for Assignable (#1454)

* Snippet for no webinar message (#1455)

* update Book relationship query (#1459)

* Fixed object structure from Salesforce (#1460)

* remove student numbers from opp query (#1461)

* Menus (#1462)

* Code for adding menus for site to CMS

* Menus working, but improvements needed

* Made cleaner json

* Added tests

* Added new fields to Press page (#1463)

* Resource external link no longer required (#1464)

* Resource external link no longer required

* Made link text not required

* Improve handling pf privacy policy and encoded slugs (#1466)

* Fixed resource link still being required (#1467)

* Fixed resource link still being required

* Fixed menu change

* Removed validation errors on resources

* Added About field

* Removed locked-requirements.txt to prevent dependabot PRs

* Add K12 and Research CTAs to home page (#1470)

* readd SF name/abbr to book detail (#1472)

* Tweaks to improve blog search results (#1471)

* Tweaks to improve blog search results

* Added subjects, categories and collections to search

* Order by title (#1473)

* Added write for us and editorial calendar to sitemap (#1474)

* Added footer fields to news index page (#1475)

* Modified errata query to prefetch book, removed review totals from Partners (#1476)

* Modified errata query to prefetch book, removed review totals from Partners

* Fixed query

* undo last commit

* Import working for non-book pages (#1478)

* Handle exporting non-book pages

* Changed content type check

* improvements for non-book pages

* Import working for non-book pages

* added missing function and removed unused function

* Removed print statements

* Removed openstax logo fields from ally logos page (#1481)

* Added book_uuid field and copied cnx_id value into it (#1482)

* Only return live blog posts when querying by subject, collection or content type (#1483)

* Updated packages (#1484)

* Improved blog search results (#1486)

* Fixed n+1 query issue on news search (#1487)

* Webinars page (#1488)

* Added collections and search to webinar page

* Fixed search and search url

* Removed print stmts and added test for search

* Removed unneeded import

* Removed websearch parameter

* Added tests for 2 pages

* changed name of webinar search API

* K12 sitemap fix (#1490)

* Sitemap fix for k12 and new subjects page

* fixed k12 sitemap

* New subjects page is in sitemap if flag is set to display

* Now deals with -books on subject slugs correctly

* Added missing Page tests (#1494)

* added tests for 7 pages

* added several more tests

* Added Assignable snippet (#1495)

* Started adding snippet

* Added assignable available snippet

* Added missing snippets tests (#1496)

* Fix for docker on new macs (#1499)

* Update models.py (#1502)

* Update models.py

* Create 0054_alter_errata_resource.py

---------

Co-authored-by: Staxly <[email protected]>

* Added other missing tests (#1500)

* Webview settings test and start of press pages tests

* Tests for allies

* Additional tests for import-export

* Added test for admin filter

* Tests for mock functions

* tests for Press pages

* modify to test press page creation

* Cleaned up news test code

---------

Co-authored-by: Michael Harrison <[email protected]>

* adding Assignable source to autofill (#1504)

Co-authored-by: Staxly <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Michael Volo <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dmoreno <[email protected]>
Co-authored-by: Chris Bendel <[email protected]>
Co-authored-by: dmoreno27 <[email protected]>
Co-authored-by: Devynn Moreno <[email protected]>
Co-authored-by: Colby <[email protected]>
Co-authored-by: Devynn Moreno <[email protected]>
Co-authored-by: Thomas Woodward <[email protected]>
Co-authored-by: Staxly <[email protected]>
  • Loading branch information
11 people authored Sep 22, 2023
1 parent cd23122 commit 0ea6f6d
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 9 deletions.
49 changes: 49 additions & 0 deletions allies/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from unittest import TestCase

from allies.models import AllySubject, Ally
from snippets.models import Subject

from wagtail.test.utils import WagtailTestUtils, WagtailPageTests


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.")
self.math.save()

self.economics = Subject(name="Economics", page_content="Economics page content.",
seo_title="Economics SEO Title",
search_description="Economics page description.")
self.economics.save()

self.subject = Subject(name="Science", page_content="Science page content.", seo_title="Science SEO Title",
search_description="Science page description.")
self.subject.save()

self.ally = Ally(online_homework=True,
adaptive_courseware=False,
customization_tools=False,
is_ap=False,
do_not_display=False,
heading='Ally Heading',
short_description='short description',
long_description='long description',
slug='new-ally',
depth=1,
title='Ally Page',
path='ally')
self.ally.save()

def test_can_create_ally_subject(self):
ally_subject = AllySubject(subject=self.math, ally=self.ally)
ally_subject.save()
result = AllySubject.objects.all()[0]
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)
9 changes: 8 additions & 1 deletion api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from wagtail.images.tests.utils import Image, get_test_image_file
from wagtail.documents.models import Document

from api.models import FeatureFlag
from api.models import FeatureFlag, WebviewSettings

from shared.test_utilities import assertPathDoesNotRedirectToTrailingSlash, mock_user_login

Expand Down Expand Up @@ -164,3 +164,10 @@ def test_errata_resource_api(self):
self.assertNotIn('content', 'OpenStax Concept Coach')
self.assertNotIn('content', 'Rover by OpenStax')
self.assertEqual(response.status_code, 200)

def test_webview_settings_api(self):
wvs = WebviewSettings.objects.create(name='Test', value='Test value')
response = self.client.get('/apps/cms/api/webview-settings/')
self.assertEqual(response.status_code, 200)
self.assertIn("\"value\": \"Test value\"", response.content.decode("utf-8"))

34 changes: 34 additions & 0 deletions errata/migrations/0054_alter_errata_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.1.7 on 2023-09-11 19:14

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("errata", "0053_alter_errata_resource"),
]

operations = [
migrations.AlterField(
model_name="errata",
name="resource",
field=models.CharField(
blank=True,
choices=[
("Textbook", "Textbook"),
("iBooks version", "iBooks version"),
("Instructor solution manual", "Instructor solution manual"),
("Student solution manual", "Student solution manual"),
("OpenStax Tutor", "OpenStax Tutor"),
("OpenStax Concept Coach", "OpenStax Concept Coach"),
("Rover by OpenStax", "Rover by OpenStax"),
("Kindle", "Kindle"),
("Study guide in online view", "Study guide in online view"),
("Assignable", "Assignable"),
("Other", "Other"),
],
max_length=100,
null=True,
),
),
]
3 changes: 1 addition & 2 deletions errata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
('OpenStax Tutor', 'OpenStax Tutor'),
('OpenStax Concept Coach', 'OpenStax Concept Coach'),
('Rover by OpenStax', 'Rover by OpenStax'),
('OpenStax + SE', 'OpenStax + SE'),
('Kindle', 'Kindle'),
('Study guide in online view', 'Study guide in online view'),
('Assignable', 'Assignable'),
Expand Down Expand Up @@ -265,7 +264,7 @@ def save(self, *args, **kwargs):
self.resolution_notes = 'This issue is occurring within a deprecated product that OpenStax no longer maintains. For updated content, please refer to openstax.org and view online or download a free PDF that may be used on your device.'

#auto filling a couple of fields if it is clear that it is an assessment errata based on the text that tutor fills into the additional_location_information field
if self.additional_location_information and self.resource == 'OpenStax Tutor' and ('@' in self.additional_location_information.split()[0]):
if self.additional_location_information and (self.resource == 'OpenStax Tutor' or self.resource == 'Assignable') and ('@' in self.additional_location_information.split()[0]):
self.is_assessment_errata = 'Yes'
self.assessment_id = self.additional_location_information.split('@', )[0]

Expand Down
12 changes: 12 additions & 0 deletions extraadminfilters/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.test import TestCase

from extraadminfilters.filters import UnionFieldListFilter


class FilterTests(TestCase):

def test_create_union_field_filter(self):
list_filter = [
("book", UnionFieldListFilter),
]
self.assertEquals(list_filter[0][1], UnionFieldListFilter)
52 changes: 51 additions & 1 deletion news/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime
import json

from django.utils import timezone
Expand Down Expand Up @@ -182,7 +183,7 @@ def setUpTestData(cls):
root_page.add_child(instance=homepage)
# create book index page
news_index = NewsIndex(title="News Index")
# add book index to homepage

homepage.add_child(instance=news_index)

cls.news_index = Page.objects.get(id=news_index.id)
Expand Down Expand Up @@ -257,4 +258,53 @@ def test_search_blog_collection_and_two_subjects(self):
self.assertContains(response, 'Math')


class PressTests(WagtailPageTests):
def setUp(self):
press_index = PressIndex.objects.all()[0]
self.press_release = PressRelease(title='Press release',
date=datetime.datetime.now(),
author='someone',
heading='heading',
excerpt='this is a press release',
slug='press-release-1',
path=' ',
depth=1,
body=json.dumps(
[{"id": "ae6f048b-6eb5-42e7-844f-cfcd459f81b5", "type": "heading",
"value": "Press release"},
{"id": "a21bcbd4-fec4-432e-bf06-966d739c6de9", "type": "paragraph",
"value": "<p data-block-key=\"wr6bg\">This is a test of a press release.</p><p data-block-key=\"d57h\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>"},
{"id": "4d339739-131c-4547-954b-0787afdc4914", "type": "tagline",
"value": "This is a test"}]
)
)
press_index.add_child(instance=self.press_release)

@classmethod
def setUpTestData(cls):
root_page = Page.objects.get(title="Root")
homepage = HomePage(title="Hello World", slug="hello-world")
root_page.add_child(instance=homepage)

press_index = PressIndex(about='About press index',
press_inquiry_phone='111-111-1111',
press_inquiry_email='[email protected]',
experts_heading='experts heading',
experts_blurb='experts blurb',
infographic_text='infographic text',
title='Press Index',
path=' ',
slug='press',
depth=1)
# add book index to homepage
homepage.add_child(instance=press_index)
cls.press_index = Page.objects.get(id=press_index.id)

def test_can_create_press_release(self):
self.assertEqual(self.press_release.title, 'Press release')






18 changes: 13 additions & 5 deletions shared/tests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
from wagtail.test.utils import WagtailPageTests
from shared.test_utilities import assertPathDoesNotRedirectToTrailingSlash
from django.test import TestCase
from shared.test_utilities import mock_user_login, RequestMock

from unittest.mock import MagicMock

class WagtailTests(WagtailPageTests):
def setUp(self):
pass
class TestMockUserLogin(TestCase):
def test_mock_user_login(self):
user = mock_user_login()
self.assertEqual(user.openstaxuserprofile.openstax_accounts_uuid, '467cea6c-8159-40b1-90f1-e9b0dc26344c')


class TestMockRequest(TestCase):
def test_create_mock_request(self):
req = RequestMock()
self.assertEqual(req.cookies, {})

1 change: 1 addition & 0 deletions wagtailimportexport/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,4 @@ def content_type_by_model(model):
return None
else:
return str(content_type[0].pk)

36 changes: 36 additions & 0 deletions wagtailimportexport/tests/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from unittest import mock

from django.forms import FileField, ModelChoiceField
from django.test import TestCase, Client
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.files import File

from pages.models import HomePage
from wagtailimportexport.forms import ImportPage, ExportPage


class TemplateTests(TestCase):
def setUp(self):
self.client = Client()

def test_import_template(self):
response = self.client.get('/admin/import-export/import-page/', follow=True)
self.assertEqual(response.status_code, 200)

def test_export_template(self):
response = self.client.get('/admin/import-export/export-page/', follow=True)
self.assertEqual(response.status_code, 200)

def test_import_form(self):
zip = SimpleUploadedFile("test.zip", b"file content", content_type="application/zip")
form_data = {"parent_page": 1}
form = ImportPage(form_data, files={'file': zip})
self.assertTrue(form.is_valid(), form.errors)

def test_export_form(self):
form_data = {"root_page": 1}
form = ExportPage(form_data)
self.assertTrue(form.is_valid(), form.errors)



0 comments on commit 0ea6f6d

Please sign in to comment.