Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1135 from roxell/cancel
Browse files Browse the repository at this point in the history
api: rest: add filter created_at
  • Loading branch information
chaws authored Apr 9, 2024
2 parents 9c630d5 + 5afec65 commit 3018fe8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions squad/api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class Meta:
"fetched": ['exact', 'in'],
"fetch_attempts": ['exact', 'in'],
"last_fetch_attempt": ['exact', 'in', 'lt', 'gt', 'lte', 'gte'],
"created_at": ['exact', 'in', 'lt', 'gt', 'lte', 'gte'],
"failure": ['exact', 'in', 'startswith', 'contains', 'icontains'],
"can_resubmit": ['exact', 'in'],
"resubmitted_count": ['exact', 'in'],
Expand Down
5 changes: 5 additions & 0 deletions test/api/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,11 @@ def test_testjob(self):
data = self.hit('/api/testjobs/%d/' % self.testjob.id)
self.assertEqual('myenv', data['environment'])

def test_testjob_filter_by_created_at(self):
very_old_date = str(datetime.datetime.now() - datetime.timedelta(days=365))
data = self.hit('/api/testjobs/?created_at=%s' % very_old_date)
self.assertEqual(0, len(data['results']))

def test_testjob_resubmitted_jobs(self):
data = self.hit('/api/testjobs/%d/resubmitted_jobs/' % self.testjob5.id)
self.assertIn(str(self.testjob5.id), data['results'][0]['parent_job'])
Expand Down

0 comments on commit 3018fe8

Please sign in to comment.