from yunity.utils.tests.mock import MockCategory parent_category = MockCategory.create()
from yunity.utils.tests.mock import MockCategory parent_category = MockCategory.create() existing_category = MockCategory.create()
def test_validate_category_parent_passes(self): self.given_data(MockCategory.create().id) self.when_calling(types.category_parent) self.then_invocation_passed_with(AnyResult())
from yunity.utils.tests.mock import MockCategory categories = MockCategory.create_batch(10)
def test_validate_category_name_fails_with_existing_category(self): self.given_data(MockCategory.create().name) self.when_calling(types.category_name) self.then_invocation_failed_with(ValidationFailure)