Example #1
0
 def test_validate_children(self):
     post = PostFactory()
     image = Image()
     profile = Profile()
     post._children = [image]
     post._validate_children()
     post._children = [profile]
     with pytest.raises(ValueError):
         post._validate_children()
Example #2
0
 def test_entity_calls_main_validate_methods(self):
     post = PostFactory()
     post._validate_required = Mock()
     post._validate_attributes = Mock()
     post._validate_empty_attributes = Mock()
     post._validate_children = Mock()
     post.validate()
     assert post._validate_required.call_count == 1
     assert post._validate_attributes.call_count == 1
     assert post._validate_empty_attributes.call_count == 1
     assert post._validate_children.call_count == 1
Example #3
0
 def test_validate_children(self):
     post = PostFactory()
     image = Image()
     profile = Profile()
     post._children = [image]
     post._validate_children()
     post._children = [profile]
     with pytest.raises(ValueError):
         post._validate_children()
Example #4
0
 def test_entity_calls_main_validate_methods(self):
     post = PostFactory()
     post._validate_required = Mock()
     post._validate_attributes = Mock()
     post._validate_empty_attributes = Mock()
     post._validate_children = Mock()
     post.validate()
     assert post._validate_required.call_count == 1
     assert post._validate_attributes.call_count == 1
     assert post._validate_empty_attributes.call_count == 1
     assert post._validate_children.call_count == 1
Example #5
0
 def test_entity_calls_attribute_validate_method(self):
     post = PostFactory()
     post.validate_location = Mock()
     post.validate()
     assert post.validate_location.call_count == 1
Example #6
0
 def test_post_entity_without_raw_content_tags_returns_empty_set(self):
     post = PostFactory(raw_content=None)
     assert post.tags == []
Example #7
0
 def test_entity_calls_attribute_validate_method(self):
     post = PostFactory()
     post.validate_location = Mock()
     post.validate()
     assert post.validate_location.call_count == 1