Skip to content

Commit

Permalink
Restrict moto version
Browse files Browse the repository at this point in the history
`moto` 3 fixed an issue where `ScanIndexForward` and filters were
applied in the wrong order (getmoto/moto#3909)
and causes incorrect results when we try to query for the latest film.

Both `moto` version 4 or 5 seem to have the same issue.

Update the `mock_dynamodb2` import with `mock_dynamodb` as they are
identical and the latter is scheduled for removal.
  • Loading branch information
elliotgoodrich committed Feb 1, 2024
1 parent d7d7869 commit 96d7245
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions discord_handler/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
black
moto

moto ~= 3.1
8 changes: 4 additions & 4 deletions discord_handler/test_filmbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import boto3
from math import factorial
from itertools import permutations
from moto import mock_dynamodb2
from moto import mock_dynamodb
from filmbot import (
FilmBot,
TABLE_NAME,
Expand Down Expand Up @@ -105,7 +105,7 @@ def __exit__(self, exc_type, exc_value, exc_tb):


class TestFilmBot(unittest.TestCase):
mock_dynamodb2 = mock_dynamodb2()
mock_dynamodb = mock_dynamodb()

def setUp(self):
"""
Expand All @@ -115,7 +115,7 @@ def setUp(self):
# Set unlimited length for assertEqual diff lengths
self.maxDiff = None

self.mock_dynamodb2.start()
self.mock_dynamodb.start()
boto3.setup_default_session()
self.dynamodb = boto3.resource("dynamodb", region_name=AWS_REGION)
self.dynamodb_client = boto3.client("dynamodb", region_name=AWS_REGION)
Expand All @@ -134,7 +134,7 @@ def tearDown(self):
"""
Unmock `dynamodb2`.
"""
self.mock_dynamodb2.stop()
self.mock_dynamodb.stop()
pass

def test_get_users(self):
Expand Down

0 comments on commit 96d7245

Please sign in to comment.