Exemplo n.º 1
0
    def get(self):
        reagent_type = self.get_argument('reagent_type', None)
        term = self.get_argument('term', None)

        self.write(
            json_encode(
                ReagentComposition.list_reagents(reagent_type=reagent_type,
                                                 term=term)))
Exemplo n.º 2
0
    def test_reagent_composition_list_reagents(self):
        obs = ReagentComposition.list_reagents()
        exp = ['157022406', '443912', 'KHP1', 'RNBF7110', 'STUBS1']
        self.assertEqual(obs, exp)

        obs = ReagentComposition.list_reagents(term='39')
        exp = ['443912']
        self.assertEqual(obs, exp)

        obs = ReagentComposition.list_reagents(reagent_type='extraction kit')
        exp = ['157022406']
        self.assertEqual(obs, exp)

        obs = ReagentComposition.list_reagents(reagent_type='water', term='BF')
        exp = ['RNBF7110']
        self.assertEqual(obs, exp)

        obs = ReagentComposition.list_reagents(reagent_type='water', term='22')
        exp = []
        self.assertEqual(obs, exp)