mitodl / ocw-studio

Open Source Courseware authoring tool
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Allow editing and publishing of test sites #2114

Closed gumaerc closed 7 months ago

gumaerc commented 7 months ago

What are the relevant tickets?

Closes https://github.com/mitodl/ocw-studio/issues/2112

Description (What does it do?)

This PR makes some changes that allows editing of test sites directly from the ocw-studio sites UI and ensures that any publishing action pushes the output up to the test bucket instead of the draft / live buckets. Instead of 2 specific env variables for the test sites (OCW_WWW_TEST_SLUG and OCW_COURSE_TEST_SLUG) we now have TEST_ROOT_WEBSITE_NAME and OCW_TEST_SITE_SLUGS. The OCW_TEST_SITE_SLUGS variable is intended to be a list of strings, allowing the specification of any number of test sites to be included in the end to end test pipeline. In e2e_test_site_pipeline.py, these sites are iterated and pipeline steps are generated based on them and added to the across. The logic determining what to override if a site is a test site was moved directly into site_pipeline.py. Whether or not a site is a test site is determined simply by seeing if the current site's name is in settings.OCW_TEST_SITE_SLUGS. If this is true;

How can this be tested?

gumaerc commented 7 months ago

This is ready for review, although something I find myself wondering at this point is if we should restrict editing of the test sites to superusers? It's probably prudent to prevent accidental changes of the test sites, because one could break the end to end test pipeline by changing content asserted by Playwright tests. This could be addressed pretty easily though, by running loaddata on the fixtures again. Still, probably best to be cautious.