def test_wrapped_column_is_sorted_via_table(): meta = Fake().has_attr(order_by="kappa") table = Fake().has_attr(_meta=meta) column_a = Fake().has_attr(name="kappa") column_b = Fake().has_attr(name="mu") wrapped_column_a = WrappedColumn(table, column_a) # sorted wrapped_column_b = WrappedColumn(table, column_b) # unsorted assert wrapped_column_a.is_sorted == True assert wrapped_column_b.is_sorted == False assert wrapped_column_a.sort_direction == "asc" assert wrapped_column_b.sort_direction == None meta.has_attr(order_by="-mu") assert wrapped_column_a.is_sorted == False assert wrapped_column_b.is_sorted == True assert wrapped_column_a.sort_direction == None assert wrapped_column_b.sort_direction == "desc"
# See the License for the specific language governing permissions and # limitations under the License. from fudge import Fake, with_fakes, with_patched_object, clear_expectations from fudge.inspector import arg import cherrypy import ion.controllers as ctrl from ion.controllers import Controller, route, authenticated def clear(): ctrl.__CONTROLLERS__ = [] ctrl.__CONTROLLERSDICT__ = {} authenticated_cherrypy = Fake('cherrypy') authenticated_cherrypy.has_attr(session={'authenticated_user':'******'}) def test_can_create_controller(): ctrl = Controller() assert ctrl def test_controller_has_null_context_by_default(): ctrl = Controller() assert not ctrl.context def test_controller_has_null_server_by_default(): ctrl = Controller() assert not ctrl.server