summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md2
-rw-r--r--archaeological_operations/tests.py29
-rw-r--r--ishtar_common/tests.py14
3 files changed, 33 insertions, 12 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 6068371fb..28f5fa6b0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,8 @@ Ishtar changelog
- syndication ui: better color for external sources
- Search: sort by ID by default
+### Bug fixes ###
+- Fix geo finds for external sources: do not display
v4.0.32 - 2022-12-12
--------------------
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index a9fe8760e..7bc51539d 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# See the file COPYING for details.
+from bs4 import BeautifulSoup
import json
import datetime
from subprocess import Popen, PIPE
@@ -4041,10 +4042,16 @@ class DocumentTest(OperationInitTest, TestCase):
c.login(username=self.username, password=self.password)
response = c.get(url, {"operation": self.operation.pk})
self.assertEqual(response.status_code, 200)
- self.assertIn(
- 'option value="{}" selected'.format(self.operation.pk),
- response.content.decode(),
- )
+
+ result = response.content.decode()
+ soup = BeautifulSoup(result, "lxml")
+ ok = False
+ for field in soup.findAll("option"):
+ keys = list(field.attrs.keys())
+ if "selected" in keys and "value" in keys and field["value"] == str(self.operation.pk):
+ ok = True
+ break
+ self.assertTrue(ok, msg="Operation not selected in Document form")
posted = {"authors": []}
for related_key in models.Document.RELATED_MODELS:
@@ -4079,10 +4086,16 @@ class DocumentTest(OperationInitTest, TestCase):
c.login(username=self.username, password=self.password)
response = c.get(url)
self.assertEqual(response.status_code, 200)
- self.assertIn(
- 'option value="{}" selected'.format(self.operation.pk),
- response.content.decode(),
- )
+
+ result = response.content.decode()
+ soup = BeautifulSoup(result, "lxml")
+ ok = False
+ for field in soup.findAll("option"):
+ keys = list(field.attrs.keys())
+ if "selected" in keys and "value" in keys and field["value"] == str(self.operation.pk):
+ ok = True
+ break
+ self.assertTrue(ok, msg="Operation not selected in Document form")
posted = {"authors": [], "title": "hop2-is-back"}
for related_key in models.Document.RELATED_MODELS:
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index f4e372770..d15675769 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -3918,10 +3918,16 @@ class DocumentTest(TestCase):
c.login(username=self.username, password=self.password)
response = c.get(url)
self.assertEqual(response.status_code, 200)
- self.assertIn(
- 'option value="{}" selected'.format(self.ope1.pk),
- response.content.decode()
- )
+
+ result = response.content.decode()
+ soup = Soup(result, "lxml")
+ ok = False
+ for field in soup.findAll("option"):
+ keys = list(field.attrs.keys())
+ if "selected" in keys and "value" in keys and field["value"] == str(self.ope1.pk):
+ ok = True
+ break
+ self.assertTrue(ok, msg="Operation not selected in Document form")
self.assertIn(doc.title, response.content.decode())
posted = {"authors": [], "title": "A child document"}