Skip to content

Commit

Permalink
removed commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Lewinski committed Feb 22, 2022
1 parent 105c774 commit c67a74d
Showing 1 changed file with 1 addition and 158 deletions.
159 changes: 1 addition & 158 deletions tests/filters/test_text_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,161 +222,4 @@ def test_text_filter_iendswith(self):
print(result)
self.assertEqual(1, len(result['data']))
self.assertEqual('Stefan', result['data'][0]['name'])
# # Alt syntax
# response = self.client.get('/caretaker/', data={'order_by': 'name', '.last_seen:range': '2017-03-23T10:00:00+0100,2017-03-25T00:00:00+0100'})

# result = jsonloads(response.content)
# self.assertEqual(2, len(result['data']))
# self.assertEqual('Peter', result['data'][0]['name'])
# self.assertEqual('Stefan', result['data'][1]['name'])


# def test_text_filter_gte_match(self):
# response = self.client.get('/caretaker/', data={'.last_seen:gte': '2017-03-23T11:26:14Z', 'order_by': 'last_seen'})

# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(2, len(result['data']))
# self.assertEqual('Stefan', result['data'][0]['name'])
# self.assertEqual('Peter', result['data'][1]['name'])

# response = self.client.get('/caretaker/', data={'.last_seen:gte': '2017-03-23T12:00:00Z', 'order_by': 'last_seen'})

# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(1, len(result['data']))
# self.assertEqual('Peter', result['data'][0]['name'])

# response = self.client.get('/caretaker/', data={'.last_seen:gte': '2017-03-25T00:00:00Z'})

# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(0, len(result['data']))


# def test_text_filter_gt_match(self):
# # One second before earliest "last seen"
# response = self.client.get('/caretaker/', data={'.last_seen:gt': '2017-03-23T11:26:13Z', 'order_by': 'last_seen'})

# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(2, len(result['data']))
# self.assertEqual('Stefan', result['data'][0]['name'])
# self.assertEqual('Peter', result['data'][1]['name'])

# # One second later (exactly _on_ earliest "last seen")
# response = self.client.get('/caretaker/', data={'.last_seen:gt': '2017-03-23T11:26:14Z', 'order_by': 'last_seen'})

# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(1, len(result['data']))
# self.assertEqual('Peter', result['data'][0]['name'])

# response = self.client.get('/caretaker/', data={'.last_seen:gt': '2017-03-25T00:00:00Z'})

# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(0, len(result['data']))


# def test_text_filter_syntax_variations(self):
# # Precise milliseconds
# response = self.client.get('/caretaker/', data={'.last_seen:gt': '2017-03-23T11:26:13.9999Z', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(2, len(result['data']))

# # Implicitly we add T23:59:59Z here to make this correct.
# response = self.client.get('/caretaker/', data={'.last_seen:gt': '2017-03-23', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(1, len(result['data']))

# # Same as above, but to the range start we add T00:00:00Z
# response = self.client.get('/caretaker/', data={'.last_seen:range': '2017-03-23,2017-03-23', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(1, len(result['data']))

# # Just a sanity check
# response = self.client.get('/caretaker/', data={'.last_seen:range': '2017-03-23,2017-03-24', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(2, len(result['data']))

# # You can't mix and match date and text syntax
# response = self.client.get('/caretaker/', data={'.last_seen:range': '2017-03-23T00:00:00Z,2017-03-24', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 418)

# def test_text_filter_syntax_variations_with_chained_qualifiers(self):
# # Implicitly we add T23:59:59Z here to make this correct.
# response = self.client.get(
# '/caretaker/', data={'.last_seen:date:gt': '2017-03-23T23:59:59Z', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(1, len(result['data']))

# # Same as above, but to the range start we add T00:00:00Z
# response = self.client.get(
# '/caretaker/', data={'.last_seen:date:range': '2017-03-23T23:59:59Z,2017-03-23T23:59:59Z', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(1, len(result['data']))

# # Just a sanity check
# response = self.client.get('/caretaker/', data={'.last_seen:date:range': '2017-03-23T23:59:59Z,2017-03-24T23:59:59Z', 'order_by': 'last_seen'})
# self.assertEqual(response.status_code, 200)

# result = jsonloads(response.content)
# self.assertEqual(2, len(result['data']))

# def test_text_filter_syntax_errors_cause_error_response(self):
# response = self.client.get('/caretaker/', data={'.last_seen': '1838-05'})
# self.assertEqual(response.status_code, 418)

# response = self.client.get('/caretaker/', data={'.last_seen': '1838-05-01-02'})
# self.assertEqual(response.status_code, 418)

# # Incomplete timestamp
# response = self.client.get('/caretaker/', data={'.last_seen': '1838-05-01T02:10'})
# self.assertEqual(response.status_code, 418)

# # Missing +/- (or too many seconds)
# response = self.client.get('/caretaker/', data={'.last_seen': '1838-05-01T02:10:0220'})
# self.assertEqual(response.status_code, 418)

# def test_text_isnull(self):
# # Due to corona, I forgot when I last saw bob
# Caretaker(name='Bob', last_seen=None).save()
# response = self.client.get('/caretaker/', data={'.last_seen:isnull': 'True'})
# result = jsonloads(response.content)

# # We only get bob back with no data
# self.assertEqual(1, len(result['data']))
# self.assertEqual('Bob', result['data'][0]['name'])

# def test_text__isnull_false(self):
# # Due to corona, I forgot when I last saw bob
# Caretaker(name='Bob', last_seen=None).save()

# for false_value in ['0', 'false', 'False']:

# response = self.client.get('/caretaker/', data={'.last_seen:isnull': false_value})
# result = jsonloads(response.content)

# # We only get bob back with no data
# self.assertEqual(2, len(result['data']))
# self.assertNotEqual('Bob', result['data'][0]['name'])
# self.assertNotEqual('Bob', result['data'][1]['name'])

0 comments on commit c67a74d

Please sign in to comment.