def testCreateCanBeAccesedViaProject( self ):
     projects = [
         MockComponentOrProject( False ),
         MockComponentOrProject( True ),
         MockComponentOrProject( False )
     ]
     milestone = Milestone( None, [], projects )
     user = {}
     self.assertTrue( milestone.canBeAccessedBy( user ))
     self.assertEquals([ user ], projects[ 0 ].accessRequestedBy );
     self.assertEquals([ user ], projects[ 1 ].accessRequestedBy );
     self.assertEquals([], projects[ 2 ].accessRequestedBy );
    def testIsAssignedTo( self ):
        item = MockComponentOrProject() 

        milestone = Milestone( None, [], [] )
        self.assertFalse( milestone.isAssignedTo( item ))

        milestone = Milestone( None, [ item ], [] )
        self.assertTrue( milestone.isAssignedTo( item ))

        milestone = Milestone( None, [], [ item ])
        self.assertTrue( milestone.isAssignedTo( item ))
 def testCreateMilestone( self ):
     milestone = Milestone( 'MyMilestone', [], [] )
     self.assertFalse( milestone.canBeAccessedBy( None ))
     self.assertEquals( 'MyMilestone', milestone.id() )