Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions qiita_pet/handlers/user_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ def post(self):
try:
send_email(user.id, "Qiita: Password Reset", "Please go to "
"the following URL to reset your password: \n"
"%s/auth/reset/%s \nYou "
"%s/%s/auth/reset/%s \nYou "
"have 30 minutes from the time you requested a "
"reset to change your password. After this period, "
"you will have to request another reset." %
(qiita_config.base_url, info["pass_reset_code"]))
(qiita_config.base_url, qiita_config.portal_dir,
info["pass_reset_code"]))
message = ("Check your email for the reset code.")
level = "success"
page = "index.html"
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/templates/analysis_waiting.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<script src="{% raw qiita_config.portal_dir %}/static/vendor/js/moi_list.js"></script>
<script type="text/javascript">
$(document).ready(function() {
moi_list.init("{{group_id}}");
moi_list.init("{{group_id}}", undefined, window.location.host + '{% raw qiita_config.portal_dir %}/moi-ws/');
});
</script>
{% end %}
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/templates/list_studies.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}, targets: [1]},
// render the title cell
{"render": function ( data, type, row, meta ) {
return "<a href='#' data-toggle='modal' data-target='#study-abstract-modal' onclick=\"fillAbstract('studies-table', "+ meta.row +")\"><span class='glyphicon glyphicon-file' aria-hidden='true'></span></a> | <a href='/study/description/"+ row.study_id +"' id='study"+ meta.row +"-title'>"+ data +"</a>";
return "<a href='#' data-toggle='modal' data-target='#study-abstract-modal' onclick=\"fillAbstract('studies-table', "+ meta.row +")\"><span class='glyphicon glyphicon-file' aria-hidden='true'></span></a> | <a href='{% raw qiita_config.portal_dir %}/study/description/"+ row.study_id +"' id='study"+ meta.row +"-title'>"+ data +"</a>";
}, targets: [2]},
// render the metadata complete cell
{"render": function ( data, type, row, meta ) {
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/templates/sitebase.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
});

