Esempio n. 1
0
def build_query():
    qb = QueryBuilder()
    start = datetime.strptime("2015-11-17 00:00:00", "%Y-%m-%d %H:%M:%S")
    end = datetime.strptime("2015-11-20 23:59:59", "%Y-%m-%d %H:%M:%S")
    qb.between(start, end)
    qb.orderbydesc("sys_created_on")
    return qb.return_query
Esempio n. 2
0
def build_query():
    qb = QueryBuilder()
    start = datetime.strptime('2015-11-17 00:00:00', "%Y-%m-%d %H:%M:%S")
    end = datetime.strptime('2015-11-20 23:59:59', "%Y-%m-%d %H:%M:%S")
    qb.between(start, end)
    qb.orderbydesc("sys_created_on")
    return qb.return_query
Esempio n. 3
0
 def test_list_date_range(self):
   qb = QueryBuilder()
   # xxxmockrefactor
   # this test needs refactoring: its just checking mock data
   # but service now server-side responds with the data correctly (the date query).
   start = test_helpers.to_date('2013-12-31 00:00:00')
   end = test_helpers.to_date('2014-01-01 00:00:00')
   qb.between(start, end)
   lst = self.client.list("original_table", sysparm_limit=5, sysparm_query=qb.return_query)
   # ensure they are all in the range.
   assert(all(map(lambda x, start=start: test_helpers.to_date(x.sys_created_on) > start,lst)))
   assert(all(map(lambda x, end=end: test_helpers.to_date(x.sys_created_on) < end,lst)))
Esempio n. 4
0
 def test_list_date_range(self):
     qb = QueryBuilder()
     # xxxmockrefactor
     # this test needs refactoring: its just checking mock data
     # but service now server-side responds with the data correctly (the date query).
     start = test_helpers.to_date('2013-12-31 00:00:00')
     end = test_helpers.to_date('2014-01-01 00:00:00')
     qb.between(start, end)
     lst = self.client.list("original_table",
                            sysparm_limit=5,
                            sysparm_query=qb.return_query)
     # ensure they are all in the range.
     assert (all(
         map(lambda x, start=start: test_helpers.to_date(x.sys_created_on) >
             start,
             lst)))
     assert (all(
         map(lambda x, end=end: test_helpers.to_date(x.sys_created_on) <
             end,
             lst)))