Combine report field and price checks into one review workspace
This commit is contained in:
1 parent
2888d6edbc
commit
698d91367c
8 files changed
+273
-87
No files matched your search
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from html.parser import HTMLParser
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -72,6 +73,40 @@ class DailyVisualStaticContractTests(unittest.TestCase):
|
||||
self.assertIn("min-width: 118px", self.styles)
|
||||
self.assertNotIn("width: calc(100% - 48px)", self.styles)
|
||||
|
||||
def test_review_dates_are_independent_and_both_review_bodies_share_one_workspace(self) -> None:
|
||||
class Regions(HTMLParser):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.stack = []
|
||||
self.parents = {}
|
||||
|
||||
def handle_starttag(self, tag, attrs):
|
||||
element_id = dict(attrs).get("id")
|
||||
if element_id:
|
||||
self.parents[element_id] = [item[1] for item in self.stack if item[1]]
|
||||
if tag not in {"area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"}:
|
||||
self.stack.append((tag, element_id))
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
for index in range(len(self.stack) - 1, -1, -1):
|
||||
if self.stack[index][0] == tag:
|
||||
del self.stack[index:]
|
||||
break
|
||||
|
||||
regions = Regions()
|
||||
regions.feed(self.html)
|
||||
dates = regions.parents["arr-download-pending"]
|
||||
self.assertNotIn("arr-download-form", dates)
|
||||
self.assertNotIn("arr-data-review-panel", dates)
|
||||
self.assertNotIn("manual-review-workspace", dates)
|
||||
for body_id in ("arr-data-review-panel", "daily-price-review-panel"):
|
||||
self.assertIn("manual-review-workspace", regions.parents[body_id])
|
||||
self.assertLess(self.html.index('id="arr-download-pending"'), self.html.index('id="manual-review-workspace"'))
|
||||
self.assertEqual(self.html.count('<h2 id="manual-review-title">人工核对</h2>'), 1)
|
||||
self.assertIn('<h2 id="arr-download-pending-title">需处理日期</h2>', self.html)
|
||||
self.assertNotIn('<h2 id="daily-price-review-title">', self.html)
|
||||
self.assertNotIn('<h2 id="arr-data-review-title">', self.html)
|
||||
|
||||
def test_removed_upload_labels_do_not_return(self) -> None:
|
||||
upload_start = self.html.index('class="panel upload-panel"')
|
||||
upload_end = self.html.index("</section>", upload_start)
|
||||
|
||||
Reference in new issue
Block a user