Hi there,
Whenever I run my unit tests, I use this command python manage.py test
, but my tests are not running, I get the following message:
Found 0 test(s).
System check identified no issues (0 silenced).
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
NOTE: I am using MySQL Database instead of the default SQLite. Does this have to do anything with the unit tests anyway?
I have following hierarchy of my project files and folders:
--[PROJECT-NAME]
------apps
----------[APP-NAME]
--------------migrations
--------------templates
--------------models.py
--------------test.py
--------------urls.py
--------------views.py
------[PROJECT-NAME]
----------settings.py
----------urls.py
------manage.py
And this is my tests.py
file
from django.test import TestCase
from apps.accounts.models import User, Invitation
class TestModels(TestCase):
def test_sending_password_reset_email(self):
user = User.objects.create(
login = "testuser@test.com",
email = "testuser@test.com",
password = "TestPassword1!"
)
email_sent = user.send_password_reset_email()
self.assertTrue(email_sent)
def test_accepting_invitation(self):
user = User.objects.create(
login = "testuser@test.com",
email = "testuser@test.com",
password = "TestPassword1!"
)
invitation = Invitation.objects.create(created_by = user)
accepted = invitation.accept(user, "testinguser@test.com", "TestingPassword1!")
self.assertTrue(accepted)
def test_cancelling_invitation(self):
user = User.objects.create(
login = "testuser@test.com",
email = "testuser@test.com",
password = "TestPassword1!"
)
invitation = Invitation.objects.create(created_by = user)
invitation.cancel()
self.assertTrue(invitation.is_canceled)
def test_sending_invite_user_email(self):
user = User.objects.create(
login = "testuser@test.com",
email = "testuser@test.com",
password = "TestPassword1!"
)
invitation = Invitation.objects.create(created_by = user)
message = invitation.send_invite_user_email()
self.assertEqual(message, "Success")
and these are the function signatures in my models.py
:
def send_password_reset_email(self) -> bool:
.
.
.
def accept(
self,
user: User,
login: str,
password: str
) -> bool:
.
.
.
def cancel(self):
.
.
.
def send_invite_user_email(self) -> str:
.
.
.
Anyone knows what wrong I am doing? Why my unit tests are not running?