Commit 130a626f authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Testing mapping without responses

parent ad03a318
......@@ -210,6 +210,10 @@ class RangeMappingForm(forms.Form):
).fit(np.array(responses).reshape(-1, 1)).cluster_centers_
clusters = sorted([c[0] for c in clusters])
except ModuleNotFoundError:
# Here when we do not have numpy
pass
except ValueError:
# Here when there is no data to work on
pass
for pos, m in enumerate(models.GlobalViralHostResponseValue.objects_mappable().order_by("value")[1:], 1):
......
......@@ -2382,6 +2382,18 @@ class DataSourceRangeMappingEditTestCase(ViewTestCase):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_works_when_empty(self):
self.client.force_login(self.user)
ds = models.DataSource.objects.create(
owner=self.user,
public=False,
name="public user",
raw_name="ee",
kind="FILE",
)
url = reverse('viralhostrangedb:data-source-mapping-edit', args=[ds.pk])
self.assertEqual(self.client.get(url).status_code, 200)
def test_submit_works(self):
url = reverse('viralhostrangedb:data-source-mapping-edit', args=[self.public_data_source_of_user.pk])
self.client.force_login(self.user)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment