Ejemplo n.º 1
0
    def test_eve_central_manager_returns_price_data_dict_using_regions(self, mock_market_stats):
        mock_market_stats.return_value = self.market_stats_raw_return_data

        type_ids = [self.item_1.type_id]
        regions = self.region.region_id

        manager = PriceFetcher(type_ids, regions=regions)
        price_data = manager.fetch().next()

        self.assertEqual(price_data, self.test_price_data)
Ejemplo n.º 2
0
    def test_eve_central_manager_returns_price_data_dict_using_system(self, mock_market_stats):
        mock_market_stats.return_value = self.market_stats_raw_return_data

        type_ids = [self.item_1.type_id]
        system = self.solar_system.solar_system_id

        manager = PriceFetcher(type_ids, system=system)
        price_data = manager.fetch().next()

        self.assertEqual(price_data, self.test_price_data)
Ejemplo n.º 3
0
def shoppinglist_price_update(request, pk):
    shoppinglist = ShoppingList.objects.get(pk=pk)

    region_id = int(request.POST['region'])

    items = shoppinglist.items.all()
    type_ids = [x.type_id for x in items]

    fetcher = PriceFetcher(type_ids, regions=region_id)
    price_data = fetcher.fetch()

    for price in fetcher.prepare_save(price_data):
        Price.objects.create(**price)

    return redirect('lists:detail', pk=pk)