Skip to content

Commit

Permalink
[Backend] Add SQS period to serializer (#4238)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchhablani authored Dec 12, 2023
1 parent 6edea67 commit 6de637c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/challenges/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class Meta:
"ephemeral_storage",
"evaluation_module_error",
"worker_image_url",
"worker_instance_type"
"worker_instance_type",
"sqs_retention_period"
)


Expand Down Expand Up @@ -309,7 +310,8 @@ class Meta:
"ec2_storage",
"ephemeral_storage",
"evaluation_module_error",
"worker_image_url"
"worker_image_url",
"sqs_retention_period"
)


Expand Down
19 changes: 19 additions & 0 deletions tests/unit/challenges/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def test_get_challenge(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
}
]

Expand Down Expand Up @@ -548,6 +549,7 @@ def test_get_particular_challenge(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
}
response = self.client.get(self.url, {})
self.assertEqual(response.data, expected)
Expand Down Expand Up @@ -649,6 +651,7 @@ def test_update_challenge_when_user_is_its_creator(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
}
response = self.client.put(
self.url, {"title": new_title, "description": new_description}
Expand Down Expand Up @@ -776,6 +779,7 @@ def test_particular_challenge_partial_update(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
}
response = self.client.patch(self.url, self.partial_update_data)
self.assertEqual(response.data, expected)
Expand Down Expand Up @@ -852,6 +856,7 @@ def test_particular_challenge_update(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
}
response = self.client.put(self.url, self.data)
self.assertEqual(response.data, expected)
Expand Down Expand Up @@ -1444,6 +1449,7 @@ def test_get_past_challenges(self):
"ephemeral_storage": self.challenge3.ephemeral_storage,
"worker_image_url": self.challenge3.worker_image_url,
"worker_instance_type": self.challenge3.worker_instance_type,
"sqs_retention_period": self.challenge3.sqs_retention_period,
}
]
response = self.client.get(self.url, {}, format="json")
Expand Down Expand Up @@ -1526,6 +1532,7 @@ def test_get_present_challenges(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
}
]
response = self.client.get(self.url, {}, format="json")
Expand Down Expand Up @@ -1608,6 +1615,7 @@ def test_get_future_challenges(self):
"ephemeral_storage": self.challenge4.ephemeral_storage,
"worker_image_url": self.challenge4.worker_image_url,
"worker_instance_type": self.challenge4.worker_instance_type,
"sqs_retention_period": self.challenge4.sqs_retention_period,
}
]
response = self.client.get(self.url, {}, format="json")
Expand Down Expand Up @@ -1690,6 +1698,7 @@ def test_get_all_challenges(self):
"ephemeral_storage": self.challenge3.ephemeral_storage,
"worker_image_url": self.challenge3.worker_image_url,
"worker_instance_type": self.challenge3.worker_instance_type,
"sqs_retention_period": self.challenge3.sqs_retention_period,
},
{
"id": self.challenge3.pk,
Expand Down Expand Up @@ -1756,6 +1765,7 @@ def test_get_all_challenges(self):
"ephemeral_storage": self.challenge3.ephemeral_storage,
"worker_image_url": self.challenge3.worker_image_url,
"worker_instance_type": self.challenge3.worker_instance_type,
"sqs_retention_period": self.challenge3.sqs_retention_period,
},
{
"id": self.challenge2.pk,
Expand Down Expand Up @@ -1822,6 +1832,7 @@ def test_get_all_challenges(self):
"ephemeral_storage": self.challenge2.ephemeral_storage,
"worker_image_url": self.challenge2.worker_image_url,
"worker_instance_type": self.challenge2.worker_instance_type,
"sqs_retention_period": self.challenge2.sqs_retention_period,
},
]
response = self.client.get(self.url, {}, format="json")
Expand Down Expand Up @@ -1959,6 +1970,7 @@ def test_get_featured_challenges(self):
"ephemeral_storage": self.challenge3.ephemeral_storage,
"worker_image_url": self.challenge3.worker_image_url,
"worker_instance_type": self.challenge3.worker_instance_type,
"sqs_retention_period": self.challenge3.sqs_retention_period,
}
]
response = self.client.get(self.url, {}, format="json")
Expand Down Expand Up @@ -2120,6 +2132,7 @@ def test_get_challenge_by_pk_when_user_is_challenge_host(self):
"ephemeral_storage": self.challenge3.ephemeral_storage,
"worker_image_url": self.challenge3.worker_image_url,
"worker_instance_type": self.challenge3.worker_instance_type,
"sqs_retention_period": self.challenge3.sqs_retention_period,
}

response = self.client.get(self.url, {})
Expand Down Expand Up @@ -2210,6 +2223,7 @@ def test_get_challenge_by_pk_when_user_is_participant(self):
"ephemeral_storage": self.challenge4.ephemeral_storage,
"worker_image_url": self.challenge4.worker_image_url,
"worker_instance_type": self.challenge4.worker_instance_type,
"sqs_retention_period": self.challenge4.sqs_retention_period,
}

self.client.force_authenticate(user=self.user1)
Expand Down Expand Up @@ -2360,6 +2374,7 @@ def test_get_challenge_when_host_team_is_given(self):
"ephemeral_storage": self.challenge2.ephemeral_storage,
"worker_image_url": self.challenge2.worker_image_url,
"worker_instance_type": self.challenge2.worker_instance_type,
"sqs_retention_period": self.challenge2.sqs_retention_period,
}
]

Expand Down Expand Up @@ -2438,6 +2453,7 @@ def test_get_challenge_when_participant_team_is_given(self):
"ephemeral_storage": self.challenge2.ephemeral_storage,
"worker_image_url": self.challenge2.worker_image_url,
"worker_instance_type": self.challenge2.worker_instance_type,
"sqs_retention_period": self.challenge2.sqs_retention_period,
}
]

Expand Down Expand Up @@ -2516,6 +2532,7 @@ def test_get_challenge_when_mode_is_participant(self):
"ephemeral_storage": self.challenge2.ephemeral_storage,
"worker_image_url": self.challenge2.worker_image_url,
"worker_instance_type": self.challenge2.worker_instance_type,
"sqs_retention_period": self.challenge2.sqs_retention_period,
}
]

Expand Down Expand Up @@ -2592,6 +2609,7 @@ def test_get_challenge_when_mode_is_host(self):
"ephemeral_storage": self.challenge.ephemeral_storage,
"worker_image_url": self.challenge.worker_image_url,
"worker_instance_type": self.challenge.worker_instance_type,
"sqs_retention_period": self.challenge.sqs_retention_period,
},
{
"id": self.challenge2.pk,
Expand Down Expand Up @@ -2658,6 +2676,7 @@ def test_get_challenge_when_mode_is_host(self):
"ephemeral_storage": self.challenge2.ephemeral_storage,
"worker_image_url": self.challenge2.worker_image_url,
"worker_instance_type": self.challenge2.worker_instance_type,
"sqs_retention_period": self.challenge2.sqs_retention_period,
},
]

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/participants/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ def test_get_teams_and_corresponding_challenges_for_a_participant(self):
"evaluation_module_error": self.challenge1.evaluation_module_error,
"worker_image_url": self.challenge1.worker_image_url,
"worker_instance_type": self.challenge1.worker_instance_type,
"sqs_retention_period": self.challenge1.sqs_retention_period,
},
"participant_team": {
"id": self.participant_team.id,
Expand Down Expand Up @@ -976,6 +977,7 @@ def test_get_participant_team_challenge_list(self):
"evaluation_module_error": self.challenge1.evaluation_module_error,
"worker_image_url": self.challenge1.worker_image_url,
"worker_instance_type": self.challenge1.worker_instance_type,
"sqs_retention_period": self.challenge1.sqs_retention_period,
}
]

Expand Down

0 comments on commit 6de637c

Please sign in to comment.