def test_overwrite(self):
     ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate(),
                                   create_project())
     os.utime(self._filepath, (1,1))
     assert_true(ctrl.has_been_modified_on_disk())
     ctrl.execute(SaveFile())
     assert_false(ctrl.has_been_modified_on_disk())
예제 #2
0
 def check_in_git(self, controller=None):
     if controller is None:
         import requests
         with open('/tmp/test_case_id.txt') as output:
             test_case_id = output.readline().strip()
         with open('/tmp/server_url.txt') as output:
             server_url = output.readline().strip()
         url = server_url.strip()
         with open('/tmp/test_case_path.txt') as output:
             test_case_path = output.readline().strip()
         with open('/tmp/user_credential.txt') as output:
             user_credential = output.readline().strip()
         with open('/tmp/connection_name.txt') as output:
             connection_name = output.readline().strip()
         robot_file = open(test_case_path, 'r')
         files = {'files[]': robot_file}
         data = {'file_path': test_case_path, "id": test_case_id}
         header = {
             'access-token': user_credential.strip(),
             'tenant-name': connection_name.strip()
         }
         response = requests.post(url,
                                  files=files,
                                  data=data,
                                  headers=header)
         robot_file.close()
     if controller is not None:
         if not controller.has_format():
             self._show_dialog_for_files_without_format(controller)
         else:
             controller.execute(SaveFile())
예제 #3
0
 def save(self, controller=None):
     if controller is None :
         controller = self.get_selected_datafile_controller()
     if controller is not None:
         if not controller.has_format():
             self._show_dialog_for_files_without_format(controller)
         else:
             controller.execute(SaveFile())
예제 #4
0
 def change_format(self, controller, format):
     if controller.is_same_format(format):
         return
     old_path = controller.filename
     controller.set_format(format)
     controller.execute(SaveFile())
     if old_path:
         self._remove_file(old_path)
         RideFileNameChanged(old_filename=old_path,
                             datafile=controller).publish()
예제 #5
0
 def _show_warning(self, msg_lines, ctrl, yes_handler):
     if ctrl.dirty:
         msg_lines.insert(2,
                          'Answering <Yes> will discard unsaved changes.')
     msg_lines.extend(['', 'Changed file is:', ctrl.datafile.source])
     ret = wx.MessageBox('\n'.join(msg_lines),
                         'File Changed On Disk',
                         style=wx.YES_NO | wx.ICON_WARNING)
     if ret == wx.NO:
         from robotide.controller.commands import SaveFile
         ctrl.execute(SaveFile())
         return True
     if ret == wx.YES:
         yes_handler()
     return False
 def _create_resource(self):
     self.new_resource = self.ctrl.execute(
         CreateNewResource(self.res_full_name))
     self.new_resource.execute(AddKeyword(self.new_keyword_name, '${moi}'))
     self.new_resource.execute(SaveFile())
예제 #7
0
 def save(self):
     if self._skip:
         return
     command = SaveFile()
     print 'suite.execute(%s)' % str(command)
     self._suite.execute(command)