def testStats(self, boto3_resource: MagicMock): simians = "40" humans = "100" ratio = "0.4" boto3_resource.return_value.Table.return_value.scan.return_value = { 'Items': [{ 'simians': Decimal(simians), 'humans': Decimal(humans), 'ratio': Decimal(ratio) }] } obj = Dna() expected = { 'count_mutant_dna': simians, 'count_human_dna': humans, 'ratio': ratio } self.assertEqual(expected, obj.stats())
def stats() -> str: service = Dna() return make_response(service.stats())