Esempio n. 1
0
    def setUp(self):
        super(TestRenderToCSVResponse, self).setUp()
        self.app = TestApp(test_app)
        Node.remove()
        time_now = get_previous_midnight()
        NodeFactory(category='project', date_created=time_now)
        NodeFactory(category='project',
                    date_created=time_now - timedelta(days=1))
        last_time = time_now - timedelta(days=2)
        NodeFactory(category='project', date_created=last_time)
        NodeFactory(category='project', date_created=last_time)
        initial_time = last_time + timedelta(seconds=1)
        get_days_statistics(initial_time)
        midtime = last_time + timedelta(days=1, seconds=1)
        self.time = time_now + timedelta(seconds=1)

        self.initial_static = [
            'id,users,delta_users,unregistered_users,projects,delta_projects,public_projects,'
            'delta_public_projects,registered_projects,delta_registered_projects,date\r',
            construct_query(1, initial_time), '']
        self.latest_static = [
            'id,users,delta_users,unregistered_users,projects,delta_projects,public_projects,'
            'delta_public_projects,registered_projects,delta_registered_projects,date\r',
            construct_query(3, self.time),
            construct_query(2, midtime),
            construct_query(1, initial_time), '']
Esempio n. 2
0
 def setUp(self):
     super(AppTestCase, self).setUp()
     self.app = TestApp(test_app)
     self.context = test_app.test_request_context()
     self.context.push()
     with self.context:
         g._celery_tasks = []
Esempio n. 3
0
    def setUp(self):
        super(TestMustBeContributorOrPublicButNotAnonymizedDecorator,
              self).setUp()
        self.contrib = AuthUserFactory()
        self.non_contrib = AuthUserFactory()
        self.public_project = ProjectFactory(is_public=True)
        self.private_project = ProjectFactory(is_public=False)
        self.public_project.add_contributor(self.contrib,
                                            auth=Auth(
                                                self.public_project.creator))
        self.private_project.add_contributor(self.contrib,
                                             auth=Auth(
                                                 self.private_project.creator))
        self.public_project.save()
        self.private_project.save()
        self.anonymized_link_to_public_project = PrivateLinkFactory(
            anonymous=True)
        self.anonymized_link_to_private_project = PrivateLinkFactory(
            anonymous=True)
        self.anonymized_link_to_public_project.nodes.append(
            self.public_project)
        self.anonymized_link_to_public_project.save()
        self.anonymized_link_to_private_project.nodes.append(
            self.private_project)
        self.anonymized_link_to_private_project.save()
        self.flaskapp = Flask('Testing decorator')

        @self.flaskapp.route('/project/<pid>/')
        @must_be_contributor_or_public_but_not_anonymized
        def project_get(**kwargs):
            return 'success', 200

        self.app = TestApp(self.flaskapp)
Esempio n. 4
0
 def setUp(self):
     super(AppTestCase, self).setUp()
     self.app = TestApp(test_app)
     self.context = test_app.test_request_context()
     self.context.push()
     with self.context:
         g._celery_tasks = []
     for signal in self.DISCONNECTED_SIGNALS:
         for receiver in self.DISCONNECTED_SIGNALS[signal]:
             signal.disconnect(receiver)
Esempio n. 5
0
 def setUp(self):
     super(AppTestCase, self).setUp()
     self.app = TestApp(test_app)
     if not self.PUSH_CONTEXT:
         return
     self.context = test_app.test_request_context()
     self.context.push()
     with self.context:
         celery_before_request()
     for signal in self.DISCONNECTED_SIGNALS:
         for receiver in self.DISCONNECTED_SIGNALS[signal]:
             signal.disconnect(receiver)
Esempio n. 6
0
 def setUp(self):
     super(AppTestCase, self).setUp()
     self.app = TestApp(test_app)
     if not self.PUSH_CONTEXT:
         return
     self.context = test_app.test_request_context(headers={
         'Remote-Addr': '146.9.219.56',
         'User-Agent': 'Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.4.1) Gecko/20020518 Netscape6/6.2.3'
     })
     self.context.push()
     with self.context:
         celery_before_request()
     for signal in self.DISCONNECTED_SIGNALS:
         for receiver in self.DISCONNECTED_SIGNALS[signal]:
             signal.disconnect(receiver)
Esempio n. 7
0
    def setUp(self):
        super(TestPrivateLink, self).setUp()
        self.flaskapp = Flask('testing_private_links')

        @self.flaskapp.route('/project/<pid>/')
        @must_be_contributor
        def project_get(**kwargs):
            return 'success', 200

        self.app = TestApp(self.flaskapp)

        self.user = AuthUserFactory()
        self.project = ProjectFactory(is_public=False)
        self.link = PrivateLinkFactory()
        self.link.nodes.append(self.project)
        self.link.save()
Esempio n. 8
0
 def setUp(self):
     super(AppTestCase, self).setUp()
     self.app = TestApp(test_app)
     self.context = test_app.test_request_context()
     self.context.push()
Esempio n. 9
0
 def create_app(self):
     return TestApp(app)
Esempio n. 10
0
 def setUp(self):
     super(TestSmartFolderViews, self).setUp()
     self.app = TestApp(app)
     self.dash = DashboardFactory()
     self.user = self.dash.creator
     self.auth = AuthFactory(user=self.user)
Esempio n. 11
0
def flask_app():
    return TestApp(test_app)
Esempio n. 12
0
 def setUp(self):
     self.app = TestApp(app)
     self.auth = ("admin", "secret")
Esempio n. 13
0
    def setUp(self):
        self.app = Flask(__name__)
        self.app.debug = True

        self.wt = TestApp(self.app)
Esempio n. 14
0
def wt(app):
    return TestApp(app)
Esempio n. 15
0
def test_app():
    return TestApp(app)
Esempio n. 16
0
 def setUp(self):
     super(ApiAppTestCase, self).setUp()
     self.app = TestApp(django_app)
Esempio n. 17
0
 def setUp(self):
     super(AdminAppTestCase, self).setUp()
     self.app = TestApp(admin_django_app)