예제 #1
0
 def setUp(self):
     self.app = make_test_app()
     Entity.all().delete()
     # Consistently include an extra private project with Entity
     # that should not show in any test results
     project, permission = _project_and_permission(private=True)
     entity = Entity(project=project, status=authz.PUBLISHED_THRESHOLD)
     db.session.add(entity)
예제 #2
0
파일: test_filters.py 프로젝트: 01-/grano
 def setUp(self):
     self.app = make_test_app()
     Entity.all().delete()
     # Consistently include an extra private project with Entity
     # that should not show in any test results
     project, permission = _project_and_permission(private=True)
     entity = Entity(project=project, status=authz.PUBLISHED_THRESHOLD)
     db.session.add(entity)
예제 #3
0
 def test_all_entities__not_private_published(self):
     project, permission = _project_and_permission(private=False)
     entity = Entity(project=project, status=authz.PUBLISHED_THRESHOLD)
     db.session.add(entity)
     db.session.commit()
     with self.app.test_request_context():
         flask.session['id'] = 1
         self.app.preprocess_request()
         q = db.session.query(Entity)
         self.assertEqual(filters.for_entities(q, Entity).count(), 1)
예제 #4
0
파일: test_filters.py 프로젝트: 01-/grano
 def test_all_entities__not_private_published(self):
     project, permission = _project_and_permission(private=False)
     entity = Entity(project=project, status=authz.PUBLISHED_THRESHOLD)
     db.session.add(entity)
     db.session.commit()
     with self.app.test_request_context():
         flask.session['id'] = 1
         self.app.preprocess_request()
         q = db.session.query(Entity)
         self.assertEqual(filters.for_entities(q, Entity).count(), 1)
예제 #5
0
 def test_all_entities__private_reader_draft(self):
     project, permission = _project_and_permission(reader=True,
                                                   private=True)
     entity = Entity(project=project, status=authz.PUBLISHED_THRESHOLD - 1)
     db.session.add(entity)
     db.session.commit()
     with self.app.test_request_context():
         flask.session['id'] = 1
         self.app.preprocess_request()
         q = db.session.query(Entity)
         self.assertEqual(filters.for_entities(q, Entity).count(), 0)
예제 #6
0
파일: test_filters.py 프로젝트: 01-/grano
 def test_all_entities__private_reader_draft(self):
     project, permission = _project_and_permission(
         reader=True, private=True)
     entity = Entity(project=project, status=authz.PUBLISHED_THRESHOLD-1)
     db.session.add(entity)
     db.session.commit()
     with self.app.test_request_context():
         flask.session['id'] = 1
         self.app.preprocess_request()
         q = db.session.query(Entity)
         self.assertEqual(filters.for_entities(q, Entity).count(), 0)