Ejemplo n.º 1
0
    def test_public_published_projects_no_projects(self):
        """Test public CACHE USERS published_projects returns empty list if the user has
        not created any project"""
        user = UserFactory.create()

        projects_published = cached_users.public_published_projects(user.id)

        assert projects_published == [], projects_published
Ejemplo n.º 2
0
    def test_public_published_projects_no_projects(self):
        """Test public CACHE USERS published_projects returns empty list if the user has
        not created any project"""
        user = UserFactory.create()

        projects_published = cached_users.public_published_projects(user.id)

        assert projects_published == [], projects_published
Ejemplo n.º 3
0
    def test_public_published_projects_returns_published(self):
        """Test public CACHE USERS published_projects returns a list with the projects that
        are published by the user"""
        user = UserFactory.create()
        published_project = ProjectFactory.create(owner=user, published=True)

        projects_published = cached_users.public_published_projects(user.id)

        assert len(projects_published) == 1, projects_published
        assert projects_published[0]['short_name'] == published_project.short_name, projects_published
Ejemplo n.º 4
0
    def test_public_published_projects_returns_published(self):
        """Test public CACHE USERS published_projects returns a list with the projects that
        are published by the user"""
        user = UserFactory.create()
        published_project = ProjectFactory.create(owner=user, published=True)

        projects_published = cached_users.public_published_projects(user.id)

        assert len(projects_published) == 1, projects_published
        assert projects_published[0]['short_name'] == published_project.short_name, projects_published
Ejemplo n.º 5
0
    def test_public_published_projects_returns_fields(self):
        """Test CACHE USERS published_projects returns the info of the projects with
        the required fields"""
        user = UserFactory.create()
        published_project = ProjectFactory.create(owner=user, published=True)
        private_fields = ('owner_id')
        public_fields = ('name', 'short_name', 'description',
                         'overall_progress', 'n_tasks', 'n_volunteers', 'info')

        projects_published = cached_users.public_published_projects(user.id)

        for field in public_fields:
            assert field in list(projects_published[0].keys()), field

        for field in private_fields:
            assert field not in list(projects_published[0].keys()), field
Ejemplo n.º 6
0
    def test_public_published_projects_returns_fields(self):
        """Test CACHE USERS published_projects returns the info of the projects with
        the required fields"""
        user = UserFactory.create()
        published_project = ProjectFactory.create(owner=user, published=True)
        private_fields = ('owner_id')
        public_fields = ('name', 'short_name', 'description',
                         'overall_progress', 'n_tasks', 'n_volunteers', 'info')

        projects_published = cached_users.public_published_projects(user.id)

        for field in public_fields:
            assert field in projects_published[0].keys(), field

        for field in private_fields:
            assert field not in projects_published[0].keys(), field