Example #1
0
    def post(self):
        barcodes = db.get_barcodes_with_results()
        if len(barcodes) == 0:
            self.write('ERROR: No barcode results available')
            return

        msg = 'Sucessfully updated barcodes to results ready status.'
        try:
            db.mark_results_ready(barcodes)
        except Exception as e:
            msg = 'ERROR: ' + str(e)
        self.write(msg)
Example #2
0
    def post(self):
        barcodes = db.get_barcodes_with_results()
        if len(barcodes) == 0:
            self.write('ERROR: No barcode results available')
            return

        msg = 'Successfully updated barcodes to results ready status.'
        try:
            db.mark_results_ready(barcodes)
        except Exception as e:
            # TODO: refactor for clear message to the user, see issue: #126
            msg = 'ERROR: ' + str(e)
        self.write(msg)
Example #3
0
    def test_mark_results_ready(self):
        db._revert_ready(["000023299"])
        obs = db.get_ag_barcode_details(["000001072", "000023299"])
        self.assertEqual(obs["000023299"]["results_ready"], None)
        self.assertEqual(obs["000001072"]["results_ready"], "Y")

        obs = db.mark_results_ready(["000001072", "000023299"], debug=True)
        self.assertEqual(obs["new_bcs"], ("000023299",))
        self.assertEqual(obs["mail"]["mimetext"]["To"], "*****@*****.**")
        self.assertEqual(obs["mail"]["mimetext"]["From"], "")
        self.assertEqual(obs["mail"]["mimetext"]["Subject"], "Your American/British Gut results are ready")
        self.assertEqual(obs["mail"]["recipients"], ["*****@*****.**", "REMOVED"])

        obs = db.get_ag_barcode_details(["000001072", "000023299"])
        self.assertEqual(obs["000023299"]["results_ready"], "Y")
        self.assertEqual(obs["000001072"]["results_ready"], "Y")
Example #4
0
    def test_mark_results_ready(self):
        db._revert_ready(['000023299'])
        obs = db.get_ag_barcode_details(['000001072', '000023299'])
        self.assertEqual(obs['000023299']['results_ready'], None)
        self.assertEqual(obs['000001072']['results_ready'], 'Y')

        obs = db.mark_results_ready(['000001072', '000023299'], debug=True)
        self.assertEqual(obs['new_bcs'], ('000023299', ))
        self.assertEqual(obs['mail']['mimetext']['To'],
                         '*****@*****.**')
        self.assertEqual(obs['mail']['mimetext']['From'], '')
        self.assertEqual(obs['mail']['mimetext']['Subject'],
                         'Your American/British Gut results are ready')
        # don't compare name, since it is scrubbed to random chars
        self.assertEqual(obs['mail']['recipients'][0], '*****@*****.**')

        obs = db.get_ag_barcode_details(['000001072', '000023299'])
        self.assertEqual(obs['000023299']['results_ready'], 'Y')
        self.assertEqual(obs['000001072']['results_ready'], 'Y')
Example #5
0
    def test_mark_results_ready(self):
        db._revert_ready(['000023299'])
        obs = db.get_ag_barcode_details(['000001072', '000023299'])
        self.assertEqual(obs['000023299']['results_ready'], None)
        self.assertEqual(obs['000001072']['results_ready'], 'Y')

        obs = db.mark_results_ready(['000001072', '000023299'], debug=True)
        self.assertEqual(obs['new_bcs'], ('000023299', ))
        self.assertEqual(obs['mail']['mimetext']['To'],
                         '*****@*****.**')
        self.assertEqual(obs['mail']['mimetext']['From'], '')
        self.assertEqual(obs['mail']['mimetext']['Subject'],
                         'Your American/British Gut results are ready')
        self.assertEqual(obs['mail']['recipients'],
                         ['*****@*****.**', 'REMOVED'])

        obs = db.get_ag_barcode_details(['000001072', '000023299'])
        self.assertEqual(obs['000023299']['results_ready'], 'Y')
        self.assertEqual(obs['000001072']['results_ready'], 'Y')