Esempio n. 1
0
 def test_removals(self):
     test_hash = 'ABC123'
     removal = Removal()
     removal.hash = test_hash
     removal.group = DEFAULT_GROUP
     removal.validate()
     removal.save()
     resp = self.app.get(
         '/service/v2/remove/1970-01-01T00:00:00', follow_redirects=True)
     assert resp.status_code == 200
     assert resp.content_type == 'application/json'
     assert test_hash in resp.data
Esempio n. 2
0
def remove_for_group(group, since):
    """
    Returns all items to remove past a specific date in utc.

    :Parameters:
       - `since`: a specific date in utc
       - `group`: group to limit items to
    """
    try:
        timestamp = datetime.datetime.strptime(since, "%Y-%m-%dT%H:%M:%S")
        items = Removal.objects(date__gt=timestamp, group=group)
        return stream_items(items)
    except:
        return error()