Skip to content

Commit

Permalink
test: plots in csv, html, html standalone formats (#52)
Browse files Browse the repository at this point in the history
* test: plots in csv, html, html standalone formats

new unit tests for plots in non-json formats.

* test: invalid plot format should throw HTTP 400
  • Loading branch information
alubbock authored Aug 27, 2024
1 parent 43e4fc0 commit ff48cc1
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions thunorweb/tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,69 @@ def test_time_course(self):
)
self.assertEqual(resp.status_code, HTTP_OK)

def test_time_course_csv(self):
self.client.force_login(self.user)
url = reverse('thunorweb:ajax_plot', args=['csv'])
resp = self.client.get(
url,
{'plotType': 'tc',
'datasetId': self.d.id,
'c': self.groupings['cellLines'][0]['id'],
'd': self.groupings['drugs'][0]['id'],
'assay': self.groupings['dipAssay'] or '',
'overlayDipFit': 'true',
'logTransform': 'log2'
}
)
self.assertEqual(resp.status_code, HTTP_OK)

def test_time_course_html(self):
self.client.force_login(self.user)
url = reverse('thunorweb:ajax_plot', args=['html'])
resp = self.client.get(
url,
{'plotType': 'tc',
'datasetId': self.d.id,
'c': self.groupings['cellLines'][0]['id'],
'd': self.groupings['drugs'][0]['id'],
'assay': self.groupings['dipAssay'] or '',
'overlayDipFit': 'true',
'logTransform': 'log2'
}
)
self.assertEqual(resp.status_code, HTTP_OK)

def test_time_course_html_standalone(self):
self.client.force_login(self.user)
url = reverse('thunorweb:ajax_plot', args=['html'])
resp = self.client.get(
url,
{'plotType': 'tc',
'datasetId': self.d.id,
'c': self.groupings['cellLines'][0]['id'],
'd': self.groupings['drugs'][0]['id'],
'assay': self.groupings['dipAssay'] or '',
'overlayDipFit': 'true',
'logTransform': 'log2',
'download': '1'
}
)
self.assertEqual(resp.status_code, HTTP_OK)

def test_invalid_format(self):
self.client.force_login(self.user)
url = reverse('thunorweb:ajax_plot', args=['pdf'])
resp = self.client.get(
url,
{'plotType': 'tc',
'datasetId': self.d.id,
'c': self.groupings['cellLines'][0]['id'],
'd': self.groupings['drugs'][0]['id'],
'assay': self.groupings['dipAssay'] or ''
}
)
self.assertEqual(resp.status_code, HTTP_INVALID_REQUEST)

def test_time_course_invalid_cell_line(self):
self.client.force_login(self.user)
url = reverse('thunorweb:ajax_plot', args=['json'])
Expand Down

0 comments on commit ff48cc1

Please sign in to comment.