def test_statistics(self): self.load_fixtures() compute_collection(self.private_coll, sync=True) _, headers = self.login(is_admin=True) url = '/api/2/collections/%s' % self.private_coll.id res = self.client.get(url, headers=headers) assert res.status_code == 200, res stats = res.json['statistics'] assert 'Folder' in stats['schema']['values'], stats assert '*****@*****.**' in stats['emails']['values'], stats
def test_statistics(self): self.load_fixtures() compute_collection(self.private_coll, sync=True) _, headers = self.login(is_admin=True) url = "/api/2/collections/%s" % self.private_coll.id res = self.client.get(url, headers=headers) assert res.status_code == 200, res stats = res.json["statistics"] assert "Folder" in stats["schema"]["values"], stats assert "*****@*****.**" in stats["emails"]["values"], stats
def test_statistics(self): self.load_fixtures() compute_collection(self.private_coll, sync=True) _, headers = self.login(is_admin=True) url = '/api/2/collections/%s/statistics' % self.private_coll.id res = self.client.get(url) assert res.status_code == 403, res res = self.client.get(url, headers=headers) assert res.status_code == 200, res assert 'Folder' in res.json['schema']['values'], res.json assert 'Vladimir Putin' in res.json['names']['values'], res.json
def test_statistics(self): res = self.client.get('/api/2/statistics') assert res.status_code == 200, res assert 'things' in res.json, res.json assert res.json['collections'] == 0, res.json assert res.json['things'] == 0, res.json self.load_fixtures() compute_collection(self.private_coll, sync=True) compute_collection(self.public_coll, sync=True) res = self.client.get('/api/2/statistics') assert res.status_code == 200, res assert res.json['collections'] == 1, res.json assert res.json['things'] == 1, res.json _, headers = self.login(is_admin=True) res = self.client.get('/api/2/statistics', headers=headers) assert res.status_code == 200, res assert res.json['collections'] == 2, res.json assert res.json['things'] == 10, res.json
def touch(foreign_id, sync=True): """Mark a collection as changed.""" collection = get_collection(foreign_id) collection.touch() db.session.commit() compute_collection(collection, force=True, sync=True)