コード例 #1
0
ファイル: test_data.py プロジェクト: zonca/qiita
    def test_status_setter_error(self):
        pd = ProcessedData(1)
        pd.status = 'public'
        self.assertEqual(pd.status, 'public')

        with self.assertRaises(QiitaDBStatusError):
            pd.status = 'sandbox'
コード例 #2
0
ファイル: test_data.py プロジェクト: zonca/qiita
    def test_status(self):
        rd = RawData(1)
        s = Study(1)
        self.assertEqual(rd.status(s), 'private')

        # Since the status is inferred from the processed data, change the
        # status of the processed data so we can check how it changes in the
        # preprocessed data
        pd = ProcessedData(1)
        pd.status = 'public'
        self.assertEqual(rd.status(s), 'public')

        # Check that new raw data has sandbox as status since no
        # processed data exists for them
        rd = RawData.create(self.filetype, self.studies, self.filepaths)
        self.assertEqual(rd.status(s), 'sandbox')
コード例 #3
0
ファイル: test_data.py プロジェクト: zonca/qiita
    def test_status(self):
        ppd = PreprocessedData(1)
        self.assertEqual(ppd.status, 'private')

        # Since the status is inferred from the processed data, change the
        # status of the processed data so we can check how it changes in the
        # preprocessed data
        pd = ProcessedData(1)
        pd.status = 'public'
        self.assertEqual(ppd.status, 'public')

        # Check that new preprocessed data has sandbox as status since no
        # processed data exists for them
        ppd = PreprocessedData.create(self.study, self.params_table,
                                      self.params_id, self.filepaths,
                                      data_type="16S")
        self.assertEqual(ppd.status, 'sandbox')
コード例 #4
0
ファイル: description_handlers.py プロジェクト: adamrp/qiita
    def make_sandbox(self, study, user, callback):
        """Reverts the current study to the 'sandbox' status

        Parameters
        ----------
        study : Study
            The current study object
        user : User
            The current user object
        callback : function
            The callback function to call with the results once the processing
            is done
        """
        pd_id = int(self.get_argument('pd_id'))
        pd = ProcessedData(pd_id)
        pd.status = 'sandbox'
        msg = "Processed data reverted to sandbox"
        msg_level = "success"
        callback((msg, msg_level, "processed_data_tab", pd_id, None))
コード例 #5
0
ファイル: description_handlers.py プロジェクト: adamrp/qiita
    def request_approval(self, study, user, callback):
        """Changes the status of the current study to "awaiting_approval"

        Parameters
        ----------
        study : Study
            The current study object
        user : User
            The current user object
        callback : function
            The callback function to call with the results once the processing
            is done
        """
        pd_id = int(self.get_argument('pd_id'))
        pd = ProcessedData(pd_id)
        pd.status = 'awaiting_approval'
        msg = "Processed data sent to admin for approval"
        msg_level = "success"
        callback((msg, msg_level, "processed_data_tab", pd_id, None))
コード例 #6
0
ファイル: description_handlers.py プロジェクト: adamrp/qiita
    def make_public(self, study, user, callback):
        """Makes the current study public

        Parameters
        ----------
        study : Study
            The current study object
        user : User
            The current user object
        callback : function
            The callback function to call with the results once the processing
            is done
        """
        pd_id = int(self.get_argument('pd_id'))
        pd = ProcessedData(pd_id)
        pd.status = 'public'
        msg = "Processed data set to public"
        msg_level = "success"
        callback((msg, msg_level, "processed_data_tab", pd_id, None))
コード例 #7
0
ファイル: test_data.py プロジェクト: zonca/qiita
    def test_delete(self):
        """Correctly deletes a processed data"""
        # testing regular delete
        pd = ProcessedData.create(self.params_table, self.params_id,
                                  self.filepaths,
                                  preprocessed_data=self.preprocessed_data,
                                  processed_date=self.date)
        ProcessedData.delete(pd.id)

        # testing that it raises an error if ID doesn't exist
        with self.assertRaises(QiitaDBUnknownIDError):
            ProcessedData.delete(pd.id)

        # testing that we can not remove cause the processed data != sandbox
        with self.assertRaises(QiitaDBStatusError):
            ProcessedData.delete(1)

        # testing that we can not remove cause processed data has analyses
        pd = ProcessedData(1)
        pd.status = 'sandbox'
        with self.assertRaises(QiitaDBError):
            ProcessedData.delete(1)
コード例 #8
0
    def approve_study(self, study, user, callback):
        """Approves the current study if and only if the current user is admin

        Parameters
        ----------
        study : Study
            The current study object
        user : User
            The current user object
        callback : function
            The callback function to call with the results once the processing
            is done
        """
        if _approve(user.level):
            pd_id = int(self.get_argument("pd_id"))
            pd = ProcessedData(pd_id)
            pd.status = "private"
            msg = "Processed data approved"
            msg_level = "success"
        else:
            msg = "The current user does not have permission to approve " "the processed data"
            msg_level = "danger"
        callback((msg, msg_level, "processed_data_tab", pd_id, None))
コード例 #9
0
ファイル: test_data.py プロジェクト: zonca/qiita
 def test_status_setter_error_not_existant(self):
     pd = ProcessedData(1)
     with self.assertRaises(IncompetentQiitaDeveloperError):
         pd.status = 'does-not-exist'
コード例 #10
0
ファイル: test_data.py プロジェクト: zonca/qiita
    def test_status_setter(self):
        pd = ProcessedData(1)
        self.assertEqual(pd.status, 'private')

        pd.status = 'sandbox'
        self.assertEqual(pd.status, 'sandbox')
コード例 #11
0
ファイル: test_data.py プロジェクト: MarkBruns/qiita
 def test_status_setter_error_not_existant(self):
     pd = ProcessedData(1)
     with self.assertRaises(QiitaDBLookupError):
         pd.status = 'does-not-exist'