Exemple #1
0
    def test_common_manifest_with_id(self):
        message = self.FakeMessage(
            event_type=EVENT_MAN_RECEIVED,
            timestamp=datetime.now().isoformat(),
            user_identifier='*****@*****.**',
            metadata={
                'sample_custodian': '*****@*****.**',
                'manifest_id': 1234,
                'deputies': ['*****@*****.**', '*****@*****.**']
            },
            notifier_info={
                'work_plan_id': 1,
                'drs_study_code': 1234
            })
        rule = Rule(env='test', config=config, message=message)
        rule._generate_manifest_link = Mock()
        rule._generate_manifest_link.return_value = ''

        to, data = rule._common_manifest()

        self.assertEqual(to, [
            message.user_identifier, message.metadata['sample_custodian'],
            '*****@*****.**', '*****@*****.**'
        ]),
        self.assertEqual(data, {
            'manifest_id': message.metadata['manifest_id'],
            'link': ''
        })
Exemple #2
0
 def test_generate_manifest_link(self):
     rule = Rule(env='test', config=config, message='')
     path = 'path'
     id = 'id'
     link = rule._generate_manifest_link(path, id)
     self.assertEqual(
         link,
         '{}://{}:{}/{}/{}'.format(config.link.protocol, config.link.root,
                                   config.link.port, path, id))