Ejemplo n.º 1
0
 def go(self):
     for item in BaseSpell.go(self):
         data = item['data'][0]
         net = float(data['net'])
         yield {
             'name': data['name'],
             'unit_value': net,
             'date': data['enddate'],
             'total_value': net * float(self.config['units'])
         }
Ejemplo n.º 2
0
    def test_go_failed(self, requests):
        requests.get.return_value = DummyResponse('', 404)

        rest = Spell({
            'endpoint': self.ENDPOINT
        })

        results = rest.go()

        for item in results:
            assert not item

        requests.get.assert_called_once_with(self.ENDPOINT, headers=rest.get_headers())