(self)
| 199 | self.assertEqual('script content', script_content) |
| 200 | |
| 201 | def test_update_script_config(self): |
| 202 | self.start_server(12345, '127.0.0.1') |
| 203 | |
| 204 | xsrf_token = self.get_xsrf_token(self._admin_session) |
| 205 | |
| 206 | script_path = test_utils.create_file('my_script.py') |
| 207 | test_utils.write_script_config({'name': 's1', 'script_path': script_path}, 's1', self.runners_folder) |
| 208 | |
| 209 | response = self._admin_session.put( |
| 210 | 'http://127.0.0.1:12345/admin/scripts', |
| 211 | data={'filename': 's1.json', 'config': json.dumps({ |
| 212 | 'name': 'new name', |
| 213 | 'script': { |
| 214 | 'mode': 'new_code', |
| 215 | 'path': script_path, |
| 216 | 'code': 'abcdef' |
| 217 | } |
| 218 | })}, |
| 219 | headers={'X-XSRFToken': xsrf_token}, |
| 220 | ) |
| 221 | |
| 222 | self.assertEqual(200, response.status_code) |
| 223 | |
| 224 | conf_response = self.request('get', 'http://127.0.0.1:12345/admin/scripts/new%20name', |
| 225 | self._admin_session) |
| 226 | self.assertEqual({'config': {'name': 'new name', |
| 227 | 'script_path': script_path}, |
| 228 | 'filename': 's1.json'}, |
| 229 | conf_response) |
| 230 | |
| 231 | script_content = file_utils.read_file(script_path) |
| 232 | self.assertEqual('abcdef', script_content) |
| 233 | |
| 234 | def test_on_fly_auth(self): |
| 235 | self.start_server(12345, '127.0.0.1') |
nothing calls this directly
no test coverage detected