Browse Source

ajuste de teste e das telas de erro 404 e 500

pull/2485/head
Leandro Roberto 7 years ago
parent
commit
d18086ca3b
  1. 8
      sapl/base/tests/test_login.py
  2. 46
      sapl/templates/404.html
  3. 45
      sapl/templates/500.html

8
sapl/base/tests/test_login.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pytest
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
import pytest
pytestmark = pytest.mark.django_db pytestmark = pytest.mark.django_db
@ -12,14 +13,15 @@ def user():
def test_login_aparece_na_barra_para_usuario_nao_logado(client): def test_login_aparece_na_barra_para_usuario_nao_logado(client):
response = client.get('/') response = client.get('/')
assert '<a href="/login/"><img src="/static/img/user.png"></a>' in str( assert '<a class="nav-link" href="/login/"><img src="/static/img/user.png"></a>' in str(
response.content) response.content)
def test_username_do_usuario_logado_aparece_na_barra(client, user): def test_username_do_usuario_logado_aparece_na_barra(client, user):
assert client.login(username='jfirmino', password='123') assert client.login(username='jfirmino', password='123')
response = client.get('/') response = client.get('/')
assert '<a href="/login/">Login</a>' not in str(response.content) assert '<a class="nav-link" href="/login/">Login</a>' not in str(
response.content)
assert 'jfirmino' in str(response.content) assert 'jfirmino' in str(response.content)
assert '<a href="/logout/">Sair</a>' in str(response.content) assert '<a href="/logout/">Sair</a>' in str(response.content)

46
sapl/templates/404.html

