Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 28c3501

typo fixes, first test now actually runs

Comments (0)

Files changed (3)

lodgeit/application.py

 
 @app.context_processor
 def inject_new_replies():
-    if flask.request.method=='GET':
-        from lodgeit.models import Paste
-        return {'get_new_replies': Paste.fetch_replies}
+    from lodgeit.models import Paste
+    return {'get_new_replies': Paste.fetch_replies}
 
 
 @app.errorhandler(404)

lodgeit/templates/layout.html

             <p>{% trans date=paste.pub_date|datetimeformat,
                         parent=paste.parent.identifier,
                         paste=paste.indentifier, 
-                        paste_url_for=url_for('pastes/show_paste', identifier=paste.identifier), 
-                        parent_url_for=url_for('pastes/show_paste', identifier=paste.parent.identifier),
-                        compare_url_for=url_for('pastes/compare_paste', new_id=paste.identifier, old_id=paste.parent.identifier) %}
+                        paste_url_for=url_for('pastes.show_paste', identifier=paste.identifier), 
+                        parent_url_for=url_for('pastes.show_paste', identifier=paste.parent.identifier),
+                        compare_url_for=url_for('pastes.compare_paste', new_id=paste.identifier, old_id=paste.parent.identifier) %}
               on {{ date }} someone replied to your paste 
               <a href="{{ parent_url_for }}">#{{ parent }}</a>,
               in paste <a href="{{ paste_url_for }}">#{{ paste }}</a>. Click here to
         {% elif request.first_visit %}
           <div class="notification">
             <h3>{% trans %}Welcome On LodgeIt{% endtrans %}</h3>
-            <p>{%- trans url_for=url_for('static/about') -%}
+            <p>{%- trans url_for=url_for('static.about') -%}
               Welcome to the LodgeIt pastebin. In order to use the notification feature
               a 31 day cookie with an unique ID was created for you. The lodgeit database
               does not store any information about you, it's just used for an advanced

testing/conftest.py

     return app
 
 
-@pytest.fixture
-def db(autouse=True):
+@pytest.fixture(autouse=True)
+def db(app, client):
     from lodgeit.models import db
-    db.create_all()
+    db.create_all(app=app)
     return db
 
 
 @pytest.fixture
-def client(app, db):
-    return app.test_client()
+def client(request, app):
+    client = app.test_client()
+    request.addfinalizer(lambda: client.__exit__(None, None, None))
+    return client.__enter__()
 
 
 @pytest.fixture(scope='session', autouse=True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.