Example #1
0
 def test_valid_datestring(self):
     testvals = (
         '2010-06-01',
         '2010-06-01T12:15:30',
         '2010-06-01T12:14:30.12321+02:00',
         '2010-06-01T12:14:30.12321-02:00',
         '2010-06-01T12:14:30.2115Z',
     )
     for timestamp in testvals:
         assert timestamp == timestamp_parameter(timestamp)
Example #2
0
 def test_valid_datestring(self):
     testvals = (
         '2010-06-01',
         '2010-06-01T12:15:30',
         '2010-06-01T12:14:30.12321+02:00',
         '2010-06-01T12:14:30.12321-02:00',
         '2010-06-01T12:14:30.2115Z',
     )
     for timestamp in testvals:
         self.assertEqual(timestamp, timestamp_parameter(timestamp))
Example #3
0
def issue_params(filter, state, labels, sort, direction, since):
    params = {}
    if filter in ('assigned', 'created', 'mentioned', 'subscribed', 'all'):
        params['filter'] = filter

    if state in ('open', 'closed', 'all'):
        params['state'] = state

    if labels:
        params['labels'] = labels

    if sort in ('created', 'updated', 'comments'):
        params['sort'] = sort

    if direction in ('asc', 'desc'):
        params['direction'] = direction

    since = timestamp_parameter(since)
    if since:
        params['since'] = since

    return params
Example #4
0
 def test_none_handling(self):
     assert timestamp_parameter(None, allow_none=True) is None
     pytest.raises(ValueError, timestamp_parameter, None, allow_none=False)
Example #5
0
 def test_datetimes(self):
     timestamp = datetime(2010, 6, 1, 12, 15, 30)
     assert '2010-06-01T12:15:30' == timestamp_parameter(timestamp)
Example #6
0
 def test_datetimes(self):
     timestamp = datetime(2010, 6, 1, 12, 15, 30)
     self.assertEqual('2010-06-01T12:15:30', timestamp_parameter(timestamp))
Example #7
0
 def test_none_handling(self):
     self.assertTrue(timestamp_parameter(None, allow_none=True) is None)
     self.assertRaises(ValueError, timestamp_parameter, None, 
             allow_none=False)
Example #8
0
 def test_none_handling(self):
     assert timestamp_parameter(None, allow_none=True) is None
     pytest.raises(ValueError, timestamp_parameter, None,
                   allow_none=False)
Example #9
0
 def test_datetimes(self):
     timestamp = datetime(2010, 6, 1, 12, 15, 30)
     assert '2010-06-01T12:15:30' == timestamp_parameter(timestamp)
Example #10
0
 def test_datetimes(self):
     timestamp = datetime(2010, 6, 1, 12, 15, 30)
     self.assertEqual('2010-06-01T12:15:30', timestamp_parameter(timestamp))
Example #11
0
 def test_none_handling(self):
     self.assertTrue(timestamp_parameter(None, allow_none=True) is None)
     self.assertRaises(ValueError,
                       timestamp_parameter,
                       None,
                       allow_none=False)