def test_format_new_projects(self): """Test format draft_projects_week works.""" ProjectFactory.create(published=True) p = ProjectFactory.create(published=False) draft_projects_week() day = datetime.utcnow().strftime('%Y-%m-%d') res = format_draft_projects() assert len(res) == 1, res res = res[0] assert res['day'].strftime('%Y-%m-%d') == day, res['day'] assert res['id'] == p.id assert res['short_name'] == p.short_name assert res['p_name'] == p.name assert res['email_addr'] == p.owner.email_addr assert res['owner_id'] == p.owner.id assert res['u_name'] == p.owner.name
def test_format_published_projects_week(self): """Test format published_projects_week works.""" ProjectFactory.create(published=False) p = ProjectFactory.create(published=True) auditlogger = AuditLogger(auditlog_repo, caller='web') auditlogger.log_event(p, p.owner, 'update', 'published', False, True) published_projects_week() day = datetime.utcnow().strftime('%Y-%m-%d') res = format_published_projects() assert len(res) == 1, res res = res[0] assert res['day'].strftime('%Y-%m-%d') == day, res['day'] assert res['id'] == p.id assert res['short_name'] == p.short_name assert res['p_name'] == p.name assert res['email_addr'] == p.owner.email_addr assert res['owner_id'] == p.owner.id assert res['u_name'] == p.owner.name
def test_new_projects_week(self): """Test JOB update projects week works.""" p = ProjectFactory.create() dashboard_new_projects_week() sql = "select * from dashboard_week_project_new;" results = db.session.execute(sql) for row in results: assert row.id == p.id assert row.name == p.name assert row.owner_id == p.owner_id assert row.u_name == p.owner.name assert row.email_addr == p.owner.email_addr
def test_new_projects_week(self): """Test JOB update projects week works.""" p = ProjectFactory.create() new_projects_week() sql = "select * from dashboard_week_project_new;" results = db.session.execute(sql) for row in results: assert row.id == p.id assert row.name == p.name assert row.owner_id == p.owner_id assert row.u_name == p.owner.name assert row.email_addr == p.owner.email_addr
def test_format_updated_projects(self): """Test format updated projects works.""" old_date = date(2014, 11, 24) old_project = ProjectFactory.create(updated=old_date) p = ProjectFactory.create() p.name = 'NewNewNew' project_repo = ProjectRepository(db) project_repo.update(p) update_projects_week() day = datetime.utcnow().strftime('%Y-%m-%d') res = format_update_projects() assert len(res) == 1, res res = res[0] assert res['day'].strftime('%Y-%m-%d') == day, res['day'] assert res['id'] == p.id assert res['short_name'] == p.short_name assert res['p_name'] == p.name assert res['email_addr'] == p.owner.email_addr assert res['owner_id'] == p.owner.id assert res['u_name'] == p.owner.name
def test_format_new_projects(self): """Test format new projects works.""" p = ProjectFactory.create() dashboard_new_projects_week() res = format_new_projects() day = datetime.utcnow().strftime('%Y-%m-%d') res = res[0] assert res['day'].strftime('%Y-%m-%d') == day, res['day'] assert res['id'] == p.id assert res['short_name'] == p.short_name assert res['p_name'] == p.name assert res['email_addr'] == p.owner.email_addr assert res['owner_id'] == p.owner.id assert res['u_name'] == p.owner.name
def test_format_new_projects(self): """Test format new projects works.""" p = ProjectFactory.create() new_projects_week() res = format_new_projects() day = datetime.utcnow().strftime('%Y-%m-%d') res = res[0] assert res['day'].strftime('%Y-%m-%d') == day, res['day'] assert res['id'] == p.id assert res['short_name'] == p.short_name assert res['p_name'] == p.name assert res['email_addr'] == p.owner.email_addr assert res['owner_id'] == p.owner.id assert res['u_name'] == p.owner.name
def test_update_projects_week(self): """Test JOB update projects week works.""" p = ProjectFactory.create() p.name = 'NewNameName' project_repository = ProjectRepository(db) project_repository.update(p) dashboard_update_projects_week() sql = "select * from dashboard_week_project_update;" results = db.session.execute(sql) for row in results: assert row.id == p.id assert row.name == p.name assert row.owner_id == p.owner_id assert row.u_name == p.owner.name assert row.email_addr == p.owner.email_addr
def test_update_projects_week(self): """Test JOB update projects week works.""" p = ProjectFactory.create() p.name = 'NewNameName' project_repository = ProjectRepository(db) project_repository.update(p) update_projects_week() sql = "select * from dashboard_week_project_update;" results = db.session.execute(sql) for row in results: assert row.id == p.id assert row.name == p.name assert row.owner_id == p.owner_id assert row.u_name == p.owner.name assert row.email_addr == p.owner.email_addr