Skip to content

Commit

Permalink
Merge pull request #307 from bounswe/272-emin-add-unittests
Browse files Browse the repository at this point in the history
Add unittests for models and view functions
  • Loading branch information
kristinatrajkovski authored Nov 25, 2024
2 parents be91d3a + f4b2d45 commit 36bbd95
Show file tree
Hide file tree
Showing 7 changed files with 924 additions and 48 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ keygen-apk/
buroute-web/web_env
wiki_database_API/db_env
koduyorum-web/node_modules
.venv
.venv
venv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 5.1.2 on 2024-11-25 17:46

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('django_app', '0006_annotation'),
('django_app', '0006_topic'),
]

operations = [
]
5 changes: 4 additions & 1 deletion django_project_491/django_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class Question(models.Model):

author = models.ForeignKey('User', on_delete=models.CASCADE, related_name='questions')

def __str__(self):
return f"{self.title} ({self.language})"

def run_snippet(self): # TODO
result = run_code(self.code_snippet, self.language_id)
if result['stderr']:
Expand All @@ -122,7 +125,7 @@ def run_snippet(self): # TODO
else:
return result['stdout'].split('\n')

def mark_as_answered(self,comment_id): # TODO
def mark_as_answered(self, comment_id): # TODO
self.answered = True
self.save()

Expand Down
Loading

0 comments on commit 36bbd95

Please sign in to comment.