Skip to content
Snippets Groups Projects
Commit ee2911fb authored by Andrzej Lisak's avatar Andrzej Lisak
Browse files

[ABW]: [Fix] added missing artifacts and test directory (hive_api_patterns) to CI

[Change] blacklisted accounts and blacklists ordered by name to make sure order is always the same
[Ign] removed nonimplemented methods from follow_api/tags_api
[Ign] mock data slightly extended
parent 6c0602bf
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!387changes in various places to clean the code and fix small problems
...@@ -273,12 +273,30 @@ tags_api_smoketest_negative: ...@@ -273,12 +273,30 @@ tags_api_smoketest_negative:
script: script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" tags_api_negative/ api_smoketest_tags_api_negative.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_negative.xml
mock_tests: mock_tests:
<<: *common_api_smoketest_job <<: *common_api_smoketest_job
script: script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" mock_tests/ api_smoketest_mock_tests.xml - scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" mock_tests/ api_smoketest_mock_tests.xml
artifacts:
reports:
junit: api_smoketest_mock_tests.xml
hive_api_smoketest:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" hive_api_patterns/ api_smoketest_hive_api.xml
artifacts:
reports:
junit: api_smoketest_hive_api.xml
api_smoketest_benchmark: api_smoketest_benchmark:
stage: benchmark-tests stage: benchmark-tests
environment: hive-4.pl.syncad.com environment: hive-4.pl.syncad.com
......
...@@ -20,7 +20,8 @@ BEGIN ...@@ -20,7 +20,8 @@ BEGIN
hive_follows hf hive_follows hf
JOIN hive_accounts ha ON ha.id = hf.following JOIN hive_accounts ha ON ha.id = hf.following
WHERE WHERE
hf.follower = __observer_id AND hf.blacklisted; hf.follower = __observer_id AND hf.blacklisted
ORDER BY account, source;
END IF; END IF;
IF (_flags & 2)::BOOLEAN THEN IF (_flags & 2)::BOOLEAN THEN
RETURN QUERY SELECT -- mutes_get_blacklisted_for_observer (indirect observer blacklists) RETURN QUERY SELECT -- mutes_get_blacklisted_for_observer (indirect observer blacklists)
...@@ -33,7 +34,8 @@ BEGIN ...@@ -33,7 +34,8 @@ BEGIN
JOIN hive_accounts ha_i ON ha_i.id = hf_i.following JOIN hive_accounts ha_i ON ha_i.id = hf_i.following
JOIN hive_accounts ha ON ha.id = hf.following JOIN hive_accounts ha ON ha.id = hf.following
WHERE WHERE
hf.follower = __observer_id AND hf.follow_blacklists AND hf_i.blacklisted; hf.follower = __observer_id AND hf.follow_blacklists AND hf_i.blacklisted
ORDER BY account, source;
END IF; END IF;
IF (_flags & 4)::BOOLEAN THEN IF (_flags & 4)::BOOLEAN THEN
RETURN QUERY SELECT-- mutes_get_blacklisted_for_observer (local observer mute list) RETURN QUERY SELECT-- mutes_get_blacklisted_for_observer (local observer mute list)
...@@ -44,7 +46,8 @@ BEGIN ...@@ -44,7 +46,8 @@ BEGIN
hive_follows hf hive_follows hf
JOIN hive_accounts ha ON ha.id = hf.following JOIN hive_accounts ha ON ha.id = hf.following
WHERE WHERE
hf.follower = __observer_id AND hf.state = 2; hf.follower = __observer_id AND hf.state = 2
ORDER BY account, source;
END IF; END IF;
IF (_flags & 8)::BOOLEAN THEN IF (_flags & 8)::BOOLEAN THEN
RETURN QUERY SELECT-- mutes_get_blacklisted_for_observer (indirect observer mute list) RETURN QUERY SELECT-- mutes_get_blacklisted_for_observer (indirect observer mute list)
...@@ -57,7 +60,8 @@ BEGIN ...@@ -57,7 +60,8 @@ BEGIN
JOIN hive_accounts ha_i ON ha_i.id = hf_i.following JOIN hive_accounts ha_i ON ha_i.id = hf_i.following
JOIN hive_accounts ha ON ha.id = hf.following JOIN hive_accounts ha ON ha.id = hf.following
WHERE WHERE
hf.follower = __observer_id AND hf.follow_muted AND hf_i.state = 2; hf.follower = __observer_id AND hf.follow_muted AND hf_i.state = 2
ORDER BY account, source;
END IF; END IF;
END END
$function$ $function$
...@@ -66,7 +70,7 @@ language plpgsql STABLE; ...@@ -66,7 +70,7 @@ language plpgsql STABLE;
DROP FUNCTION IF EXISTS mutes_get_blacklists_for_observer; DROP FUNCTION IF EXISTS mutes_get_blacklists_for_observer;
CREATE FUNCTION mutes_get_blacklists_for_observer( in _observer VARCHAR, in _follow_blacklist BOOLEAN, in _follow_muted BOOLEAN ) CREATE FUNCTION mutes_get_blacklists_for_observer( in _observer VARCHAR, in _follow_blacklist BOOLEAN, in _follow_muted BOOLEAN )
RETURNS TABLE( RETURNS TABLE(
account hive_accounts.name%TYPE, list hive_accounts.name%TYPE,
is_blacklist BOOLEAN -- False means mute list is_blacklist BOOLEAN -- False means mute list
) )
AS AS
...@@ -83,7 +87,8 @@ BEGIN ...@@ -83,7 +87,8 @@ BEGIN
hive_follows hf hive_follows hf
JOIN hive_accounts ha ON ha.id = hf.following JOIN hive_accounts ha ON ha.id = hf.following
WHERE WHERE
hf.follower = __observer_id AND hf.follow_blacklists; hf.follower = __observer_id AND hf.follow_blacklists
ORDER BY list;
END IF; END IF;
IF _follow_muted THEN IF _follow_muted THEN
RETURN QUERY SELECT -- mutes_get_blacklists_for_observer (observer mute lists) RETURN QUERY SELECT -- mutes_get_blacklists_for_observer (observer mute lists)
...@@ -93,7 +98,8 @@ BEGIN ...@@ -93,7 +98,8 @@ BEGIN
hive_follows hf hive_follows hf
JOIN hive_accounts ha ON ha.id = hf.following JOIN hive_accounts ha ON ha.id = hf.following
WHERE WHERE
hf.follower = __observer_id AND hf.follow_muted; hf.follower = __observer_id AND hf.follow_muted
ORDER BY list;
END IF; END IF;
END END
$function$ $function$
......
...@@ -5,18 +5,3 @@ from hive.server.common.helpers import return_error_info ...@@ -5,18 +5,3 @@ from hive.server.common.helpers import return_error_info
async def get_account_reputations(context, account_lower_bound: str = '', limit: int = 1000): async def get_account_reputations(context, account_lower_bound: str = '', limit: int = 1000):
db = context['db'] db = context['db']
return await _get_account_reputations_impl(db, False, account_lower_bound, limit) return await _get_account_reputations_impl(db, False, account_lower_bound, limit)
@return_error_info
async def get_feed_entries(context, account: str, start_entry_id: int, limit: int):
""" Returns a list of entries in an account’s feed. """
raise NotImplementedError()
@return_error_info
async def get_feed(context, account: str, start_entry_id: int, limit: int):
""" Returns a list of items in an account’s feed. """
raise NotImplementedError()
@return_error_info
async def get_blog_authors(context, blog_account: str):
""" Returns a list of authors that have had their content reblogged on a given blog account. """
raise NotImplementedError()
...@@ -105,11 +105,7 @@ def build_methods(): ...@@ -105,11 +105,7 @@ def build_methods():
'follow_api.get_account_reputations': follow_api.get_account_reputations, 'follow_api.get_account_reputations': follow_api.get_account_reputations,
'follow_api.get_blog': condenser_api.get_blog, 'follow_api.get_blog': condenser_api.get_blog,
'follow_api.get_blog_entries': condenser_api.get_blog_entries, 'follow_api.get_blog_entries': condenser_api.get_blog_entries,
'follow_api.get_reblogged_by': condenser_api.get_reblogged_by, 'follow_api.get_reblogged_by': condenser_api.get_reblogged_by
# three functions under are not implemented, should we remove them?
'follow_api.get_feed_entries': follow_api.get_feed_entries,
'follow_api.get_feed': follow_api.get_feed,
'follow_api.get_blog_authors': follow_api.get_blog_authors
}) })
# tags_api aliases # tags_api aliases
...@@ -124,14 +120,7 @@ def build_methods(): ...@@ -124,14 +120,7 @@ def build_methods():
'tags_api.get_discussions_by_comments': condenser_api.get_discussions_by_comments, 'tags_api.get_discussions_by_comments': condenser_api.get_discussions_by_comments,
'tags_api.get_discussions_by_author_before_date': condenser_api.get_discussions_by_author_before_date, 'tags_api.get_discussions_by_author_before_date': condenser_api.get_discussions_by_author_before_date,
'tags_api.get_post_discussions_by_payout': condenser_api.get_post_discussions_by_payout, 'tags_api.get_post_discussions_by_payout': condenser_api.get_post_discussions_by_payout,
'tags_api.get_comment_discussions_by_payout': condenser_api.get_comment_discussions_by_payout, 'tags_api.get_comment_discussions_by_payout': condenser_api.get_comment_discussions_by_payout
'tags_api.get_active_votes' : tags_api.get_active_votes,
# five functions under are not implemented, should we remove them?
'tags_api.get_tags_used_by_author' : tags_api.get_tags_used_by_author,
'tags_api.get_discussions_by_active' : tags_api.get_discussions_by_active,
'tags_api.get_discussions_by_cashout' : tags_api.get_discussions_by_cashout,
'tags_api.get_discussions_by_votes' : tags_api.get_discussions_by_votes,
'tags_api.get_discussions_by_children' : tags_api.get_discussions_by_children
}) })
# legacy `call` style adapter # legacy `call` style adapter
......
...@@ -3,6 +3,7 @@ from hive.server.common.helpers import ( ...@@ -3,6 +3,7 @@ from hive.server.common.helpers import (
return_error_info, return_error_info,
valid_account, valid_account,
valid_permlink) valid_permlink)
from hive.server.database_api.methods import find_votes_impl, VotesPresentation
@return_error_info @return_error_info
async def get_discussion(context, author: str, permlink: str, observer=None): async def get_discussion(context, author: str, permlink: str, observer=None):
...@@ -14,59 +15,3 @@ async def get_content_replies(context, author: str, permlink: str): ...@@ -14,59 +15,3 @@ async def get_content_replies(context, author: str, permlink: str):
db = context['db'] db = context['db']
return await _get_content_replies_impl(db, False, author, permlink) return await _get_content_replies_impl(db, False, author, permlink)
@return_error_info
async def get_active_votes(context, author: str, permlink: str):
""" Returns all votes for the given post. """
valid_account(author)
valid_permlink(permlink)
db = context['db']
sql = """
SELECT
hv.voter,
hv.author,
hv.permlink,
hv.weight,
hv.rshares,
hv.percent,
hv.last_update,
hv.num_changes
FROM
hive_votes_view hv
WHERE hv.author = :author AND hv.permlink = :permlink
"""
ret = []
rows = await db.query_all(sql, author=author, permlink=permlink)
for row in rows:
ret.append(dict(voter=row.voter, author=row.author, permlink=row.permlink,
weight=row.weight, rshares=row.rshares, vote_percent=row.percent,
last_update=str(row.last_update), num_changes=row.num_changes))
return ret
@return_error_info
async def get_tags_used_by_author(context, author: str):
""" Returns a list of tags used by an author. """
raise NotImplementedError()
@return_error_info
async def get_discussions_by_active(context, tag: str, limit: int, filter_tags: list,
select_authors: list, select_tags: list, truncate_body: int):
""" Returns a list of discussions based on active. """
raise NotImplementedError()
@return_error_info
async def get_discussions_by_cashout(context, tag: str, limit: int, filter_tags: list,
select_authors: list, select_tags: list, truncate_body: int):
""" Returns a list of discussions by cashout. """
raise NotImplementedError()
@return_error_info
async def get_discussions_by_votes(context, tag: str, limit: int, filter_tags: list,
select_authors: list, select_tags: list, truncate_body: int):
""" Returns a list of discussions by votes. """
raise NotImplementedError()
@return_error_info
async def get_discussions_by_children(context, tag: str, limit: int, filter_tags: list,
select_authors: list, select_tags: list, truncate_body: int):
""" Returns a list of discussions by children. """
raise NotImplementedError()
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
] ]
}, },
"memo_key": "", "memo_key": "",
"json_metadata": "", "json_metadata": "{\"profile\":{\"blacklist_description\":\"People I don't like\",\"muted_list_description\":\"People that need to STFU\"}}",
"extensions": [] "extensions": []
} }
} }
...@@ -823,6 +823,17 @@ ...@@ -823,6 +823,17 @@
"id": "follow", "id": "follow",
"json": "[\"follow\",{\"follower\":\"alice\",\"following\":[\"spaminator\",\"hivewatchers\",\"buildawhale\",\"redeemer\"],\"what\":[\"follow_blacklist\"]}]" "json": "[\"follow\",{\"follower\":\"alice\",\"following\":[\"spaminator\",\"hivewatchers\",\"buildawhale\",\"redeemer\"],\"what\":[\"follow_blacklist\"]}]"
} }
},
{
"type": "custom_json_operation",
"value": {
"required_auths": [],
"required_posting_auths": [
"alice"
],
"id": "follow",
"json": "[\"follow\",{\"follower\":\"alice\",\"following\":\"ignoreall\",\"what\":[\"follow_muted\"]}]"
}
} }
] ]
} }
......
Subproject commit bd4ebf2ccf8e2c5a253ebe4c154e1cf9a839a8e0 Subproject commit e9e2687e1cd8bc9778f50cdecc3825eac6466d5f
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment