def test_public_projects_contributed_no_contributions(self): """Test public CACHE USERS projects_contributed returns empty list if the user has not contributed to any project""" user = UserFactory.create() projects_contributed = cached_users.public_projects_contributed(user.id) assert projects_contributed == [], projects_contributed
def test_public_projects_contributed_contributions(self): """Test CACHE USERS public projects_contributed returns a list of projects that has contributed to""" user = UserFactory.create() project_contributed = ProjectFactory.create() task = TaskFactory.create(project=project_contributed) TaskRunFactory.create(task=task, user=user) another_project = ProjectFactory.create() projects_contributed = cached_users.public_projects_contributed(user.id) assert len(projects_contributed) == 1 assert projects_contributed[0]['short_name'] == project_contributed.short_name, projects_contributed # check privacy err_msg = 'private information is in public record' assert 'secret_key' not in projects_contributed[0], err_msg assert 'onesignal' not in projects_contributed[0]['info'] assert 'passwd_hash' not in projects_contributed[0]['info']