diff --git a/atdb/taskdatabase/tests/test_update_activity.py b/atdb/taskdatabase/tests/test_update_activity.py index edae888ec87194a40ebae08d1b44de247ba14542..cd015954369450045a47354dda962c44d2ecf10a 100644 --- a/atdb/taskdatabase/tests/test_update_activity.py +++ b/atdb/taskdatabase/tests/test_update_activity.py @@ -5,11 +5,14 @@ from taskdatabase.models import Task, Workflow, Activity class TestUpdateActivity(TestCase): def setUp(self): + """ + initialize test data + """ self.workflow_requantisation = Workflow(id=22, workflow_uri="psrfits_requantisation") self.workflow_requantisation.save() self.task1 = Task.objects.create(sas_id=12345, - filter="nv_19feb_2024", + filter="test_blabla", status='stored', workflow=self.workflow_requantisation, calculated_qualities={"per_task": "good", "per_sasid": "good"}) @@ -44,7 +47,9 @@ class TestUpdateActivity(TestCase): size_processed=500) def test_created_activity(self): - + """ + test if activity is created + """ activity = self.task1.activity # test if an activity with the correct sas_id was created @@ -53,8 +58,9 @@ class TestUpdateActivity(TestCase): 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 actual = activity.calculated_quality @@ -62,7 +68,9 @@ class TestUpdateActivity(TestCase): 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 actual = activity.ingestq_status @@ -73,7 +81,9 @@ class TestUpdateActivity(TestCase): 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 actual = activity.ingestq_status @@ -84,7 +94,10 @@ class TestUpdateActivity(TestCase): 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 actual = activity.ingestq_status @@ -95,7 +108,10 @@ class TestUpdateActivity(TestCase): 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 actual = activity.finished_fraction @@ -109,12 +125,14 @@ class TestUpdateActivity(TestCase): 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 actual = activity.filter - self.assertEqual(actual, "nv_19feb_2024") + self.assertEqual(actual, "test_blabla") actual = activity.workflow_id self.assertEqual(actual, 22)