Skip to content
Snippets Groups Projects
Commit 7ecedf62 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

handling review comments

parent d2484344
No related branches found
No related tags found
1 merge request!341SDC-1188 - final merge
Pipeline #72743 passed
...@@ -5,11 +5,14 @@ from taskdatabase.models import Task, Workflow, Activity ...@@ -5,11 +5,14 @@ from taskdatabase.models import Task, Workflow, Activity
class TestUpdateActivity(TestCase): class TestUpdateActivity(TestCase):
def setUp(self): def setUp(self):
"""
initialize test data
"""
self.workflow_requantisation = Workflow(id=22, workflow_uri="psrfits_requantisation") self.workflow_requantisation = Workflow(id=22, workflow_uri="psrfits_requantisation")
self.workflow_requantisation.save() self.workflow_requantisation.save()
self.task1 = Task.objects.create(sas_id=12345, self.task1 = Task.objects.create(sas_id=12345,
filter="nv_19feb_2024", filter="test_blabla",
status='stored', status='stored',
workflow=self.workflow_requantisation, workflow=self.workflow_requantisation,
calculated_qualities={"per_task": "good", "per_sasid": "good"}) calculated_qualities={"per_task": "good", "per_sasid": "good"})
...@@ -44,7 +47,9 @@ class TestUpdateActivity(TestCase): ...@@ -44,7 +47,9 @@ class TestUpdateActivity(TestCase):
size_processed=500) size_processed=500)
def test_created_activity(self): def test_created_activity(self):
"""
test if activity is created
"""
activity = self.task1.activity activity = self.task1.activity
# test if an activity with the correct sas_id was created # test if an activity with the correct sas_id was created
...@@ -53,8 +58,9 @@ class TestUpdateActivity(TestCase): ...@@ -53,8 +58,9 @@ class TestUpdateActivity(TestCase):
def test_stored(self): def test_stored(self):
"""
# test if the activity gets the calculated quality of the sas_id of the stored task test if the activity gets the calculated quality of the sas_id of the stored task
"""
activity = self.task1.activity activity = self.task1.activity
actual = activity.calculated_quality actual = activity.calculated_quality
...@@ -62,7 +68,9 @@ class TestUpdateActivity(TestCase): ...@@ -62,7 +68,9 @@ class TestUpdateActivity(TestCase):
def test_scrubbed(self): def test_scrubbed(self):
# test if the activity gets the ingested_fraction of an archived task """
test if the activity gets the ingested_fraction of 0 when scrubbed
"""
activity = self.task2.activity activity = self.task2.activity
actual = activity.ingestq_status actual = activity.ingestq_status
...@@ -73,7 +81,9 @@ class TestUpdateActivity(TestCase): ...@@ -73,7 +81,9 @@ class TestUpdateActivity(TestCase):
def test_archived(self): def test_archived(self):
# test if the activity gets the ingested_fraction of an archived task """
test if the activity gets the ingested_fraction of an archived task
"""
activity = self.task3.activity activity = self.task3.activity
actual = activity.ingestq_status actual = activity.ingestq_status
...@@ -84,7 +94,10 @@ class TestUpdateActivity(TestCase): ...@@ -84,7 +94,10 @@ class TestUpdateActivity(TestCase):
def test_finished(self): def test_finished(self):
# test if the activity gets the ingested_fraction of an archived task """
test if the activity gets the proper values from 'archived' json of a finished task
"""
activity = self.task4.activity activity = self.task4.activity
actual = activity.ingestq_status actual = activity.ingestq_status
...@@ -95,7 +108,10 @@ class TestUpdateActivity(TestCase): ...@@ -95,7 +108,10 @@ class TestUpdateActivity(TestCase):
def test_failed(self): def test_failed(self):
# test if the activity gets the ingested_fraction of an archived task """
test if the activity gets the ingested_fraction of an archived task
"""
activity = self.task5.activity activity = self.task5.activity
actual = activity.finished_fraction actual = activity.finished_fraction
...@@ -109,12 +125,14 @@ class TestUpdateActivity(TestCase): ...@@ -109,12 +125,14 @@ class TestUpdateActivity(TestCase):
def test_filter_and_workflow(self): def test_filter_and_workflow(self):
"""
test if the activity gets the filter and workflow_id of updated tasks
"""
# test if the activity gets the calculated quality of the sas_id of the stored task
activity = self.task1.activity activity = self.task1.activity
actual = activity.filter actual = activity.filter
self.assertEqual(actual, "nv_19feb_2024") self.assertEqual(actual, "test_blabla")
actual = activity.workflow_id actual = activity.workflow_id
self.assertEqual(actual, 22) self.assertEqual(actual, 22)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment