Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Add model unit tests#35

Open
lqlin33 wants to merge 5 commits into
masterfrom
model-unittests
Open

Add model unit tests#35
lqlin33 wants to merge 5 commits into
masterfrom
model-unittests

Conversation

@lqlin33

@lqlin33 lqlin33 commented Apr 2, 2019

Copy link
Copy Markdown

Changes made:

  • Basic unit tests for petition, user, and response models
  • Tested setter functions even if setter functions aren't necessary in model (can be removed later)

These changes will resolve #27.

Changes not made:

  • Checking code coverage, this functionality can be easily tacked on later

Current unit tests are based very closely off the current model, so drastic changes in the model may require a restructuring of the unit tests.

@garoller garoller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests look good, I just imported the wrong thing when I initially made the tests.py file, so some small changes have to be made.

Thank you!

Comment thread index/tests.py Outdated
@@ -1,23 +1,170 @@
import unittest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change this to from django.test import TestCase. I included this in the initial commit of this file, so I'm sorry about that. See the docs for details.

Comment thread index/tests.py Outdated
# check code coverage


class PetitionModelTestCase(unittest.TestCase):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change unittest.TestCase to TestCase

Comment thread index/tests.py Outdated
self.assertFalse(p.check_tags())


class UserModelTestCase(unittest.TestCase):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change unittest.TestCase to TestCase

Comment thread index/tests.py Outdated
self.assertTrue(u.admin)


class ResponseModelTestCase(unittest.TestCase):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change unittest.TestCase to TestCase

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write model unit tests

2 participants