Exemplo n.º 1
0
 def save_work_records(self, work_records: list):
     """Save a list of WorkRecords to the Library"""
     ## Get User object from library
     user = self.polarion.get_user(self.user_name)
     for work_record in work_records:  ##TODO could paralleize this as each request has to wait for connection/response to the library, meaning it takes awhile (15sec) to do a week's worth of time entry
         print(
             "Saving work record in Library.  WorkItem: %s, Date:%s, TimeSpent: %s, Comment: %s"
             % (work_record.work_item_id, work_record.date,
                round_hours_for_library(
                    work_record.time_spent), work_record.description),
             flush=True)
         ## Get WorkItemURI
         work_item_uri = None
         work_item_uri = self.polarion.get_workitem_by_id(
             work_record.work_item_id).uri
         ## Add work record to workItem
         temp_enum = {
             'id': 'admin'
         }  ##TODO find a good way to set this enum in clockify or lookup a default in the library project space
         self.polarion.add_work_record_with_comment(
             work_item_uri, user, work_record.date,
             round_hours_for_library(work_record.time_spent), temp_enum,
             work_record.description)
Exemplo n.º 2
0
 def test_rounding_for_library_Zero_Input(self):
     self.assertEqual("0.0h", round_hours_for_library(0))
Exemplo n.º 3
0
 def test_rounding_for_library_Negative_Input(self):
     self.assertEqual("-1.0h", round_hours_for_library(-1))
Exemplo n.º 4
0
 def test_rounding_for_library_Large_Input(self):
     self.assertEqual("234.75h", round_hours_for_library(234.68))
Exemplo n.º 5
0
 def test_rounding_for_library_Long_Decimal_Input(self):
     self.assertEqual("1.25h",
                      round_hours_for_library(1.177777777777777777777777))
Exemplo n.º 6
0
 def test_rounding_for_library_Round_Up_to_zeroth_quarter(self):
     self.assertEqual("6.0h", round_hours_for_library(5.88))
Exemplo n.º 7
0
 def test_rounding_for_library_Round_Up_to_third_quarter(self):
     self.assertEqual("8.75h", round_hours_for_library(8.66))
Exemplo n.º 8
0
 def test_rounding_for_library_Round_Up(self):
     self.assertEqual("1.25h", round_hours_for_library(1.13))
Exemplo n.º 9
0
 def test_rounding_for_library_Round_Up_to_first_quarter(self):
     self.assertEqual("9.25h", round_hours_for_library(9.21))
Exemplo n.º 10
0
 def test_rounding_for_library_Round_Rown_to_third_quarter(self):
     self.assertEqual("0.75h", round_hours_for_library(0.8))
Exemplo n.º 11
0
 def test_rounding_for_library_Round_Rown_to_second_quarter(self):
     self.assertEqual("3.5h", round_hours_for_library(3.62))
Exemplo n.º 12
0
 def test_rounding_for_library_Round_Rown_to_first_quarter(self):
     self.assertEqual("7.25h", round_hours_for_library(7.31))
Exemplo n.º 13
0
 def test_rounding_for_library_Round_Down_to_zeroth_quarter(self):
     self.assertEqual("5.0h", round_hours_for_library(5.1))
Exemplo n.º 14
0
 def test_rounding_for_library_Round_Up_Borderline(self):
     self.assertEqual("1.25h", round_hours_for_library(1.126))
Exemplo n.º 15
0
 def test_rounding_for_library_Same_Number(self):
     self.assertEqual("1.0h", round_hours_for_library(1.0))
Exemplo n.º 16
0
 def test_rounding_for_library_Round_Down(self):
     self.assertEqual("1.0h", round_hours_for_library(1.12))
Exemplo n.º 17
0
 def test_rounding_for_library_Round_Up_to_second_quarter(self):
     self.assertEqual("4.5h", round_hours_for_library(4.45))