Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions fixtures/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import boto3
import pytest
from moto import mock_s3
from moto import mock_aws


@pytest.fixture(autouse=True)
Expand All @@ -18,7 +18,7 @@ def silence_s3_logging(): # noqa: PT004
@pytest.fixture
def mock_s3_fixture(): # noqa: PT004
"""Mock the S3 fixture for the duration of the test"""
with mock_s3():
with mock_aws():
yield


Expand Down
10 changes: 5 additions & 5 deletions learning_resources/etl/ocw_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import boto3
import pytest
from moto import mock_s3
from moto import mock_aws

from learning_resources.conftest import OCW_TEST_PREFIX, setup_s3_ocw
from learning_resources.constants import (
Expand Down Expand Up @@ -37,7 +37,7 @@
pytestmark = pytest.mark.django_db


@mock_s3
@mock_aws
@pytest.mark.parametrize("base_ocw_url", ["http://test.edu/", "http://test.edu"])
def test_transform_content_files(settings, mocker, base_ocw_url):
"""
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_transform_content_files(settings, mocker, base_ocw_url):
}


@mock_s3
@mock_aws
def test_transform_content_files_exceptions(settings, mocker):
"""
Test transform_content_files
Expand All @@ -130,7 +130,7 @@ def test_transform_content_files_exceptions(settings, mocker):
assert mock_log.call_count == 5


@mock_s3
@mock_aws
@pytest.mark.parametrize("overwrite", [True, False])
@pytest.mark.parametrize("modified_after_last_import", [True, False])
def test_transform_content_file_needs_text_update(
Expand Down Expand Up @@ -174,7 +174,7 @@ def test_transform_content_file_needs_text_update(
assert "content" not in content_data


@mock_s3
@mock_aws
@pytest.mark.parametrize(
(
"legacy_uid",
Expand Down
8 changes: 4 additions & 4 deletions learning_resources/etl/pipelines_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from unittest.mock import patch

import pytest
from moto import mock_s3
from moto import mock_aws

from learning_resources.conftest import OCW_TEST_PREFIX, setup_s3_ocw
from learning_resources.constants import OfferedBy, PlatformType
Expand Down Expand Up @@ -222,7 +222,7 @@ def test_podcast_etl():
assert result == mock_load_podcasts.return_value


@mock_s3
@mock_aws
@pytest.mark.django_db
@pytest.mark.parametrize("skip_content_files", [True, False])
def test_ocw_courses_etl(settings, mocker, skip_content_files):
Expand Down Expand Up @@ -268,7 +268,7 @@ def test_ocw_courses_etl(settings, mocker, skip_content_files):
assert mock_calc_score.call_count == (0 if skip_content_files else 1)


@mock_s3
@mock_aws
@pytest.mark.django_db
def test_ocw_courses_etl_no_data(settings, mocker):
"""Test ocw_courses_etl when no S3 data is present"""
Expand All @@ -285,7 +285,7 @@ def test_ocw_courses_etl_no_data(settings, mocker):
mock_log.assert_called_once_with("No course data found for %s", s3_path)


@mock_s3
@mock_aws
@pytest.mark.django_db
def test_ocw_courses_etl_exception(settings, mocker):
"""Test ocw_courses_etl when bad data raises an exception"""
Expand Down
16 changes: 8 additions & 8 deletions learning_resources/tasks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from decorator import contextmanager
from django.utils import timezone
from moto import mock_s3
from moto import mock_aws

from learning_resources import factories, models, tasks
from learning_resources.conftest import OCW_TEST_PREFIX, setup_s3, setup_s3_ocw
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_get_xpro_data(mocker):
mock_pipelines.xpro_courses_etl.assert_called_once_with()


@mock_s3
@mock_aws
def test_import_all_mit_edx_files(settings, mocker, mocked_celery, mock_blocklist):
"""import_all_mit_edx_files should start chunked tasks with correct bucket, platform"""
setup_s3(settings)
Expand All @@ -145,7 +145,7 @@ def test_import_all_mit_edx_files(settings, mocker, mocked_celery, mock_blocklis
)


@mock_s3
@mock_aws
def test_import_all_mitxonline_files(settings, mocker, mocked_celery, mock_blocklist):
"""import_all_mitxonline_files should be replaced with get_content_tasks"""
setup_s3(settings)
Expand All @@ -161,7 +161,7 @@ def test_import_all_mitxonline_files(settings, mocker, mocked_celery, mock_block
)


@mock_s3
@mock_aws
def test_import_all_xpro_files(settings, mocker, mocked_celery, mock_blocklist):
"""import_all_xpro_files should start chunked tasks with correct bucket, platform"""
setup_s3(settings)
Expand All @@ -173,7 +173,7 @@ def test_import_all_xpro_files(settings, mocker, mocked_celery, mock_blocklist):
get_content_tasks_mock.assert_called_once_with(PlatformType.xpro.name, chunk_size=3)


@mock_s3
@mock_aws
def test_import_all_oll_files(settings, mocker, mocked_celery, mock_blocklist):
"""import_all_oll_files should start chunked tasks with correct bucket, platform"""
setup_s3(settings)
Expand All @@ -190,7 +190,7 @@ def test_import_all_oll_files(settings, mocker, mocked_celery, mock_blocklist):
)


@mock_s3
@mock_aws
def test_get_content_tasks(settings, mocker, mocked_celery, mock_xpro_learning_bucket):
"""Test that get_content_tasks calls get_content_files with the correct args"""
mock_get_content_files = mocker.patch(
Expand Down Expand Up @@ -260,7 +260,7 @@ def test_get_podcast_data(mocker):
mock_pipelines.podcast_etl.assert_called_once()


@mock_s3
@mock_aws
@pytest.mark.parametrize(
("force_overwrite", "skip_content_files"), [(True, False), (False, True)]
)
Expand Down Expand Up @@ -313,7 +313,7 @@ def test_get_ocw_data_no_settings(settings, mocker):
mock_log.assert_called_once_with("Required settings missing for get_ocw_data")


@mock_s3
@mock_aws
@pytest.mark.parametrize("timestamp", [None, "2020-12-15T00:00:00Z"])
@pytest.mark.parametrize("overwrite", [True, False])
def test_get_ocw_courses(settings, mocker, mocked_celery, timestamp, overwrite):
Expand Down
42 changes: 22 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ django-debug-toolbar = "^4.1.0"
factory_boy = "^3.3.0"
faker = "^30.0.0"
ipdb = "^0.13.13"
moto = "^4.1.12"
moto = "^5.0.0"
nplusone = "^1.0.0"
pdbpp = "^0.10.3"
pytest = "^8.0.0"
Expand Down
Loading