|
37 | 37 | VideoPlaylistFactory,
|
38 | 38 | )
|
39 | 39 | from learning_resources.models import (
|
| 40 | + LearningResource, |
40 | 41 | LearningResourceOfferor,
|
41 | 42 | LearningResourceRelationship,
|
42 | 43 | PodcastEpisode,
|
|
54 | 55 | VideoResourceSerializer,
|
55 | 56 | VideoSerializer,
|
56 | 57 | )
|
| 58 | +from learning_resources.views import CourseViewSet |
57 | 59 | from learning_resources_search.api import Search
|
58 | 60 | from learning_resources_search.serializers import serialize_learning_resource_for_update
|
59 | 61 |
|
@@ -209,7 +211,6 @@ def test_no_excess_queries(rf, user, mocker, django_assert_num_queries, course_c
|
209 | 211 | There should be a constant number of queries made (based on number of
|
210 | 212 | related models), regardless of number of results returned.
|
211 | 213 | """
|
212 |
| - from learning_resources.views import CourseViewSet |
213 | 214 |
|
214 | 215 | CourseFactory.create_batch(course_count)
|
215 | 216 |
|
@@ -1092,8 +1093,6 @@ def test_featured_view_filter(client, offeror_featured_lists, parameter):
|
1092 | 1093 |
|
1093 | 1094 | def test_similar_resources_endpoint_does_not_return_self(mocker, client):
|
1094 | 1095 | """Test similar learning_resources endpoint does not return initial resource"""
|
1095 |
| - from learning_resources.models import LearningResource |
1096 |
| - |
1097 | 1096 | resources = LearningResourceFactory.create_batch(5)
|
1098 | 1097 |
|
1099 | 1098 | resource_ids = [learning_resource.id for learning_resource in resources]
|
@@ -1127,8 +1126,6 @@ def test_similar_resources_endpoint_does_not_return_self(mocker, client):
|
1127 | 1126 |
|
1128 | 1127 | def test_similar_resources_endpoint_only_returns_published(mocker, client):
|
1129 | 1128 | """Test similar learning_resources endpoint only returns published items"""
|
1130 |
| - from learning_resources.models import LearningResource |
1131 |
| - |
1132 | 1129 | resources = LearningResourceFactory.create_batch(5)
|
1133 | 1130 |
|
1134 | 1131 | resource_ids = [learning_resource.id for learning_resource in resources]
|
@@ -1170,8 +1167,6 @@ def test_similar_resources_endpoint_only_returns_published(mocker, client):
|
1170 | 1167 |
|
1171 | 1168 | def test_similar_resources_endpoint_ignores_opensearch_published(mocker, client):
|
1172 | 1169 | """Test similar learning_resources ignores the published attribute from opensearch"""
|
1173 |
| - from learning_resources.models import LearningResource |
1174 |
| - |
1175 | 1170 | resources = LearningResourceFactory.create_batch(5)
|
1176 | 1171 |
|
1177 | 1172 | resource_ids = [learning_resource.id for learning_resource in resources]
|
@@ -1209,8 +1204,6 @@ def test_similar_resources_endpoint_ignores_opensearch_published(mocker, client)
|
1209 | 1204 |
|
1210 | 1205 | def test_vector_similar_resources_endpoint_does_not_return_self(mocker, client):
|
1211 | 1206 | """Test vector based similar resources endpoint does not return initial id"""
|
1212 |
| - from learning_resources.models import LearningResource |
1213 |
| - |
1214 | 1207 | resources = LearningResourceFactory.create_batch(5)
|
1215 | 1208 |
|
1216 | 1209 | resource_ids = [learning_resource.id for learning_resource in resources]
|
@@ -1241,8 +1234,6 @@ def test_vector_similar_resources_endpoint_does_not_return_self(mocker, client):
|
1241 | 1234 |
|
1242 | 1235 | def test_vector_similar_resources_endpoint_only_returns_published(mocker, client):
|
1243 | 1236 | """Test vector based similar resources endpoint only returns published items"""
|
1244 |
| - from learning_resources.models import LearningResource |
1245 |
| - |
1246 | 1237 | resources = LearningResourceFactory.create_batch(5)
|
1247 | 1238 |
|
1248 | 1239 | resource_ids = [learning_resource.id for learning_resource in resources]
|
@@ -1279,8 +1270,6 @@ def test_vector_similar_resources_endpoint_only_returns_published(mocker, client
|
1279 | 1270 |
|
1280 | 1271 | def test_learning_resources_display_info_list_view(mocker, client):
|
1281 | 1272 | """Test learning_resources_display_info_list_view returns expected results"""
|
1282 |
| - from learning_resources.models import LearningResource |
1283 |
| - |
1284 | 1273 | LearningResource.objects.all().delete()
|
1285 | 1274 | resources = LearningResourceFactory.create_batch(
|
1286 | 1275 | 5, published=True, title="test_learning_resources_display_info_list_view"
|
@@ -1309,8 +1298,6 @@ def test_learning_resources_display_info_list_view(mocker, client):
|
1309 | 1298 |
|
1310 | 1299 | def test_run_with_null_prices_does_not_throw_error(mocker, client):
|
1311 | 1300 | """Test learning_resources_display_info_detail_view does not throw exception"""
|
1312 |
| - from learning_resources.models import LearningResource |
1313 |
| - |
1314 | 1301 | run = LearningResourceRunFactory.create(
|
1315 | 1302 | run_id="test",
|
1316 | 1303 | learning_resource=CourseFactory.create(
|
@@ -1338,8 +1325,6 @@ def test_run_with_null_prices_does_not_throw_error(mocker, client):
|
1338 | 1325 |
|
1339 | 1326 | def test_learning_resources_display_info_detail_view(mocker, client):
|
1340 | 1327 | """Test learning_resources_display_info_detail_view returns expected result"""
|
1341 |
| - from learning_resources.models import LearningResource |
1342 |
| - |
1343 | 1328 | resource = LearningResource.objects.for_search_serialization().get(
|
1344 | 1329 | id=LearningResourceFactory.create().id
|
1345 | 1330 | )
|
|
0 commit comments