mirror of
https://github.com/nikdoof/django-evesde.git
synced 2025-12-18 12:19:23 +00:00
Fix stations import and EVE API Connection calls.
This commit is contained in:
@@ -8,7 +8,7 @@ from eveapi import EVEAPIConnection
|
|||||||
from evesde.models.cache import EVEAPICache
|
from evesde.models.cache import EVEAPICache
|
||||||
|
|
||||||
|
|
||||||
class EVEAPICache(object):
|
class EVEAPICacheHandler(object):
|
||||||
|
|
||||||
def hash(self, data):
|
def hash(self, data):
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
@@ -40,6 +40,6 @@ class EVEAPICache(object):
|
|||||||
|
|
||||||
|
|
||||||
def get_api_connection():
|
def get_api_connection():
|
||||||
cache_handler = getattr(settings, 'EVE_SDE_CACHE_HANDLER', 'evesde.eveapi.EVEAPICache')
|
cache_handler = getattr(settings, 'EVE_SDE_CACHE_HANDLER', 'evesde.eveapi.EVEAPICacheHandler')
|
||||||
cache_obj = import_by_path(cache_handler)
|
cache_obj = import_by_path(cache_handler)
|
||||||
return EVEAPIConnection(cacheHandler=cache_obj)
|
return EVEAPIConnection(cacheHandler=cache_obj())
|
||||||
@@ -18,6 +18,9 @@ def import_conquerable_stations():
|
|||||||
obj = Station(pk=station.stationID)
|
obj = Station(pk=station.stationID)
|
||||||
obj.name = station.stationName
|
obj.name = station.stationName
|
||||||
obj.system_id = station.solarSystemID
|
obj.system_id = station.solarSystemID
|
||||||
|
obj.x = 0
|
||||||
|
obj.y = 0
|
||||||
|
obj.z = 0
|
||||||
objs.append(obj)
|
objs.append(obj)
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
"""
|
|
||||||
This file demonstrates writing tests using the unittest module. These will pass
|
|
||||||
when you run "manage.py test".
|
|
||||||
|
|
||||||
Replace this with more appropriate tests for your application.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from evesde.models.locations import Station
|
||||||
|
from evesde.eveapi.eve import import_conquerable_stations
|
||||||
|
|
||||||
|
|
||||||
class SimpleTest(TestCase):
|
class TestConquerableStationsImport(TestCase):
|
||||||
def test_basic_addition(self):
|
"""Tests the import_conquerable_stations function"""
|
||||||
"""
|
|
||||||
Tests that 1 + 1 always equals 2.
|
def setUp(self):
|
||||||
"""
|
Station.objects.all().delete()
|
||||||
self.assertEqual(1 + 1, 2)
|
|
||||||
|
def test_import_stations(self):
|
||||||
|
import_conquerable_stations()
|
||||||
|
self.assertGreater(Station.objects.count(), 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user