def test_get_draft_returns_required_fields(self): """Test CACHE PROJECTS get_draft returns the required info about each project""" fields = ( "id", "name", "short_name", "info", "created", "description", "last_activity", "last_activity_raw", "overall_progress", "n_tasks", "n_volunteers", "owner", "info", "updated", ) ProjectFactory.create(info={}) draft = cached_projects.get_draft()[0] for field in fields: assert draft.has_key(field), "%s not in project info" % field
def test_get_draft_not_returns_hidden_projects(self): """Test CACHE PROJECTS get_draft does not return hidden projects""" ProjectFactory.create(info={}, hidden=1) drafts = cached_projects.get_draft() assert len(drafts) is 0, drafts
def test_get_draft_not_returns_published_projects(self): """Test CACHE PROJECTS get_draft does not return published projects""" published = ProjectFactory.create(published=True) drafts = cached_projects.get_draft() assert len(drafts) is 0, drafts
def test_get_draft(self): """Test CACHE PROJECTS get_draft returns draft_projects""" # Here, we are suposing that a project is draft iff has no presenter AND has no tasks ProjectFactory.create(info={}) drafts = cached_projects.get_draft() assert len(drafts) is 1, drafts
def test_get_draft_not_returns_published_projects(self): """Test CACHE PROJECTS get_draft does not return projects with either tasks or a presenter (REVIEW DEFINITION OF A DRAFT PROJECT REQUIRED)""" project_no_presenter = ProjectFactory.create(info={}) TaskFactory.create(project=project_no_presenter) project_no_task = ProjectFactory.create() drafts = cached_projects.get_draft() assert len(drafts) is 0, drafts
def test_get_draft_returns_required_fields(self): """Test CACHE PROJECTS get_draft returns the required info about each project""" fields = ('id', 'name', 'short_name', 'info', 'created', 'description', 'last_activity', 'last_activity_raw', 'overall_progress', 'n_tasks', 'n_volunteers', 'owner', 'info', 'updated') ProjectFactory.create(info={}) draft = cached_projects.get_draft()[0] for field in fields: assert draft.has_key(field), "%s not in project info" % field
def test_get_draft_returns_required_fields(self): """Test CACHE PROJECTS get_draft returns the required info about each project""" fields = ('id', 'name', 'short_name', 'info', 'created', 'description', 'last_activity', 'last_activity_raw', 'overall_progress', 'n_tasks', 'n_volunteers', 'owner', 'info', 'updated') ProjectFactory.create(published=False) draft = cached_projects.get_draft()[0] for field in fields: assert draft.has_key(field), "%s not in project info" % field
def test_get_draft_returns_required_fields(self): """Test CACHE PROJECTS get_draft returns the required info about each project""" fields = Project().public_attributes() ProjectFactory.create(published=False) draft = cached_projects.get_draft()[0] for field in fields: assert draft.has_key(field), "%s not in project info" % field if field == 'info': assert sorted(draft['info'].keys()) == sorted( Project().public_info_keys())