Ronny Pfannschmidt  committed 28c3501

typo fixes, first test now actually runs

  • Participants
  • Parent commits 16c56cd
  • Branches flask-port

Comments (0)

Files changed (3)

File lodgeit/

 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}

File lodgeit/templates/layout.html

             <p>{% trans date=paste.pub_date|datetimeformat,
-                        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

File testing/

     return app
-def db(autouse=True):
+def db(app, client):
     from lodgeit.models import db
-    db.create_all()
+    db.create_all(app=app)
     return db
-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)