def milestone_setup(tc): from datetime import datetime from trac.util.datefmt import utc boo = Milestone(tc.env) boo.name = 'boo' boo.completed = boo.due = None boo.insert() roo = Milestone(tc.env) roo.name = 'roo' roo.completed = datetime.now(utc) roo.due = None roo.insert()
def setUp(self): self.env = EnvironmentStub() self.mmodule = MilestoneModule(self.env) self.terms = ['MilestoneAlpha', 'MilestoneBeta', 'MilestoneGamma'] for term in self.terms + [' '.join(self.terms)]: m = Milestone(self.env) m.name = term m.due = datetime_now(utc) m.description = random_sentence() m.insert()
def test_resource_link_ticket_context_milestone_no_view_perm(self): """Resource link in ticket context with no milestone view permission. """ milestone = Milestone(self.env) milestone.name = 'milestone1' milestone.insert() req = MockRequest(self.env, path_info='/ticket/1', authname='user1') resource = Resource('milestone', 'milestone1') context = web_context(req) link = render_resource_link(self.env, context, resource, format='compact') self.assertEqual('<a class="milestone">milestone1</a>', unicode(link))
def test_resource_link_ticket_context_milestone_exists(self): """Resource link in ticket context for viewable milestone. """ milestone = Milestone(self.env) milestone.name = 'milestone1' milestone.insert() req = MockRequest(self.env, path_info='/ticket/1') resource = Resource('milestone', 'milestone1') context = web_context(req) link = render_resource_link(self.env, context, resource, format='compact') self.assertEqual('<a class="milestone" href="/trac.cgi/milestone/' 'milestone1" title="No date set">milestone1</a>', unicode(link))
def setUp(self): self.env = EnvironmentStub(default_data=True) self.mmodule = MilestoneModule(self.env) self.terms = ['MilestoneAlpha', 'MilestoneBeta', 'MilestoneGamma'] for term in self.terms + [' '.join(self.terms)]: m = Milestone(self.env) m.name = term m.due = datetime_now(utc) m.description = u"""\ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod \ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate \ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat \ cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id \ est laborum.""" m.insert()
def insert_milestone(self, name, due=None): milestone = Milestone(self.env) milestone.name = name milestone.due = due milestone.insert() return milestone