#NEWLINE# def test_entries( self ) : #NEWLINE# #INDENT# ts = Timesheet ( self . base_uri , self . username , self . password ) #NEWLINE# project = ts . projects ( ) [ 0 ] #NEWLINE# tasks = project . tasks ( ) #NEWLINE# self . assertIsNotNone ( project ) #NEWLINE# entries = [ ] #NEWLINE# for i in xrange ( random . randint ( 1 , 5 ) ) : #NEWLINE# #INDENT# task = random . choice ( tasks ) #NEWLINE# entry = ts . create_entry ( project . id , task . id , hours = ( random . random ( ) * 10 ) ) #NEWLINE# entry . stop ( ) #NEWLINE# entries += [ entry ] #NEWLINE# #UNINDENT# for p in self . hv . projects ( ) : #NEWLINE# #INDENT# if ( p . id == project . id ) : #NEWLINE# #INDENT# admin_proj = p #NEWLINE# #UNINDENT# #UNINDENT# self . assertIsNotNone ( admin_proj ) #NEWLINE# proj_entries = admin_proj . entries ( start = admin_proj . earliest_record , end = admin_proj . latest_record ) #NEWLINE# for proj_entry in proj_entries : #NEWLINE# #INDENT# self . assertIsNotNone ( proj_entry . hours ) #NEWLINE# self . assertIsNotNone ( proj_entry . id ) #NEWLINE# self . assertTrue ( hasattr ( proj_entry , 'notes' ) ) #NEWLINE# self . assertIsNotNone ( proj_entry . project_id ) #NEWLINE# self . assertIsNotNone ( proj_entry . task_id ) #NEWLINE# self . assertIsNotNone ( proj_entry . user_id ) #NEWLINE# self . assertIsNotNone ( proj_entry . billed ) #NEWLINE# self . assertIsNotNone ( proj_entry . closed ) #NEWLINE# self . assertIsNotNone ( proj_entry . updated ) #NEWLINE# self . assertIsNotNone ( proj_entry . created ) #NEWLINE# self . assertIsNotNone ( proj_entry . spent ) #NEWLINE# #UNINDENT# for orig_entry in project : #NEWLINE# #INDENT# found = False #NEWLINE# for proj_entry in proj_entries : #NEWLINE# #INDENT# if ( proj_entry . id == orig_entry . id ) : #NEWLINE# #INDENT# found = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not found ) : #NEWLINE# #INDENT# self . fail ( ) #NEWLINE# #UNINDENT# #UNINDENT# for orig_entry in entries : #NEWLINE# #INDENT# orig_entry . delete ( )