-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix several issues with branch before being ready to merge
- Loading branch information
Sebastian Vetter
committed
Dec 20, 2012
1 parent
57cad65
commit 05798bf
Showing
12 changed files
with
182 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SRID that ist used for distance calculations. If a geodetic coordinate | ||
# system is used to calculate distances in kilometers, miles, etc. this | ||
# SRID will be used to transform the geometries into a geographic | ||
# coordinate system. There are many different SRIDs that can be used. I | ||
# recommend taking a look at http://spatialreference.org/ to find the one | ||
# that is most suitable for you. | ||
# We use Autstralian Albers here (http://spatialreference.org/ref/epsg/3577/) | ||
STORES_GEOGRAPHIC_SRID = 3577 | ||
STORES_GEODETIC_SRID = 4326 | ||
|
||
STORES_SETTINGS = dict( | ||
[(k, v) for k, v in locals().items() if k.startswith('STORES_')] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from django.db.models import get_model | ||
from django.core.urlresolvers import reverse | ||
|
||
from django_dynamic_fixture import get as G | ||
from oscar_testsupport.testcases import WebTestCase | ||
|
||
Store = get_model("stores", "Store") | ||
StoreGroup = get_model("stores", "StoreGroup") | ||
|
||
|
||
class TestTheListOfStores(WebTestCase): | ||
anonymous = True | ||
|
||
def setUp(self): | ||
super(TestTheListOfStores, self).setUp() | ||
self.main_location = '{"type": "Point", "coordinates": [144.917908,-37.815751]}' | ||
self.other_location = '{"type": "Point", "coordinates": [144.998401,-37.772895]}' | ||
|
||
self.main_store = G( | ||
Store, | ||
name="Main store in Southbank", | ||
is_pickup_store=True, | ||
location=self.main_location, | ||
ignore_fields=['group'], | ||
) | ||
self.other_store = G( | ||
Store, | ||
name="Other store in Northcote", | ||
is_pickup_store=True, | ||
location=self.other_location, | ||
ignore_fields=['group'], | ||
) | ||
|
||
def test_displays_all_stores_unfiltered(self): | ||
page = self.get(reverse('stores:index')) | ||
self.assertContains(page, self.main_store.name) | ||
self.assertContains(page, self.other_store.name) | ||
|
||
def test_can_be_filtered_by_location(self): | ||
page = self.get(reverse('stores:index')) | ||
search_form = page.forms['store-search'] | ||
search_form['location'] = '{"type":"Point","coordinates":[144.9997396,-37.7736132]}' | ||
page = search_form.submit() | ||
|
||
self.assertContains(page, self.main_store.name) | ||
self.assertContains(page, self.other_store.name) | ||
|
||
stores = page.context[0].get('object_list') | ||
self.assertSequenceEqual(stores, [self.other_store, self.main_store]) | ||
|
||
def test_can_be_filtered_by_store_group(self): | ||
north_group = StoreGroup.objects.create(name="North") | ||
south_group = StoreGroup.objects.create(name="South") | ||
|
||
self.main_store.group = south_group | ||
self.main_store.save() | ||
self.other_store.group = north_group | ||
self.other_store.save() | ||
|
||
page = self.get(reverse('stores:index')) | ||
search_form = page.forms['store-search'] | ||
search_form['group'] = south_group.id | ||
page = search_form.submit() | ||
|
||
self.assertContains(page, self.main_store.name) | ||
self.assertNotContains(page, self.other_store.name) | ||
|
||
stores = page.context[0].get('object_list') | ||
self.assertSequenceEqual(stores, [self.main_store]) |
Oops, something went wrong.