Much more nicely formed form error check
authorChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 16 Sep 2014 20:25:30 +0000 (15:25 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 16 Sep 2014 20:25:30 +0000 (15:25 -0500)
This doesn't rely on checking HTML output... thus, cleaner.

This commit sponsored by Alexandre Guédon.  Thank you!

mediagoblin/tests/test_edit.py

index e34ca27a87d7efed2ac413f52dfb7a15731ea461..547b382e2242c18ad3994c705ed8347962b6994a 100644 (file)
@@ -250,5 +250,7 @@ class TestMetaDataEdit:
         old_metadata = new_metadata
         new_metadata = media_entry.media_metadata
         assert new_metadata == old_metadata
-        assert (b"&#39;On the worst day&#39; is not a &#39;date-time&#39;" in
-            response.body)
+        context = template.TEMPLATE_TEST_CONTEXT[
+            'mediagoblin/edit/metadata.html']
+        assert context['form'].errors['media_metadata'][0]['identifier'][0] == \
+            "'On the worst day' is not a 'date-time'"