$("#analysis-drop-down").mouseover(function() {
$.getJSON("/analysis/dflt/sumary/", function(result){
$.getJSON("{% raw qiita_config.portal_dir %}/analysis/dflt/sumary/", function(result){
if(parseInt(result.studies) > 0){
$("#selected_samples_menu").removeClass('disabled');
$("#selected_samples_link").attr('href', '{% raw qiita_config.portal_dir %}/analysis/selected/');
Expand Down
256 changes: 145 additions & 111 deletions qiita_pet/test/test_study_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from qiita_pet.handlers.base_handlers import BaseHandler
from qiita_pet.test.tornado_test_base import TestHandlerBase
from qiita_core.exceptions import IncompetentQiitaDeveloperError
from qiita_core.qiita_settings import qiita_config
from qiita_db.artifact import Artifact
from qiita_db.study import StudyPerson, Study
from qiita_db.util import get_count, check_count
Expand Down Expand Up @@ -470,118 +471,141 @@ def test_get_no_access(self):
class TestSearchStudiesAJAX(TestHandlerBase):
database = True

json = {
'iTotalRecords': 1, 'sEcho': 1021, 'iTotalDisplayRecords': 1,
'aaData': [{
'study_id': 1,
'status': 'private',
'study_abstract':
'This is a preliminary study to examine the microbiota '
'associated with the Cannabis plant. Soils samples '
'from the bulk soil, soil associated with the roots, '
'and the rhizosphere were extracted and the DNA '
'sequenced. Roots from three independent plants of '
'different strains were examined. These roots were '
'obtained November 11, 2011 from plants that had been '
'harvested in the summer. Future studies will attempt '
'to analyze the soils and rhizospheres from the same '
'location at different time points in the plant '
'lifecycle.',
'metadata_complete': True,
'study_title':
'Identification of the Microbiomes for Cannabis Soils',
'num_raw_data': 1,
'number_samples_collected': 27,
'shared':
'<a target="_blank" href="mailto:shared@foo.bar">Shared</a>',
'publication_doi':
'<a target="_blank" href="http://dx.doi.org/10.100/123456">'
'10.100/123456</a>, <a target="_blank" '
'href="http://dx.doi.org/10.100/7891011">10.100/7891011</a>',
'pmid': '<a target="_blank" href="http://www.ncbi.nlm.nih.gov'
'/pubmed/7891011">7891011</a>, <a target="_blank" href='
'"http://www.ncbi.nlm.nih.gov/pubmed/123456">123456</a>',
'pi': '<a target="_blank" href="mailto:PI_dude@foo.bar">'
'PIDude</a>',
'proc_data_info': [{
'pid': 4,
'processed_date': '2012-10-02 17:30:00',
'data_type': '18S',
'algorithm': 'sortmerna',
'reference_name': 'Greengenes',
'reference_version': '13_8',
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
'similarity': 0.97,
'sortmerna_max_pos': 10000,
'sortmerna_e_value': 1,
'sortmerna_coverage': 0.97,
'threads': 1,
'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195',
'1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200',
'1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190',
'1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197',
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
}, {
'pid': 5,
'processed_date': '2012-10-02 17:30:00',
'data_type': '18S',
'algorithm': 'sortmerna',
'reference_name': 'Greengenes',
'reference_version': '13_8',
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
'similarity': 0.97,
'sortmerna_max_pos': 10000,
'sortmerna_e_value': 1,
'sortmerna_coverage': 0.97,
'threads': 1,
'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195',
'1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200',
'1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190',
'1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197',
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
}, {
'pid': 6,
'processed_date': '2012-10-02 17:30:00',
'data_type': '16S',
'algorithm': 'sortmerna',
'reference_name': 'Silva',
'reference_version': 'test',
'taxonomy_filepath': 'Silva_97_otu_taxonomy.txt',
'sequence_filepath': 'Silva_97_otus.fasta',
'tree_filepath': '',
'similarity': 0.97,
'sortmerna_max_pos': 10000,
'sortmerna_e_value': 1,
'sortmerna_coverage': 0.97,
'threads': 1,
'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195',
'1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200',
'1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190',
'1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197',
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
def setUp(self):
super(TestSearchStudiesAJAX, self).setUp()
self.json = {
'iTotalRecords': 1, 'sEcho': 1021, 'iTotalDisplayRecords': 1,
'aaData': [{
'study_id': 1,
'status': 'private',
'study_abstract':
'This is a preliminary study to examine the microbiota '
'associated with the Cannabis plant. Soils samples '
'from the bulk soil, soil associated with the roots, '
'and the rhizosphere were extracted and the DNA '
'sequenced. Roots from three independent plants of '
'different strains were examined. These roots were '
'obtained November 11, 2011 from plants that had been '
'harvested in the summer. Future studies will attempt '
'to analyze the soils and rhizospheres from the same '
'location at different time points in the plant '
'lifecycle.',
'metadata_complete': True,
'study_title':
'Identification of the Microbiomes for Cannabis Soils',
'num_raw_data': 1,
'number_samples_collected': 27,
'shared': '<a target="_blank" href="mailto:shared@foo.bar">'
'Shared</a>',
'publication_doi':
'<a target="_blank" href="http://dx.doi.org/10.100/123456"'
'>10.100/123456</a>, <a target="_blank" href='
'"http://dx.doi.org/10.100/7891011">10.100/7891011</a>',
'pmid': '<a target="_blank" href="http://www.ncbi.nlm.nih.gov'
'/pubmed/7891011">7891011</a>, <a target="_blank" href'
'="http://www.ncbi.nlm.nih.gov/pubmed/123456">123456'
'</a>',
'pi': '<a target="_blank" href="mailto:PI_dude@foo.bar">'
'PIDude</a>',
'proc_data_info': [{
'pid': 4,
'processed_date': '2012-10-02 17:30:00',
'data_type': '18S',
'algorithm': 'sortmerna',
'reference_name': 'Greengenes',
'reference_version': '13_8',
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
'similarity': 0.97,
'sortmerna_max_pos': 10000,
'sortmerna_e_value': 1,
'sortmerna_coverage': 0.97,
'threads': 1,
'samples': ['1.SKB1.640202', '1.SKB2.640194',
'1.SKB3.640195', '1.SKB4.640189',
'1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193',
'1.SKB9.640200', '1.SKD1.640179',
'1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186',
'1.SKD6.640190', '1.SKD7.640191',
'1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199',
'1.SKM3.640197', '1.SKM4.640180',
'1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201',
'1.SKM9.640192']
}, {
'pid': 5,
'processed_date': '2012-10-02 17:30:00',
'data_type': '18S',
'algorithm': 'sortmerna',
'reference_name': 'Greengenes',
'reference_version': '13_8',
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
'similarity': 0.97,
'sortmerna_max_pos': 10000,
'sortmerna_e_value': 1,
'sortmerna_coverage': 0.97,
'threads': 1,
'samples': ['1.SKB1.640202', '1.SKB2.640194',
'1.SKB3.640195', '1.SKB4.640189',
'1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193',
'1.SKB9.640200', '1.SKD1.640179',
'1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186',
'1.SKD6.640190', '1.SKD7.640191',
'1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199',
'1.SKM3.640197', '1.SKM4.640180',
'1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201',
'1.SKM9.640192']
}, {
'pid': 6,
'processed_date': '2012-10-02 17:30:00',
'data_type': '16S',
'algorithm': 'sortmerna',
'reference_name': 'Silva',
'reference_version': 'test',
'taxonomy_filepath': 'Silva_97_otu_taxonomy.txt',
'sequence_filepath': 'Silva_97_otus.fasta',
'tree_filepath': '',
'similarity': 0.97,
'sortmerna_max_pos': 10000,
'sortmerna_e_value': 1,
'sortmerna_coverage': 0.97,
'threads': 1,
'samples': ['1.SKB1.640202', '1.SKB2.640194',
'1.SKB3.640195', '1.SKB4.640189',
'1.SKB5.640181', '1.SKB6.640176',
'1.SKB7.640196', '1.SKB8.640193',
'1.SKB9.640200', '1.SKD1.640179',
'1.SKD2.640178', '1.SKD3.640198',
'1.SKD4.640185', '1.SKD5.640186',
'1.SKD6.640190', '1.SKD7.640191',
'1.SKD8.640184', '1.SKD9.640182',
'1.SKM1.640183', '1.SKM2.640199',
'1.SKM3.640197', '1.SKM4.640180',
'1.SKM5.640177', '1.SKM6.640187',
'1.SKM7.640188', '1.SKM8.640201',
'1.SKM9.640192']
}]
}]
}]
}
empty = {'aaData': [],
'iTotalDisplayRecords': 0,
'iTotalRecords': 0,
'sEcho': 1021}
}
self.empty = {'aaData': [],
'iTotalDisplayRecords': 0,
'iTotalRecords': 0,
'sEcho': 1021}
self.portal = qiita_config.portal

def tearDown(self):
super(TestSearchStudiesAJAX, self).tearDown()
qiita_config.portal = self.portal

def test_get(self):
response = self.get('/study/search/', {
Expand Down Expand Up @@ -620,6 +644,16 @@ def test_get_failure(self):
})
self.assertEqual(response.code, 403)

def test_get_emp_portal(self):
qiita_config.portal = "EMP"
response = self.get('/study/search/', {
'user': 'test@foo.bar',
'query': '',
'sEcho': '1021'
})
self.assertEqual(response.code, 200)
self.assertEqual(loads(response.body), self.empty)


class TestMetadataSummaryHandler(TestHandlerBase):
def test_error_prep_and_sample(self):
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __init__(self):
"template_path": TEMPLATE_PATH,
"debug": DEBUG,
"cookie_secret": COOKIE_SECRET,
"login_url": "/auth/login/",
"login_url": "%s/auth/login/" % qiita_config.portal_dir,
"ui_modules": uimodules,
}
tornado.web.Application.__init__(self, handlers, **settings)