added columns.sortable() method
[django-tables2.git] / tests / test_basic.py
index b0dde2f5de57c06b1006721455425c9d3cdac234..589bbfced1aedb85e7335ba5115345f6a87ed026 100644 (file)
@@ -267,10 +267,24 @@ def test_pagination():
     assert books.page.has_previous() == False\r
     assert books.page.has_next() == True\r
 \r
+# TODO: all the column stuff might warrant it's own test file\r
 def test_columns():\r
-    """Test specific column features.\r
+    """Test Table.columns container functionality.\r
+    """\r
+\r
+    class BookTable(tables.Table):\r
+        id = tables.Column(sortable=False)\r
+        name = tables.Column(sortable=True)\r
+        pages = tables.Column(sortable=True)\r
+        language = tables.Column(sortable=False)\r
+    books = BookTable([])\r
 \r
-    Might warrant it's own test file."""\r
+    assert list(books.columns.sortable()) == [c for c in books.columns if c.sortable]\r
+\r
+\r
+def test_column_order():\r
+    """Test the order functionality of bound columns.\r
+    """\r
 \r
     class BookTable(tables.Table):\r
         id = tables.Column()\r