def test_asset_manager_update(self, mock_assets): mock_assets.return_value = self.test_evelink_assets_response prev_num_assets = Asset.objects.count() char = self.test_char char_id = char.char_id api_key = self.test_char.get_api_key() manager = AssetManager(char, char_id, api_key) manager.update() current_num_assets = Asset.objects.count() self.assertEqual(prev_num_assets + 2, current_num_assets)
def test_asset_manager(self, mock_assets): mock_assets.return_value = self.test_evelink_assets_response char = self.test_char char_id = char.char_id api_key = self.test_char.get_api_key() manager = AssetManager(char, char_id, api_key) fetch = manager.fetch() self.assertEqual(fetch, self.test_evelink_assets_response.result) parse = manager.parse(fetch) self.assertIsInstance(parse, list) manager.save(parse) last_saved_asset = Asset.objects.last() asset_unique_id = last_saved_asset.unique_item_id self.assertEqual(asset_unique_id, parse[0]['unique_item_id'])