Exemplo n.º 1
0
def form_post():
    journal = request.form['journal'].upper()
    num_articles = request.form['num_articles']

    if pars.valid(journal, num_articles):
        result = q.enqueue(script.run, journal, num_articles)
    else:
        return render_template('input_error.html')

    return render_template('processing.html')
Exemplo n.º 2
0
def form_post():
    #https://stackoverflow.com/questions/12277933/send-data-from-a-textbox-into-flask
    journal = request.form['journal'].upper()
    num_articles = request.form['num_articles']

    if pars.valid(journal, num_articles):
        script.run(journal, num_articles)
    else:
        return render_template('input_error.html')

    return "Complete!"
Exemplo n.º 3
0
    def test_input_validation_fails_for_wrong_journal(self):
        value = pars.valid("mnras", self.test_num_articles)

        self.assertFalse(value)
Exemplo n.º 4
0
    def test_input_validation_fails_for_non_number_num_articles(self):
        value = pars.valid(self.test_journal, "dhj")

        self.assertFalse(value)
Exemplo n.º 5
0
    def test_input_validation_fails_for_negative_num_articles(self):
        value = pars.valid(self.test_journal, "-2")

        self.assertFalse(value)
Exemplo n.º 6
0
    def test_input_validation_passes_for_lowercase(self):
        value = pars.valid(self.test_journal.lower(), self.test_num_articles)

        self.assertTrue(value)