mirror of
https://github.com/blw1138/Zordon.git
synced 2026-06-09 13:39:24 -05:00
REST API endpoint streamlining and cleanup (#133)
* Consolidate engine_info api calls * Change api methods to use POST when possible * Delete engine API cleanup * Remove redundant installed_engines endpoint * Update proxy to use similar named methods to new API calls * More API cleanup * Jobs API cleanup * More jobs API cleanup * Fix add jobs error due to null queue * Remove unnecessary full_status and snapshot API endpoints * Streamline add job POST endpoint * Fix test after method name change
This commit is contained in:
@@ -2,6 +2,7 @@ import logging
|
||||
import os
|
||||
import time
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from src.api.server_proxy import RenderServerProxy
|
||||
|
||||
@@ -38,9 +39,8 @@ class SubmissionTestCase(unittest.TestCase):
|
||||
msg=f'Server not reachable at {SERVER_HOST}:{SERVER_PORT}')
|
||||
|
||||
def test_submit_job(self):
|
||||
sample_file_path = os.path.join(os.path.dirname(__file__), 'resources',
|
||||
'batman_sample.blend')
|
||||
self.assertTrue(os.path.exists(sample_file_path),
|
||||
sample_file_path = Path(__file__).parent / 'resources' / 'batman_sample.blend'
|
||||
self.assertTrue(sample_file_path.exists(),
|
||||
msg=f'Test file not found: {sample_file_path}')
|
||||
|
||||
sample_job = {
|
||||
@@ -52,8 +52,8 @@ class SubmissionTestCase(unittest.TestCase):
|
||||
'enable_split_jobs': False,
|
||||
}
|
||||
|
||||
response = self.render_server.post_job_to_server(
|
||||
file_path=sample_file_path, job_list=[sample_job])
|
||||
response = self.render_server.create_job(
|
||||
file_path=sample_file_path, job_data=sample_job)
|
||||
self.assertIsNotNone(response, msg='No response from server')
|
||||
self.assertTrue(response.ok, msg=f'Server returned {response.status_code}')
|
||||
|
||||
@@ -68,7 +68,7 @@ class SubmissionTestCase(unittest.TestCase):
|
||||
file_count = 0
|
||||
|
||||
while True:
|
||||
update_response = self.render_server.get_job_info(self.__class__.test_job_id)
|
||||
update_response = self.render_server.get_job(self.__class__.test_job_id)
|
||||
if update_response:
|
||||
print(f"Status: {update_response['status']}")
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ class TestFindAvailableServers:
|
||||
mock_get_props.return_value = {'api_version': '0.1', 'system_os': 'macos'}
|
||||
|
||||
mock_proxy = MagicMock()
|
||||
mock_proxy.is_engine_available.return_value = {
|
||||
mock_proxy.get_engine_availability.return_value = {
|
||||
'available': True,
|
||||
'hostname': 'server-1.local',
|
||||
}
|
||||
@@ -136,3 +136,4 @@ class TestFindAvailableServers:
|
||||
result = DistributedJobManager.find_available_servers('blender')
|
||||
assert len(result) == 1
|
||||
assert result[0]['hostname'] == 'server-1.local'
|
||||
mock_proxy.get_engine_availability.assert_called_once_with('blender')
|
||||
|
||||
Reference in New Issue
Block a user