Skip to content
Snippets Groups Projects
Commit aea9dfba authored by Vermaat's avatar Vermaat
Browse files

Added unittests for /getGS and /Variant_info.

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@178 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 4e9b50bf
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ Uses WebTest, see: ...@@ -9,7 +9,7 @@ Uses WebTest, see:
I just installed webtest by 'easy_install webtest'. I just installed webtest by 'easy_install webtest'.
@todo: Tests for /upload, /getGS, and /Variant_info. @todo: Tests for /upload.
""" """
#import logging; logging.basicConfig() #import logging; logging.basicConfig()
...@@ -444,12 +444,53 @@ facilisi.""" ...@@ -444,12 +444,53 @@ facilisi."""
def test_soap_documentation(self): def test_soap_documentation(self):
""" """
Test the SOAP documentation generated from the WSDL. Test the SOAP documentation generated from the WSDL.
""" """
r = self.app.get('/documentation') r = self.app.get('/documentation')
self.assertEqual(r.content_type, 'text/html') self.assertEqual(r.content_type, 'text/html')
r.mustcontain('Web Service: Mutalyzer') r.mustcontain('Web Service: Mutalyzer')
def test_getgs(self):
"""
Test the /getGS interface used by LOVD2.
"""
r = self.app.get('/getGS?variantRecord=NM_003002.2&forward=1&mutationName=NG_012337.1:g.7055C%3ET')
r.mustcontain('0 Errors',
'0 Warnings',
'Raw variant 1: substitution at 7055',
'<a href="#bottom" class="hornav">go to bottom</a>',
'<input value="NG_012337.1(SDHD_v001):g.7055C&gt;T" type="text" name="mutationName" style="width:100%">')
def test_variantinfo_g2c(self):
"""
Test the /Variant_info interface used by LOVD2 (g to c).
"""
r = self.app.get('/Variant_info?LOVD_ver=2.0-29&build=hg19&acc=NM_203473.1&var=g.48374289_48374389del')
self.assertEqual(r.content_type, 'text/plain')
expected = '\n'.join(['1020', '0', '1072', '48', '48374289', '48374389', 'del'])
self.assertEqual(r.body, expected)
def test_variantinfo_c2g(self):
"""
Test the /Variant_info interface used by LOVD2 (c to g).
"""
r = self.app.get('/Variant_info?LOVD_ver=2.0-29&build=hg19&acc=NM_203473.1&var=c.1020_1072%2B48del')
self.assertEqual(r.content_type, 'text/plain')
expected = '\n'.join(['1020', '0', '1072', '48', '48374289', '48374389', 'del'])
self.assertEqual(r.body, expected)
def test_variantinfo_c2g_downstream(self):
"""
Test the /Variant_info interface used by LOVD2 (c variant downstream
notation to g).
"""
r = self.app.get('/Variant_info?LOVD_ver=2.0-29&build=hg19&acc=NM_203473.1&var=c.1709%2Bd187del')
self.assertEqual(r.content_type, 'text/plain')
expected = '\n'.join(['1709', '187', '1709', '187', '48379389', '48379389', 'del'])
self.assertEqual(r.body, expected)
if __name__ == '__main__': if __name__ == '__main__':
# Usage: # Usage:
# ./test_wsgi.py -v # ./test_wsgi.py -v
# Or, selecting a specific test:
# ./test_wsgi.py -v TestWSGI.test_getgs_del
unittest.main() unittest.main()
...@@ -311,8 +311,6 @@ class GetGS: ...@@ -311,8 +311,6 @@ class GetGS:
the first transcript. LOVD supplies the NM of the transcript needed but the first transcript. LOVD supplies the NM of the transcript needed but
this was ignored. This helper allows LOVD to get the requested this was ignored. This helper allows LOVD to get the requested
transcript variant from a genomic reference. transcript variant from a genomic reference.
@todo: Test this.
""" """
def GET(self): def GET(self):
""" """
...@@ -328,8 +326,12 @@ class GetGS: ...@@ -328,8 +326,12 @@ class GetGS:
i = web.input(mutationName=None, variantRecord=None, forward=None) i = web.input(mutationName=None, variantRecord=None, forward=None)
# Todo: The following is probably a problem elsewhere too.
# We stringify the variant, because a unicode string crashes
# Bio.Seq.reverse_complement in Mapper.py:607.
# We are only interested in the legend # We are only interested in the legend
Mutalyzer.process(i.mutationName, C, O) Mutalyzer.process(str(i.mutationName), C, O)
legends = O.getOutput("legends") legends = O.getOutput("legends")
...@@ -531,8 +533,6 @@ class PositionConverter: ...@@ -531,8 +533,6 @@ class PositionConverter:
class VariantInfo: class VariantInfo:
""" """
The I{g.} to I{c.} and vice versa interface for LOVD. The I{g.} to I{c.} and vice versa interface for LOVD.
@todo: Tests.
""" """
def GET(self): def GET(self):
""" """
......
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