Beispiel #1
0
    def test_get_counter_by_id(self):
        """
            Ensure that we can get a counter by it's id.
        """
        counter = Counter("test")
        counter.add_and_commit()

        counter = Counter.get_by_id(counter.id)
        self.assertEqual(counter.id, 1)
Beispiel #2
0
 def decorated_function(*args, **kwargs):
     id = kwargs['id']
     counter = Counter.get_by_id(id)
     if not counter:
         return jsonify({
             'status': 'error',
             'reason': 'Resource not found.'
         }), 404
     return f(counter, *args, **kwargs)