def test_notify_blog_users_featured_project(self, mock): """Test Notify Blog users with featured project works.""" user = UserFactory.create(subscribed=False) project = ProjectFactory.create(featured=True) TaskRunFactory.create(project=project) TaskRunFactory.create(project=project, user=user) blog = BlogpostFactory.create(project=project) res = notify_blog_users(blog.id, blog.project.id) msg = "1 users notified by email" assert res == msg, res
def test_notify_blog_users(self, mock): """Test Notify Blog users without pro or featured works.""" owner = UserFactory.create(pro=False) user = UserFactory.create(subscribed=False) project = ProjectFactory.create(owner=owner, featured=False) TaskRunFactory.create(project=project) TaskRunFactory.create(project=project, user=user) blog = BlogpostFactory.create(project=project) res = notify_blog_users(blog.id, blog.project.id) msg = "0 users notified by email" assert res == msg, res
def test_notify_blog_users_pro_owner_feature_only_for_pros(self, mock): """Test Notify Blog users with pro owner project works.""" owner = UserFactory.create(pro=True) user = UserFactory.create(subscribed=False) project = ProjectFactory.create(owner=owner) TaskRunFactory.create(project=project) TaskRunFactory.create(project=project, user=user) blog = BlogpostFactory.create(project=project) res = notify_blog_users(blog.id, blog.project.id) msg = "1 users notified by email" assert res == msg, res