Skip to content

Commit

Permalink
fix: fixed the date issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas12091101 committed Mar 27, 2024
1 parent 52aa41b commit e4fc0fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions edx_sga/tests/test_sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ def personalize_upload(self, block, upload):
"""
Set values on block from file upload.
"""
now = datetime.datetime.utcnow().replace(
try:
now = datetime.datetime.now(datetime.UTC) # pylint: disable=no-member
except: # pylint: disable=bare-except
now = datetime.datetime.utcnow()
now = now.replace(

Check warning on line 187 in edx_sga/tests/test_sga.py

View check run for this annotation

Codecov / codecov/patch

edx_sga/tests/test_sga.py#L183-L187

Added lines #L183 - L187 were not covered by tests
tzinfo=pytz.timezone(getattr(settings, "TIME_ZONE", pytz.utc.zone))
)
block.annotated_mimetype = mimetypes.guess_type(upload.file.name)[0]
Expand Down Expand Up @@ -744,11 +748,15 @@ def test_prepare_download_submissions_task_called(
Test prepare download api
"""
block = self.make_xblock()
try:
timestamp = datetime.datetime.now(datetime.UTC) # pylint: disable=no-member
except: # pylint: disable=bare-except
timestamp = datetime.datetime.utcnow()

Check warning on line 754 in edx_sga/tests/test_sga.py

View check run for this annotation

Codecov / codecov/patch

edx_sga/tests/test_sga.py#L751-L754

Added lines #L751 - L754 were not covered by tests
get_sorted_submissions.return_value = [
{
"submission_id": uuid.uuid4().hex,
"filename": f"test_{uuid.uuid4().hex}.txt",
"timestamp": datetime.datetime.now(datetime.UTC),
"timestamp": timestamp,
}
for __ in range(2)
]
Expand Down

0 comments on commit e4fc0fd

Please sign in to comment.