def test_get_updates(): u1 = mkuser() u2 = mkuser() # 1 project per user project1 = mkprojects(u1, 1)[0] project2 = mkprojects(u2, 1)[0] populate_project(project1) populate_project(project2) updates = StatusUpdate.get_updates(u1) assert len(updates) == 3, len(updates) project3 = mkprojects(u1, 1)[0] updates = StatusUpdate.get_updates(u1) assert len(updates) == 3, len(updates)
def update_status(self, message, project_name, status): connect() # insert into postgres user = self.get_user(message) try: project = Project.get(user_id=user.user_id, name=project_name) except Project.DoesNotExist: self.reply(message, "Sorry, project %s not found." % project_name) return status = StatusUpdate.create(project, status) self.reply(message, "Status updated." + str(status))
def populate_project(project, items=3): for x in range(items): StatusUpdate.create(project, "test")