Пример #1
0
 def test_fetch_uppnexid(self, dbmock):
     """ A SampleDeliverer should be able to fetch the Uppnex ID for the 
         project
     """
     # if an uppnexid is given in the configuration, it should be used and the database should not be queried
     deliverer = deliver.SampleDeliverer(
         self.projectid,
         self.sampleid,
         rootdir=self.casedir,
         uppnexid="this-is-the-uppnexid",
         **SAMPLECFG['deliver'])
     self.assertEquals(deliverer.uppnexid, "this-is-the-uppnexid")
     #called once due to projectname
     dbmock.assert_called_once_with(self.projectid)
     # if an uppnexid is not supplied in the config, the database should be consulted
     dbmock.reset_mock()
     prior = dbmock.call_count
     deliverer = deliver.SampleDeliverer(
         self.projectid,
         self.sampleid,
         rootdir=self.casedir,
         **SAMPLECFG['deliver'])
     self.assertEquals(deliverer.uppnexid, PROJECTENTRY['uppnex_id'])
     #two calls, one for projectname one for uppnexid
     self.assertEquals(dbmock.call_count, 2)
 def setUp(self):
     with mock.patch.object(deliver.db, 'dbcon', autospec=db.CharonSession):
         self.casedir = tempfile.mkdtemp(prefix="case_", dir=self.rootdir)
         self.projectid = 'NGIU-P001'
         self.sampleid = 'NGIU-S001'
         self.deliverer = deliver.SampleDeliverer(self.projectid,
                                                  self.sampleid,
                                                  rootdir=self.casedir,
                                                  **SAMPLECFG['deliver'])
 def test_fetch_uppnexid(self, dbmock):
     """ A SampleDeliverer should be able to fetch the Uppnex ID for the 
         project
     """
     # if an uppnexid is given in the configuration, it should be used and the database should not be queried
     deliverer = deliver.SampleDeliverer(self.projectid,
                                         self.sampleid,
                                         rootdir=self.casedir,
                                         uppnexid="this-is-the-uppnexid",
                                         **SAMPLECFG['deliver'])
     self.assertEquals(deliverer.uppnexid, "this-is-the-uppnexid")
     self.assertFalse(dbmock.called,
                      "the database should not have been queried")
     # if an uppnexid is not supplied in the config, the database should be consulted
     deliverer = deliver.SampleDeliverer(self.projectid,
                                         self.sampleid,
                                         rootdir=self.casedir,
                                         **SAMPLECFG['deliver'])
     self.assertEquals(deliverer.uppnexid, PROJECTENTRY['uppnex_id'])
     dbmock.assert_called_once_with(self.projectid)
Пример #4
0
def sample(ctx, projectid, sampleid):
    """ Deliver the specified sample to the specified destination
    """
    for sid in sampleid:
        if not ctx.parent.params['cluster']:  # Soft stage case
            d = _deliver.SampleDeliverer(projectid, sid, **ctx.parent.params)
        elif ctx.parent.params['cluster'] == 'grus':
            logger.error(
                "When delivering to grus only project can be specified, not sample"
            )
            return 1
        elif ctx.parent.params['cluster'] == 'dds':
            logger.error(
                "When delivering with DDS only project can be specified, not sample"
            )
            return 1
        _exec_fn(d, d.deliver_sample)