Skip to content

Commit

Permalink
feat: upgrade to sodar core v1 (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo committed Oct 9, 2024
1 parent 85aac5f commit 7bdd924
Show file tree
Hide file tree
Showing 19 changed files with 347 additions and 260 deletions.
20 changes: 10 additions & 10 deletions backend/beaconsite/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from django.urls import reverse

from beaconsite.models import Consortium, Site
from variants.tests.helpers import ViewTestBase
from variants.tests.helpers import TestViewsBase


class TestIndexView(ViewTestBase):
class TestIndexView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(reverse("beaconsite:index"))
Expand All @@ -18,7 +18,7 @@ def test_render(self):
self.assertEqual(response.context["site_list"][0].pk, self.site.pk)


class TestConsortiumListView(ViewTestBase):
class TestConsortiumListView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(reverse("beaconsite:consortium-list"))
Expand All @@ -27,7 +27,7 @@ def test_render(self):
self.assertEqual(response.context["object_list"][0].pk, self.consortium.pk)


class TestConsortiumCreateView(ViewTestBase):
class TestConsortiumCreateView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(reverse("beaconsite:consortium-create"))
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_create(self):
self.assertEqual(Consortium.objects.count(), 2)


class TestConsortiumUpdateView(ViewTestBase):
class TestConsortiumUpdateView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(
Expand Down Expand Up @@ -110,7 +110,7 @@ def test_update(self):
self.assertEqual([self.project.pk], [p.pk for p in self.consortium.projects.all()])


class TestConsortiumDeleteView(ViewTestBase):
class TestConsortiumDeleteView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(
Expand Down Expand Up @@ -139,7 +139,7 @@ def test_delete(self):
self.assertEqual(Consortium.objects.all().count(), 0)


class TestSiteListView(ViewTestBase):
class TestSiteListView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(reverse("beaconsite:site-list"))
Expand All @@ -148,7 +148,7 @@ def test_render(self):
self.assertEqual(response.context["object_list"][0].pk, self.site.pk)


class TestSiteCreateView(ViewTestBase):
class TestSiteCreateView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(reverse("beaconsite:site-create"))
Expand Down Expand Up @@ -184,7 +184,7 @@ def test_create(self):
self.assertEqual(Site.objects.count(), 2)


class TestSiteUpdateView(ViewTestBase):
class TestSiteUpdateView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(
Expand Down Expand Up @@ -246,7 +246,7 @@ def test_update(self):
self.assertEqual([self.consortium.pk], [s.pk for s in self.site.consortia.all()])


class TestSiteDeleteView(ViewTestBase):
class TestSiteDeleteView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(
Expand Down
2 changes: 1 addition & 1 deletion backend/cases_import/models/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, project: Project):
def _build_fs_options(self, project: Project) -> FileSystemOptions:
"""Build `FileSystemOptions` from project settings."""
app_settings = AppSettingAPI()
kwargs = {"app_name": "cases_import", "project": project}
kwargs = {"plugin_name": "cases_import", "project": project}

path = app_settings.get(setting_name="import_data_path", **kwargs) or None
if not path:
Expand Down
2 changes: 1 addition & 1 deletion backend/cases_import/tests/test_models_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _setUpExecutor(self, action, fac_kwargs=None):

app_settings = AppSettingAPI()
app_settings.set(
app_name="cases_import",
plugin_name="cases_import",
setting_name="import_data_protocol",
value="file",
project=self.project,
Expand Down
2 changes: 1 addition & 1 deletion backend/cases_qc/tests/test_views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _setUpExecutor(self, fac_kwargs: typing.Dict[str, str]):

app_settings = AppSettingAPI()
app_settings.set(
app_name="cases_import",
plugin_name="cases_import",
setting_name="import_data_protocol",
value="file",
project=self.project,
Expand Down
7 changes: 5 additions & 2 deletions backend/genepanels/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ def __init__(self, *args, **kwargs):
self.fields["genes"] = self._build_genes_field()

def _build_genes_field(self):
rows = [entry.symbol for entry in self.instance.genepanelentry_set.all()]
initial_value = "\n".join(rows)
if self.instance.pk:
rows = [entry.symbol for entry in self.instance.genepanelentry_set.all()]
initial_value = "\n".join(rows)
else:
initial_value = ""
return forms.CharField(
label="Genes",
widget=forms.Textarea,
Expand Down
6 changes: 4 additions & 2 deletions backend/genepanels/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def test_create(self):

def test_get_absolute_url(self):
category = GenePanelCategoryFactory()
self.assertEqual(category.get_absolute_url(), f"/genepanels/category/{category.sodar_uuid}")
self.assertEqual(
category.get_absolute_url(), f"/genepanels/category/{category.sodar_uuid}/"
)

def test_str(self):
category = GenePanelCategoryFactory()
Expand All @@ -46,7 +48,7 @@ def test_create(self):

def test_get_absolute_url(self):
panel = GenePanelFactory()
self.assertEqual(panel.get_absolute_url(), f"/genepanels/panel/{panel.sodar_uuid}")
self.assertEqual(panel.get_absolute_url(), f"/genepanels/panel/{panel.sodar_uuid}/")

def test_get_hgnc_list(self):
panel = GenePanelFactory()
Expand Down
24 changes: 12 additions & 12 deletions backend/genepanels/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
GenePanelEntryFactory,
GenePanelFactory,
)
from variants.tests.helpers import ViewTestBase
from variants.tests.helpers import TestViewsBase

ANNONARS_GENE_RESPONSE = {
"TTN": {
Expand Down Expand Up @@ -54,7 +54,7 @@ def _set_annonars_mocker(self, mock_):
)


class IndexViewTest(ViewTestBase):
class IndexViewTest(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory()
Expand All @@ -67,7 +67,7 @@ def test_render(self):
self.assertEquals(response.context["show_retired"], False)


class GenePanelCategoryListView(ViewTestBase):
class GenePanelCategoryListView(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory()
Expand All @@ -88,7 +88,7 @@ def test_render_show_retired(self):
self.assertEquals(response.context["show_retired"], True)


class GenePanelCategoryCreateView(ViewTestBase):
class GenePanelCategoryCreateView(TestViewsBase):
def test_render(self):
with self.login(self.superuser):
response = self.client.get(reverse("genepanels:category-create"))
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_create(self):
self.assertEqual(GenePanelCategory.objects.count(), 1)


class GenePanelCategoryUpdateView(ViewTestBase):
class GenePanelCategoryUpdateView(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory()
Expand Down Expand Up @@ -164,7 +164,7 @@ def test_update(self):
self.assertEqual(getattr(self.category, key), post_data[key])


class GenePanelCategoryDeleteView(ViewTestBase):
class GenePanelCategoryDeleteView(TestViewsBase):
def setUp(self):
super().setUp()
self.category = GenePanelCategoryFactory()
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_delete(self):
self.assertEqual(GenePanelCategory.objects.all().count(), 0)


class GenePanelCreateView(AnnonarsMockerMixin, ViewTestBase):
class GenePanelCreateView(AnnonarsMockerMixin, TestViewsBase):
def setUp(self):
super().setUp()
self.category = GenePanelCategoryFactory()
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_create_with_gene_list_including_nonexistent_gene(self, mock):
)


class GenePanelUpdateView(AnnonarsMockerMixin, ViewTestBase):
class GenePanelUpdateView(AnnonarsMockerMixin, TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory(state=GenePanelState.DRAFT.value)
Expand Down Expand Up @@ -356,7 +356,7 @@ def test_update(self, mock):
self.assertEqual(self.panel.category, self.category)


class GenePanelDeleteView(ViewTestBase):
class GenePanelDeleteView(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory(state=GenePanelState.DRAFT.value)
Expand Down Expand Up @@ -437,7 +437,7 @@ def test_post_non_draft_state(self, state):
self.assertEqual(GenePanel.objects.count(), 1)


class GenePanelReleaseView(ViewTestBase):
class GenePanelReleaseView(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory(state=GenePanelState.DRAFT.value, version_minor=2)
Expand Down Expand Up @@ -527,7 +527,7 @@ def test_post_non_draft_state(self, state):
self.assertEqual(self.old_panel.state, GenePanelState.ACTIVE.value)


class GenePanelRetireView(ViewTestBase):
class GenePanelRetireView(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory(state=GenePanelState.ACTIVE.value, version_minor=2)
Expand Down Expand Up @@ -608,7 +608,7 @@ def test_post_non_active_state(self, state):
self.assertEqual(self.panel.state, state)


class GenePanelCopyAsDraftView(ViewTestBase):
class GenePanelCopyAsDraftView(TestViewsBase):
def setUp(self):
super().setUp()
self.panel = GenePanelFactory(state=GenePanelState.ACTIVE.value, version_minor=2)
Expand Down
19 changes: 0 additions & 19 deletions backend/maintenance/management/commands/create_variant_summary.py

This file was deleted.

19 changes: 0 additions & 19 deletions backend/maintenance/management/commands/drop_variant_summary.py

This file was deleted.

2 changes: 1 addition & 1 deletion backend/seqmeta/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_create(self):

def test_get_absolute_url(self):
kit = EnrichmentKitFactory()
self.assertEqual(kit.get_absolute_url(), f"/seqmeta/enrichmentkit/{kit.sodar_uuid}")
self.assertEqual(kit.get_absolute_url(), f"/seqmeta/enrichmentkit/{kit.sodar_uuid}/")

def test_str(self):
kit = EnrichmentKitFactory()
Expand Down
8 changes: 4 additions & 4 deletions backend/seqmeta/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.urls import reverse

from seqmeta.tests.factories import TargetBedFileFactory
from variants.tests.helpers import ViewTestBase
from variants.tests.helpers import TestViewsBase


class IndexViewTest(ViewTestBase):
class IndexViewTest(TestViewsBase):
def setUp(self):
super().setUp()
self.targetbedfile = TargetBedFileFactory()
Expand All @@ -17,7 +17,7 @@ def test_render(self):
self.assertEqual(response.context["object_list"].count(), 1)


class EnrichmentKitListViewTest(ViewTestBase):
class EnrichmentKitListViewTest(TestViewsBase):
def setUp(self):
super().setUp()
self.targetbedfile = TargetBedFileFactory()
Expand All @@ -30,7 +30,7 @@ def test_render(self):
self.assertEqual(response.context["object_list"].count(), 1)


class EnrichmentKitDetailView(ViewTestBase):
class EnrichmentKitDetailView(TestViewsBase):
def setUp(self):
super().setUp()
self.targetbedfile = TargetBedFileFactory()
Expand Down
2 changes: 1 addition & 1 deletion backend/varannos/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_create(self):

def test_get_absolute_url(self):
obj = VarAnnoSetFactory()
self.assertEqual(obj.get_absolute_url(), f"/varannos/varannoset/details/{obj.sodar_uuid}")
self.assertEqual(obj.get_absolute_url(), f"/varannos/varannoset/details/{obj.sodar_uuid}/")

def test_days_since_modification(self):
with freeze_time((datetime.now() - timedelta(days=10)).strftime("%Y-%m-%d")):
Expand Down
6 changes: 3 additions & 3 deletions backend/varannos/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.urls import reverse

from varannos.tests.factories import VarAnnoSetFactory
from variants.tests.helpers import ViewTestBase
from variants.tests.helpers import TestViewsBase


class TestVarAnnoSetListView(ViewTestBase):
class TestVarAnnoSetListView(TestViewsBase):
def setUp(self):
super().setUp()
self.varannoset = VarAnnoSetFactory(project=self.project)
Expand All @@ -18,7 +18,7 @@ def test_render(self):
self.assertIsNotNone(response.context["object_list"])


class TestVarAnnoSetDetailView(ViewTestBase):
class TestVarAnnoSetDetailView(TestViewsBase):
def setUp(self):
super().setUp()
self.varannoset = VarAnnoSetFactory(project=self.project)
Expand Down
2 changes: 1 addition & 1 deletion backend/varfish/users/management/commands/initdev.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _create_project(
for setting_name, value in setting_value.items():
if project_settings.get(setting_name) != value:
app_settings.set(
app_name="cases_import",
plugin_name="cases_import",
setting_name=setting_name,
value=value,
project=project,
Expand Down
Loading

0 comments on commit 7bdd924

Please sign in to comment.