From fafe1ae7d260149048bc3c1e1bc7de46349df7bc Mon Sep 17 00:00:00 2001
From: ABW <andrzejl@syncad.com>
Date: Tue, 8 Sep 2020 17:47:00 +0200
Subject: [PATCH] [ABW]: update in CI - tags_api has negative group, while old
 .yaml is no longer present changed behaviour of some condenser_api calls:
 when start_author or start_permlink is present, they need to point to correct
 post or error is generated fixed crash when start_author or start_permlink is
 passed to some condenser_api calls

---
 .gitlab-ci.yaml                     | 12 ++++++------
 hive/server/condenser_api/cursor.py |  6 +++---
 tests/tests_api                     |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yaml b/.gitlab-ci.yaml
index c86b21316..2f0082f4e 100644
--- a/.gitlab-ci.yaml
+++ b/.gitlab-ci.yaml
@@ -284,23 +284,23 @@ follow_api_smoketest:
     reports:
       junit: api_smoketest_follow_api.xml
 
-tags_api_smoketest_old:
+tags_api_smoketest:
   <<: *common_api_smoketest_job
 
   script:
-    - scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_tags_api_patterns.tavern.yaml api_smoketest_tags_api_old.xml
+    - scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" tags_api_patterns/ api_smoketest_tags_api.xml
 
   artifacts:
     reports:
-      junit: api_smoketest_tags_api_old.xml
+      junit: api_smoketest_tags_api.xml
 
-tags_api_smoketest:
+tags_api_smoketest_negative:
   <<: *common_api_smoketest_job
 
   script:
-    - scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" tags_api_patterns/ api_smoketest_tags_api.xml
+    - scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" tags_api_negative/ api_smoketest_tags_api_negative.xml
 
   artifacts:
     reports:
-      junit: api_smoketest_tags_api.xml
+      junit: api_smoketest_tags_api_negative.xml
 
diff --git a/hive/server/condenser_api/cursor.py b/hive/server/condenser_api/cursor.py
index 6a829832d..91740918e 100644
--- a/hive/server/condenser_api/cursor.py
+++ b/hive/server/condenser_api/cursor.py
@@ -21,7 +21,7 @@ async def get_post_id(db, author, permlink):
         INNER JOIN hive_accounts ha_a ON ha_a.id = hp.author_id
         INNER JOIN hive_permlink_data hpd_p ON hpd_p.id = hp.permlink_id
         WHERE ha_a.name = :author AND hpd_p.permlink = :permlink
-            AND counter_deleted = 0 LIMIT 1""" # ABW: replace with find_comment_id(:author,:permlink)?
+            AND counter_deleted = 0 LIMIT 1""" # ABW: replace with find_comment_id(:author,:permlink,True)?
     return await db.query_one(sql, author=author, permlink=permlink)
 
 async def get_child_ids(db, post_id):
@@ -190,8 +190,8 @@ async def pids_by_query(db, sort, start_author, start_permlink, limit, tag):
             where.append(sql)
 
     start_id = None
-    if start_permlink and start_author:
-        sql = "%s <= (SELECT %s FROM %s WHERE id = find_comment_id('{}', '{}'))".format(start_author, start_permlink)
+    if start_permlink or start_author:
+        sql = "%s <= (SELECT %s FROM %s WHERE id = find_comment_id('{}', '{}', True))".format(start_author, start_permlink)
         where.append(sql % (field, raw_field, table))
 
     sql = """
diff --git a/tests/tests_api b/tests/tests_api
index 9f6058b31..43f46f320 160000
--- a/tests/tests_api
+++ b/tests/tests_api
@@ -1 +1 @@
-Subproject commit 9f6058b31adec6378ead1b15ae6c1e7bb75823f7
+Subproject commit 43f46f320af704f4ac173005696ab8526e8d08f2
-- 
GitLab