Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aggregate play test for trigger #3289

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,50 +121,3 @@ def test_index_aggregate_plays_update(app):
assert results[2].count == 3
assert results[3].play_item_id == 4
assert results[3].count == 2


def test_index_aggregate_plays_same_checkpoint(app):
"""Test that we should not update when last index is the same"""
# setup
with app.app_context():
db = get_db()

# run
entities = {
"tracks": [
{"track_id": 1, "title": "track 1"},
{"track_id": 2, "title": "track 2"},
{"track_id": 3, "title": "track 3"},
{"track_id": 4, "title": "track 4"},
],
"aggregate_plays": [
# Current Plays
{"play_item_id": 1, "count": 3},
{"play_item_id": 2, "count": 3},
{"play_item_id": 3, "count": 3},
],
"indexing_checkpoints": [
{"tablename": "aggregate_plays", "last_checkpoint": 9}
],
"plays": [
# Current Plays
{"item_id": 1},
{"item_id": 1},
{"item_id": 1},
{"item_id": 2},
{"item_id": 2},
{"item_id": 2},
{"item_id": 3},
{"item_id": 3},
{"item_id": 3},
],
}

populate_mock_db(db, entities)

with db.scoped_session() as session:
results: List[AggregatePlays] = (
session.query(AggregatePlays).order_by(AggregatePlays.play_item_id).all()
)

assert len(results) == 3