Skip to content

Commit a408106

Browse files
feat: CourseHomeViewModelTest
1 parent 42eda19 commit a408106

File tree

2 files changed

+1024
-0
lines changed

2 files changed

+1024
-0
lines changed

core/src/main/java/org/openedx/core/Mock.kt

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
package org.openedx.core
22

3+
import org.openedx.core.data.model.room.VideoProgressEntity
34
import org.openedx.core.domain.model.AssignmentProgress
45
import org.openedx.core.domain.model.Block
56
import org.openedx.core.domain.model.BlockCounts
7+
import org.openedx.core.domain.model.CourseComponentStatus
8+
import org.openedx.core.domain.model.CourseDatesBannerInfo
9+
import org.openedx.core.domain.model.CourseDatesResult
10+
import org.openedx.core.domain.model.CourseProgress
611
import org.openedx.core.domain.model.CourseStructure
712
import org.openedx.core.domain.model.CoursewareAccess
13+
import org.openedx.core.domain.model.EncodedVideos
814
import org.openedx.core.domain.model.OfflineDownload
915
import org.openedx.core.domain.model.Progress
16+
import org.openedx.core.domain.model.ResetCourseDates
17+
import org.openedx.core.domain.model.StudentViewData
18+
import org.openedx.core.domain.model.VideoInfo
19+
import org.openedx.core.module.db.DownloadModel
20+
import org.openedx.core.module.db.DownloadedState
21+
import org.openedx.core.module.db.FileType
1022
import java.util.Date
1123

1224
object Mock {
@@ -81,4 +93,171 @@ object Mock {
8193
isSelfPaced = false,
8294
progress = Progress(1, 3),
8395
)
96+
97+
val mockCourseComponentStatus = CourseComponentStatus(
98+
lastVisitedBlockId = "video1"
99+
)
100+
101+
val mockCourseDatesBannerInfo = CourseDatesBannerInfo(
102+
missedDeadlines = false,
103+
missedGatedContent = false,
104+
contentTypeGatingEnabled = false,
105+
verifiedUpgradeLink = "",
106+
hasEnded = false
107+
)
108+
109+
val mockCourseDatesResult = CourseDatesResult(
110+
datesSection = linkedMapOf(),
111+
courseBanner = mockCourseDatesBannerInfo
112+
)
113+
114+
val mockCourseProgress = CourseProgress(
115+
verifiedMode = "audit",
116+
accessExpiration = "",
117+
certificateData = null,
118+
completionSummary = null,
119+
courseGrade = null,
120+
creditCourseRequirements = "",
121+
end = "",
122+
enrollmentMode = "audit",
123+
gradingPolicy = null,
124+
hasScheduledContent = false,
125+
sectionScores = emptyList(),
126+
studioUrl = "",
127+
username = "testuser",
128+
userHasPassingGrade = false,
129+
verificationData = null,
130+
disableProgressGraph = false
131+
)
132+
133+
val mockVideoProgress = VideoProgressEntity(
134+
blockId = "video1",
135+
videoUrl = "test-video-url",
136+
videoTime = 1000L,
137+
duration = 5000L
138+
)
139+
140+
val mockResetCourseDates = ResetCourseDates(
141+
message = "Dates reset successfully",
142+
body = "Your course dates have been reset",
143+
header = "Success",
144+
link = "",
145+
linkText = ""
146+
)
147+
148+
val mockDownloadModel = DownloadModel(
149+
id = "video1",
150+
title = "Video 1",
151+
courseId = "test-course-id",
152+
size = 1000L,
153+
path = "/test/path/video1",
154+
url = "test-url",
155+
type = FileType.VIDEO,
156+
downloadedState = DownloadedState.NOT_DOWNLOADED,
157+
lastModified = null
158+
)
159+
160+
val mockVideoBlock = Block(
161+
id = "video1",
162+
blockId = "video1",
163+
lmsWebUrl = "lmsWebUrl",
164+
legacyWebUrl = "legacyWebUrl",
165+
studentViewUrl = "studentViewUrl",
166+
type = BlockType.VIDEO,
167+
displayName = "Video 1",
168+
graded = false,
169+
studentViewData = StudentViewData(
170+
onlyOnWeb = false,
171+
duration = "",
172+
transcripts = null,
173+
encodedVideos = EncodedVideos(
174+
youtube = null,
175+
hls = null,
176+
fallback = null,
177+
desktopMp4 = null,
178+
mobileHigh = null,
179+
mobileLow = VideoInfo(
180+
url = "test-url",
181+
fileSize = 1000L
182+
)
183+
),
184+
topicId = ""
185+
),
186+
studentViewMultiDevice = false,
187+
blockCounts = BlockCounts(0),
188+
descendants = emptyList(),
189+
descendantsType = BlockType.VIDEO,
190+
completion = 0.0,
191+
containsGatedContent = false,
192+
assignmentProgress = null,
193+
due = null,
194+
offlineDownload = null,
195+
)
196+
197+
val mockSequentialBlockForDownload = Block(
198+
id = "sequential1",
199+
blockId = "sequential1",
200+
lmsWebUrl = "lmsWebUrl",
201+
legacyWebUrl = "legacyWebUrl",
202+
studentViewUrl = "studentViewUrl",
203+
type = BlockType.SEQUENTIAL,
204+
displayName = "Sequential 1",
205+
graded = false,
206+
studentViewData = null,
207+
studentViewMultiDevice = false,
208+
blockCounts = BlockCounts(0),
209+
descendants = listOf("vertical1"),
210+
descendantsType = BlockType.VERTICAL,
211+
completion = 0.0,
212+
containsGatedContent = false,
213+
assignmentProgress = null,
214+
due = null,
215+
offlineDownload = null,
216+
)
217+
218+
val mockVerticalBlock = Block(
219+
id = "vertical1",
220+
blockId = "vertical1",
221+
lmsWebUrl = "lmsWebUrl",
222+
legacyWebUrl = "legacyWebUrl",
223+
studentViewUrl = "studentViewUrl",
224+
type = BlockType.VERTICAL,
225+
displayName = "Vertical 1",
226+
graded = false,
227+
studentViewData = null,
228+
studentViewMultiDevice = false,
229+
blockCounts = BlockCounts(0),
230+
descendants = listOf("video1"),
231+
descendantsType = BlockType.VIDEO,
232+
completion = 0.0,
233+
containsGatedContent = false,
234+
assignmentProgress = null,
235+
due = null,
236+
offlineDownload = null,
237+
)
238+
239+
val mockCourseStructureForDownload = CourseStructure(
240+
root = "sequential1",
241+
blockData = listOf(mockSequentialBlockForDownload, mockVerticalBlock, mockVideoBlock),
242+
id = "test-course-id",
243+
name = "Test Course",
244+
number = "CS101",
245+
org = "TestOrg",
246+
start = Date(),
247+
startDisplay = "2024-01-01",
248+
startType = "timestamped",
249+
end = Date(),
250+
coursewareAccess = CoursewareAccess(
251+
true,
252+
"",
253+
"",
254+
"",
255+
"",
256+
""
257+
),
258+
media = null,
259+
certificate = null,
260+
isSelfPaced = false,
261+
progress = null
262+
)
84263
}

0 commit comments

Comments
 (0)