Beispiel #1
0
  def test_ereporter(self):
    from kay.ext.ereporter.models import ExceptionRecord
    self.assertEqual(ExceptionRecord.all().count(), 0, "ExceptionRecord objects already exist!")

    response = self.client.get(url_for('ereporter_testapp/index'))
    self.assertEqual(response.status_code, 500, "Expected 500 error code.")
    self.assertEqual(ExceptionRecord.all().count(), 1)

    # Simulate the key expiring.
    memcache.flush_all();

    response = self.client.get(url_for('ereporter_testapp/index'))
    self.assertEqual(response.status_code, 500, "Expected 500 error code.")
    self.assertEqual(ExceptionRecord.all().count(), 1, "More than one ExceptionRecord object was created!")
    self.assertEqual(ExceptionRecord.all()[0].count, 2, "ExceptionRecord count not incremented!")
Beispiel #2
0
def GetQuery(query_date=None, major_version=None, minor_version=None, order=None):
    """Creates a query object that will retrieve the appropriate exceptions.

  Returns:
    A query to retrieve the exceptions required.
  """
    q = ExceptionRecord.all()
    if query_date:
        q.filter("date =", query_date)
    if major_version:
        q.filter("major_version =", major_version)
    if minor_version:
        q.filter("minor_version =", minor_version)
    if order:
        q.order(order)
    return q
Beispiel #3
0
def GetQuery(query_date=None, major_version=None,
             minor_version=None, order=None):
  """Creates a query object that will retrieve the appropriate exceptions.

  Returns:
    A query to retrieve the exceptions required.
  """
  q = ExceptionRecord.all()
  if query_date:
      q.filter('date =', query_date)
  if major_version:
      q.filter('major_version =', major_version)
  if minor_version:
    q.filter('minor_version =', minor_version)
  if order:
    q.order(order)
  return q