Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub action to run tests; fix erroring test for ChantEditSyllabificationView #1526

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/django_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: django-tests
on:
pull_request:
types: [opened, synchronize]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: mkdir -p config/envs
- uses: SpicyPizza/[email protected]
with:
envkey_POSTGRES_DB: test_cantusdb
envkey_POSTGRES_USER: test_user
envkey_POSTGRES_HOST: postgres
envkey_POSTGRES_PORT: 5432
envkey_PROJECT_ENVIRONMENT: PRODUCTION
envkey_CANTUSDB_STATIC_ROOT: /path/to/static
envkey_CANTUSDB_MEDIA_ROOT: /path/to/media
envkey_CANTUSDB_HOST: somehost
envkey_CANTUSDB_SECRET_KEY: "hereisakey1234"
envkey_POSTGRES_PASSWORD: woahagreatpasswordabc
envkey_AWS_EMAIL_HOST_USER: test_user
envkey_AWS_EMAIL_HOST_PASSWORD: test_password
directory: config/envs
file_name: dev_env
- run: docker compose -f docker-compose-development.yml build
- run: docker compose -f docker-compose-development.yml up -d
- run: docker compose -f docker-compose-development.yml exec -T django python manage.py test main_app.tests
4 changes: 2 additions & 2 deletions django/cantusdb_project/main_app/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3644,11 +3644,11 @@ def test_edit_syllabification(self):
self.assertEqual(chant.manuscript_syllabized_full_text, "lorem ipsum")
response = self.client.post(
f"/edit-syllabification/{chant.id}",
{"manuscript_syllabized_full_text": "lo-rem ip-sum"},
{"manuscript_syllabized_full_text": "lore-m i-psum"},
)
self.assertEqual(response.status_code, 302) # 302 Found
chant.refresh_from_db()
self.assertEqual(chant.manuscript_syllabized_full_text, "lo-rem ip-sum")
self.assertEqual(chant.manuscript_syllabized_full_text, "lore-m i-psum")


class FeastListViewTest(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion django/cantusdb_project/main_app/views/chant.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ def get_initial(self):
initial = super().get_initial()
chant = self.get_object()
has_syl_text = bool(chant.manuscript_syllabized_full_text)
syls_text = syllabify_text(
syls_text, _ = syllabify_text(
text=chant.get_best_text_for_syllabizing(),
clean_text=True,
text_presyllabified=has_syl_text,
Expand Down
Loading
Loading