aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2018-09-23 13:40:35 +0200
committerGravatar Johannes Christ <[email protected]>2018-09-23 14:55:00 +0200
commit34f954ab98dba0644801f5a23f9da9ca7a68dcef (patch)
tree1ee1c95ccfc4098687875fd2fe0a07a0bb5c4952
parentAdd `hypothesis[django]` requirement. (diff)
Remove `hypothesis`.
-rw-r--r--api/tests/test_validators.py39
-rw-r--r--setup.py3
2 files changed, 13 insertions, 29 deletions
diff --git a/api/tests/test_validators.py b/api/tests/test_validators.py
index ce197dec..c2bb412b 100644
--- a/api/tests/test_validators.py
+++ b/api/tests/test_validators.py
@@ -1,7 +1,5 @@
from django.core.exceptions import ValidationError
-from hypothesis import given, settings
-from hypothesis.extra.django import TestCase
-from hypothesis.strategies import dictionaries, just, lists, one_of, randoms, text
+from django.test import TestCase
from ..validators import validate_tag_embed
@@ -12,15 +10,11 @@ REQUIRED_KEYS = (
class TagEmbedValidatorTests(TestCase):
- @given(
- dictionaries(
- text().filter(lambda key: key not in REQUIRED_KEYS),
- text()
- )
- )
- def test_rejects_missing_required_keys(self, embed):
+ def test_rejects_missing_required_keys(self):
with self.assertRaises(ValidationError):
- validate_tag_embed(embed)
+ validate_tag_embed({
+ 'unknown': "key"
+ })
def test_rejects_empty_required_key(self):
with self.assertRaises(ValidationError):
@@ -28,10 +22,9 @@ class TagEmbedValidatorTests(TestCase):
'title': ''
})
- @given(lists(randoms()))
- def test_rejects_list_as_embed(self, embed):
+ def test_rejects_list_as_embed(self):
with self.assertRaises(ValidationError):
- validate_tag_embed(embed)
+ validate_tag_embed([])
def test_rejects_required_keys_and_unknown_keys(self):
with self.assertRaises(ValidationError):
@@ -46,19 +39,11 @@ class TagEmbedValidatorTests(TestCase):
'title': 'a' * 257
})
- @given(
- dictionaries(
- just('fields'),
- one_of(
- lists(randoms(), min_size=25),
- text(min_size=25)
- )
- )
- )
- @settings(max_examples=10)
- def test_rejects_too_many_fields(self, embed):
- with self.assertRaises(ValidationError):
- validate_tag_embed(embed)
+ def test_rejects_too_many_fields(self):
+ with self.assertRaises(ValidationError):
+ validate_tag_embed({
+ 'fields': [{} for _ in range(26)]
+ })
def test_rejects_too_long_description(self):
with self.assertRaises(ValidationError):
diff --git a/setup.py b/setup.py
index 068e3c0e..ab4a61a2 100644
--- a/setup.py
+++ b/setup.py
@@ -36,8 +36,7 @@ setup(
'mccabe>=0.6.1'
],
'test': [
- 'coverage>=4.5.1',
- 'hypothesis[django]>=3.71.10'
+ 'coverage>=4.5.1'
]
},
entry_points={