Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'feature/syntax-highlighting' of https://github.com/unb-…
Browse files Browse the repository at this point in the history
…mds/2023-2-Squad06 into feature/syntax-highlighting
  • Loading branch information
HladczukLe committed Dec 6, 2023
2 parents 80777a7 + 1dd1817 commit b583a31
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 133 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -15,13 +15,13 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.9.0
rev: v3.13.0
hooks:
- id: commitizen
- id: commitizen-branch
stages: [push]
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand All @@ -33,7 +33,7 @@ repos:
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.7.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
1 change: 1 addition & 0 deletions apps/submissions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class SubmissionForm(Form):
code = CodeMirrorField(
min_length=15,
label="Code",
required=True,
config_name="python",
Expand Down
25 changes: 6 additions & 19 deletions apps/tasks/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,8 @@ def test_send_submission_successfully(self) -> None:
def test_send_submission_with_short_code(self) -> None:
self.client.force_login(self.user)

initial_submission_count = Submission._default_manager.count()

self.client.post(self.url, data={"code": "c"})

final_submission_count = Submission._default_manager.count()

self.assertEqual(final_submission_count, initial_submission_count + 1)
self.assertEqual(Submission._default_manager.count(), 1)

def test_detail_view_model_is_task(self) -> None:
self.assertEqual(DetailView.model, Task)
Expand Down Expand Up @@ -507,21 +502,13 @@ def test_form_success_url(self) -> None:
self.assertEqual(self.view.get_success_url(), url)

def test_invalid_form_submission(self) -> None:
invalid_code = "invalid code"

response = self.client.post(self.url, data={"code": invalid_code})

self.assertEqual(response.status_code, 302)

redirected_url = response.headers["Location"]

redirected_response = self.client.get(redirected_url)
self.client.force_login(self.user)

self.assertEqual(redirected_response.status_code, 200)
response = self.client.post(self.url, data={"code": ""})

if redirected_response.context is not None:
self.assertIn("form", redirected_response.context)
self.assertFalse(redirected_response.context["form"].is_valid())
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "tasks/detail.html")
self.assertFalse(response.context["form"].is_valid())


class BackgroundJobTaskTest(TestCase):
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ services:
- config/.env
depends_on:
- postgres
- rabbitmq
- celery
command: python -Wd manage.py runserver 0.0.0.0:8000

celery:
Expand Down
Loading

0 comments on commit b583a31

Please sign in to comment.