Skip to content

Commit 454676c

Browse files
committed
Made changes requested in pull request #48 - issue #28
1 parent 0e760af commit 454676c

File tree

6 files changed

+40
-42
lines changed

6 files changed

+40
-42
lines changed

README.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ Running the tests
146146
=================
147147
Install the dependencies specified in requirements.txt and run::
148148

149-
python runtests.py
150-
149+
python setup.py test
151150

152151

153152
Donating

drum/links/tests/tests_models.py renamed to drum/links/tests.py

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
from unittest import TestCase
2-
2+
from drum.links.forms import LinkForm
33
from django.contrib.auth.models import User
44
from drum.links.models import Link, Profile
55

66

7+
class LinkFormsTests(TestCase):
8+
9+
def test_valid_data(self):
10+
form = LinkForm({
11+
"title": "Test title",
12+
"link": "http://test.com/",
13+
"description": "Test Desc",
14+
})
15+
self.assertTrue(form.is_valid())
16+
17+
def test_title_may_not_be_empty(self):
18+
form = LinkForm({
19+
"title": "",
20+
"link": "http://test.com/",
21+
"description": "Test Desc",
22+
})
23+
self.assertFalse(form.is_valid())
24+
25+
def test_link_may_be_empty(self):
26+
form = LinkForm({
27+
"title": "Test title",
28+
"link": "",
29+
"description": "Test Desc",
30+
})
31+
self.assertTrue(form.is_valid())
32+
33+
def test_description_may_be_empty(self):
34+
form = LinkForm({
35+
"title": "Test title",
36+
"link": "http://test.com/",
37+
"description": "",
38+
})
39+
self.assertTrue(form.is_valid())
40+
41+
742
class LinkModelsTests(TestCase):
43+
844
def test_has_link_field(self):
945
l = Link()
1046
self.assertTrue(hasattr(l, 'link'))
@@ -19,6 +55,7 @@ def test_has_comments_field(self):
1955

2056

2157
class ProfileModelsTests(TestCase):
58+
2259
def setUp(self):
2360
self.user = User.objects.create(username='user', password="notsosecure")
2461
self.user.profile.website = "http://test.com/"

drum/links/tests/__init__.py

Whitespace-only changes.

drum/links/tests/tests_forms.py

-38
This file was deleted.

requirements.txt

-1
This file was deleted.

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
zip_safe=False,
5050
include_package_data=True,
5151
packages=find_packages(),
52+
test_suite="runtests.main",
5253

5354
install_requires=[
5455
"mezzanine >= 4.2.0",

0 commit comments

Comments
 (0)