Update landing page and ground link features
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
a5cc458252
commit
7efe9097ce
28 files changed
+928
-120
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import os,json,unittest,uuid
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
from pierzainer_ground.app import read_launch_context,GroundModelApp,ROOT
|
||||
|
||||
class AppLinkTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.cache=ROOT/'data/cache'/('gui_link_test_'+uuid.uuid4().hex);self.cache.mkdir(parents=True)
|
||||
self.excel=ROOT.parent/'도면추출/samples/샘플01_산외교_교각입력데이터.xlsx'
|
||||
self.drawing=ROOT/'data/input/sanwoe/02.종평면도(울산)_2017.0619-수정.dwg'
|
||||
def config(self,drawing=''):
|
||||
return dict(piers=str(self.excel),drawing=drawing,output=str(ROOT/'data/output'/self.cache.name),ready_file=str(self.cache/'ready'))
|
||||
def test_excel_has_empty_drawing_and_keeps_workbook(self):
|
||||
file=self.cache/'context.json';file.write_text(json.dumps(self.config()),encoding='utf-8')
|
||||
with patch.dict(os.environ,PIERZAINER_GROUND_CONTEXT=str(file)):
|
||||
context=read_launch_context();self.assertEqual(context['drawing'],'');self.assertEqual(context['piers'],str(self.excel))
|
||||
def test_native_gui_prefills_both_and_calls_existing_pipeline(self):
|
||||
context=self.config(str(self.drawing));app=GroundModelApp(context);app.withdraw()
|
||||
try:
|
||||
self.assertEqual(app.drawing.get(),str(self.drawing));self.assertEqual(app.piers.get(),str(self.excel));self.assertEqual(app.output.get(),context['output']);self.assertEqual(app.run_button['text'],'지반 생성')
|
||||
with patch('pierzainer_ground.app.build_from_files',return_value={'map_status':{'status':'mapped'}}) as run:
|
||||
app._start_run();kind,message=app.messages.get(timeout=3);self.assertEqual(kind,'done');self.assertEqual(run.call_args.args[:2],(str(self.drawing),str(self.excel)));self.assertEqual(run.call_args.kwargs['output'],context['output'])
|
||||
finally:
|
||||
for token in app.tk.call('after','info'):app.after_cancel(token)
|
||||
app.destroy()
|
||||
def test_bad_output_is_rejected(self):
|
||||
context=self.config();context['output']=str(ROOT.parent);file=self.cache/'context.json';file.write_text(json.dumps(context),encoding='utf-8')
|
||||
with patch.dict(os.environ,PIERZAINER_GROUND_CONTEXT=str(file)),self.assertRaises(ValueError):read_launch_context()
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in new issue
Block a user