Exemplo n.º 1
0
    def should_return_user_object_dict_with_mapper_names_instead_of_table_names(self):
        from giveaminute.models import User
        cont = RestController()
        user = cont.orm.query(User).get(1)

        result = cont.instance_to_dict(user)

        assert_in('id', result)
        assert_not_in('user_id', result)
Exemplo n.º 2
0
    def should_return_user_object_dict_with_mapper_names_instead_of_table_names(
            self):
        from giveaminute.models import User
        cont = RestController()
        user = cont.orm.query(User).get(1)

        result = cont.instance_to_dict(user)

        assert_in('id', result)
        assert_not_in('user_id', result)
Exemplo n.º 3
0
 def test_that_it_doesnt_let_a_paramter_starting_with_underscore_through(
         self):
     cont = RestController()
     assert_equal(
         cont.get_model_params(**{
             'arg1': 1,
             'arg2': 2,
             '_arg3': 3
         }), {
             'arg1': 1,
             'arg2': 2
         })
Exemplo n.º 4
0
    def test_that_it_sets_the_user_to_an_sqlalchemy_object_if_its_a_gam_object(self):
        import giveaminute.models
        import giveaminute.user

        self.login(user_id=1)

        cont = RestController()
        cont.REST_FAKE = lambda: None

        cont._BASE_METHOD_HANDLER(['REST_FAKE'])

        assert_is_instance(cont.user, giveaminute.models.User)
Exemplo n.º 5
0
    def test_that_it_sets_the_user_to_an_sqlalchemy_object_if_its_a_gam_object(
            self):
        import giveaminute.models
        import giveaminute.user

        self.login(user_id=1)

        cont = RestController()
        cont.REST_FAKE = lambda: None

        cont._BASE_METHOD_HANDLER(['REST_FAKE'])

        assert_is_instance(cont.user, giveaminute.models.User)
Exemplo n.º 6
0
 def test_that_it_doesnt_let_a_paramter_starting_with_underscore_through(self):
     cont = RestController()
     assert_equal(cont.get_model_params(**{'arg1':1, 'arg2':2, '_arg3':3}), {'arg1':1, 'arg2':2})