@ -1,5 +1,7 @@
{% load i18n staticfiles sass_tags menus %} {% load i18n menus %}
{% load common_tags %} {% load common_tags %}
{% load render_bundle from webpack_loader %}
{% load webpack_static from webpack_loader %}
<!DOCTYPE html> <!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <!--[if gt IE 8]><!-->
@ -11,19 +13,11 @@
<title>{% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %}</title> <title>{% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block head_content %} {% block head_content %}
<link rel="icon" href="{% static 'img/favicon.ico' %}" type="image/png" > <link rel="icon" href="{% webpack_static 'img/favicon.ico' %}" type="image/png" >
{# Styles #} {% render_bundle 'global' 'css' %}
<link rel="stylesheet" href="{% static 'components-font-awesome/css/font-awesome.css' %}"> {% render_bundle THEME_CUSTOM 'css' %}
<link rel="stylesheet" href="{% sass_src 'bootstrap-sass/assets/stylesheets/_bootstrap.scss' %}" type="text/css">
<link rel="stylesheet" href="{% static 'drunken-parrot-flat-ui/css/drunken-parrot.css' %}">
<link rel="stylesheet" href="{% sass_src 'styles/app.scss' %}" type="text/css">
<link rel="stylesheet" href="{% static 'jquery-ui/themes/cupertino/jquery-ui.min.css' %}">
<script type="text/javascript" src="{% static 'jquery/dist/jquery.min.js' %}"></script>
{# Scripts #}
{# modernizr must be in head (see http://modernizr.com/docs/#installing) #}
{% endblock %} {% endblock %}
</head> </head>
@ -55,7 +49,7 @@
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/">
<img src="{% if logotipo %}{{ MEDIA_URL }}{{ logotipo }}{% else %}{% static 'img/logo.png' %}{% endif %}" <img src="{% if logotipo %}{{ MEDIA_URL }}{{ logotipo }}{% else %}{% webpack_static 'img/logo.png' %}{% endif %}"
alt="Logo" class="img-responsive visible-md-inline-block visible-lg-inline-block" > alt="Logo" class="img-responsive visible-md-inline-block visible-lg-inline-block" >
<span class="vcenter"> <span class="vcenter">
{# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #} {# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #}
@ -126,31 +120,13 @@
{% endif %} {% endif %}
{% block foot_js %} {% block foot_js %}
<!-- Bootstrap core JavaScript ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> {% render_bundle 'global' 'js' %}
<script type="text/javascript" src="{% static 'bootstrap-sass/assets/javascripts/bootstrap.min.js' %}"></script> {% render_bundle THEME_CUSTOM 'js' %}
<script type="text/javascript" src="{% static 'jquery-ui/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-ui/ui/i18n/datepicker-pt-BR.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.runner.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-mask-plugin/dist/jquery.mask.js' %}"></script>
<script src="{% static 'tinymce/tinymce.min.js' %}"></script>
<script type="text/javascript" src="{% static 'jsdiff/diff.min.js' %}"></script>
<script type="text/javascript" src="{% static 'drunken-parrot-flat-ui/js/checkbox.js' %}"></script>
<script type="text/javascript" src="{% static 'drunken-parrot-flat-ui/js/radio.js' %}"></script>
<script type="text/javascript" src="{% static 'js/app.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-query-object/jquery.query-object.js' %}"></script>
{% block extra_js %}{% endblock %} {% block extra_js %}{% endblock %}
<script type="text/javascript" > <script type="text/javascript" >
function inIframe () { function inIframe () {
try { try {
return window.self !== window.top; return window.self !== window.top;

45
sapl/templates/500.html

@ -1,5 +1,7 @@
{% load i18n staticfiles sass_tags menus %} {% load i18n menus %}
{% load common_tags %} {% load common_tags %}
{% load render_bundle from webpack_loader %}
{% load webpack_static from webpack_loader %}
<!DOCTYPE html> <!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <!--[if gt IE 8]><!-->
@ -11,19 +13,12 @@
<title>{% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %}</title> <title>{% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block head_content %} {% block head_content %}
<link rel="icon" href="{% static 'img/favicon.ico' %}" type="image/png" >
<link rel="icon" href="{% webpack_static 'img/favicon.ico' %}" type="image/png" >
{# Styles #} {% render_bundle 'global' 'css' %}
<link rel="stylesheet" href="{% static 'components-font-awesome/css/font-awesome.css' %}"> {% render_bundle THEME_CUSTOM 'css' %}
<link rel="stylesheet" href="{% sass_src 'bootstrap-sass/assets/stylesheets/_bootstrap.scss' %}" type="text/css">
<link rel="stylesheet" href="{% static 'drunken-parrot-flat-ui/css/drunken-parrot.css' %}">
<link rel="stylesheet" href="{% sass_src 'styles/app.scss' %}" type="text/css">
<link rel="stylesheet" href="{% static 'jquery-ui/themes/cupertino/jquery-ui.min.css' %}">
<script type="text/javascript" src="{% static 'jquery/dist/jquery.min.js' %}"></script>
{# Scripts #}
{# modernizr must be in head (see http://modernizr.com/docs/#installing) #}
{% endblock %} {% endblock %}
</head> </head>
@ -82,7 +77,7 @@
<a class="footer__logo" href="#"> <a class="footer__logo" href="#">
<a href="http://www.interlegis.leg.br/"> <a href="http://www.interlegis.leg.br/">
<img src="{% static 'img/logo_interlegis.png' %}" alt="{% trans 'Logo do Interlegis' %} "> <img src="{% webpack_static 'img/logo_interlegis.png' %}" alt="{% trans 'Logo do Interlegis' %} ">
</a> </a>
</a> </a>
<p> <p>
@ -93,7 +88,7 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<a class="footer__logo" href="#"> <a class="footer__logo" href="#">
<img src="{% static 'img/logo_cc.png' %}" alt="{% trans 'Logo do Creative Commons BY SA' %}"> <img src="{% webpack_static 'img/logo_cc.png' %}" alt="{% trans 'Logo do Creative Commons BY SA' %}">
</a> </a>
<p> <p>
<small> <small>
@ -108,26 +103,10 @@
{% endblock footer_container %} {% endblock footer_container %}
{% block foot_js %} {% block foot_js %}
<!-- Bootstrap core JavaScript ================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="{% static 'bootstrap-sass/assets/javascripts/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-ui/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-ui/ui/i18n/datepicker-pt-BR.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.runner.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-mask-plugin/dist/jquery.mask.js' %}"></script>
<script src="{% static 'tinymce/tinymce.min.js' %}"></script>
<script type="text/javascript" src="{% static 'jsdiff/diff.min.js' %}"></script>
<script type="text/javascript" src="{% static 'drunken-parrot-flat-ui/js/checkbox.js' %}"></script>
<script type="text/javascript" src="{% static 'drunken-parrot-flat-ui/js/radio.js' %}"></script>
<script type="text/javascript" src="{% static 'js/app.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-query-object/jquery.query-object.js' %}"></script>
{% render_bundle 'global' 'js' %}
{% render_bundle THEME_CUSTOM 'js' %}
{% block extra_js %}{% endblock %} {% block extra_js %}{% endblock %}
{% endblock foot_js %} {% endblock foot_js %}

Loading…
Cancel
Save