def webconvert(): if not current_user.is_authenticated: return redirect("/index") form = WebConvertPostForm() if form.validate_on_submit(): lastQuery.clear() lastQuery.append(form.value.data) print(float(form.value.data)) print(form.fromQuery.data) print(form.afterQuery.data) search_results = google.convert_currency(float(form.value.data), form.fromQuery.data, form.afterQuery.data) userCurrencyConvert.clear() somePosts = [{ 'value': form.value.data, 'beforeQuery': form.fromQuery.data, 'afterQuery': form.afterQuery.data, 'result': search_results }] userCalculate.extend(somePosts) return redirect("/webconvert") return render_template('webconvert.html', title='Webconvert', form=form, userCurrencyConvert=userCurrencyConvert, current_user=current_user, lastQuery=lastQuery)
def test_convert_currency(self, html_f): """Test method to convert currency in google.""" # replace method to get html from a test html file google.currency.get_html = \ Mock(return_value=html_f.read().decode('utf8')) euros = google.convert_currency(5.0, "USD", "EUR") self.assertGreater(euros, 0.0)
def test_convert_currency(self): """Test method to convert currency in google.""" euros = google.convert_currency(5.0, "USD", "EUR") self.assertGreater(euros, 0.0)