-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from uw-it-aca/qa
Qa
- Loading branch information
Showing
154 changed files
with
13,261 additions
and
1,756 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
source = scout |
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,28 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- "2.7.6" | ||
install: | ||
- python setup.py -q install | ||
before_script: | ||
- pip install coverage | ||
- pip install python-coveralls | ||
- pip install pep8 | ||
- pip install -r requirements.txt | ||
- cp travis-ci/manage.py manage.py | ||
- python manage.py migrate --noinput | ||
- npm install mocha | ||
- npm install jquery | ||
- npm install jsdom@3 | ||
script: | ||
- pep8 scout/ --exclude=migrations | ||
- coverage run --source=scout/ --omit=scout/migrations/* manage.py test scout | ||
- mocha scout/static/scout/js/test --recursive | ||
after_script: | ||
- coveralls | ||
notifications: | ||
webhooks: | ||
urls: | ||
- https://yarn.cac.washington.edu/rest/botalyst/v1/travis-ci | ||
slack: | ||
secure: QhQcPJdxvdl5GlPdiewvyMMzDAM5fFB0Db2kRwpDphn8KiyNv2cF1SVeiYaJcQ4fObA7eWgsBXGBd/be8OC/1ujGNncz92bJM5xHePzMxs37hjPFaHuDGH0pnqurQIhRTz6OoWDi2+2OzC3xP1VkpOv0/2ApFjhUkO8S6JodH9A= |
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 |
---|---|---|
@@ -1,8 +1,2 @@ | ||
django | ||
django-compressor | ||
django_mobileesp | ||
django-turbolinks | ||
django-htmlmin | ||
libsass | ||
|
||
-e git+https://github.com/uw-it-aca/spotseeker_client.git#egg=spotseeker-restclient | ||
-e . |
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,3 @@ | ||
sauceclient | ||
selenium | ||
pyvirtualdisplay |
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,35 @@ | ||
from django.conf import settings | ||
from spotseeker_restclient.spotseeker import Spotseeker | ||
from spotseeker_restclient.exceptions import DataFailureException | ||
import oauth2 | ||
|
||
|
||
def get_client(): | ||
# Required settings for the client | ||
if not hasattr(settings, 'SPOTSEEKER_HOST'): | ||
raise(Exception("Required setting missing: SPOTSEEKER_HOST")) | ||
if not hasattr(settings, 'SPOTSEEKER_OAUTH_KEY'): | ||
raise(Exception("Required setting missing: SPOTSEEKER_OAUTH_KEY")) | ||
if not hasattr(settings, 'SPOTSEEKER_OAUTH_SECRET'): | ||
raise(Exception("Required setting missing: SPOTSEEKER_OAUTH_SECRET")) | ||
|
||
consumer = oauth2.Consumer(key=settings.SPOTSEEKER_OAUTH_KEY, | ||
secret=settings.SPOTSEEKER_OAUTH_SECRET) | ||
client = oauth2.Client(consumer) | ||
|
||
return client | ||
|
||
|
||
def get_image(spot_id, image_id, width=None): | ||
client = get_client() | ||
if width is not None: | ||
url = "%s/api/v1/spot/%s/image/%s/thumb/constrain/width:%s" % ( | ||
settings.SPOTSEEKER_HOST, | ||
spot_id, | ||
image_id, | ||
width) | ||
else: | ||
url = "%s/api/v1/spot/%s/image/%s" % (settings.SPOTSEEKER_HOST, | ||
spot_id, | ||
image_id) | ||
return client.request(url, 'GET') |
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,104 @@ | ||
from scout.dao.space import get_spots_by_filter, _get_spot_filters, \ | ||
_get_extended_info_by_key | ||
import copy | ||
|
||
|
||
def get_item_by_id(item_id): | ||
spot = get_spots_by_filter([ | ||
('item:id', item_id), | ||
('extended_info:app_type', 'tech') | ||
]) | ||
if spot: | ||
spot = _filter_spot_items(item_id, spot[0]) | ||
return spot | ||
|
||
|
||
def _filter_spot_items(item_id, spot): | ||
for item in spot.items: | ||
if item.item_id == item_id: | ||
spot.item = item | ||
return spot | ||
|
||
|
||
def add_item_info(spot): | ||
for item in spot.items: | ||
item.model = _get_extended_info_by_key("i_model", | ||
item.extended_info) | ||
item.brand = _get_extended_info_by_key("i_brand", | ||
item.extended_info) | ||
item.checkout_period = _get_extended_info_by_key( | ||
"i_checkout_period", | ||
item.extended_info | ||
) | ||
item.has_access_restriction = _get_extended_info_by_key( | ||
"i_has_access_restriction", | ||
item.extended_info | ||
) | ||
item.access_limit_role = _get_extended_info_by_key( | ||
"i_access_limit_role", | ||
item.extended_info | ||
) | ||
item.access_role_students = _get_extended_info_by_key( | ||
"i_access_role_students", | ||
item.extended_info | ||
) | ||
item.reservation_required = _get_extended_info_by_key( | ||
"i_reservation_required", | ||
item.extended_info | ||
) | ||
item.is_active = _get_extended_info_by_key( | ||
"i_is_active", | ||
item.extended_info | ||
) | ||
item.quantity = _get_extended_info_by_key( | ||
"i_quantity", | ||
item.extended_info | ||
) | ||
item.description = _get_extended_info_by_key( | ||
"i_description", | ||
item.extended_info | ||
) | ||
item.reserve_url = _get_extended_info_by_key( | ||
"i_reserve_url", | ||
item.extended_info | ||
) | ||
item.manual_url = _get_extended_info_by_key( | ||
"i_manual_url", | ||
item.extended_info | ||
) | ||
return spot | ||
|
||
|
||
def get_filtered_items(spots, request): | ||
parameter_list = _get_spot_filters(request) | ||
brand = [] | ||
subcategory = [] | ||
for param in parameter_list: | ||
if param[0] == "item:extended_info:i_brand": | ||
brand.append(param[1]) | ||
elif param[0] == "item:subcategory": | ||
subcategory.append(param[1]) | ||
|
||
if len(brand) <= 0 and len(subcategory) <= 0: | ||
return spots | ||
|
||
newSpots = [] | ||
|
||
for spot in spots: | ||
newSpot = copy.deepcopy(spot) | ||
newSpot.items = [] | ||
for item in spot.items: | ||
if item.subcategory in subcategory: | ||
newSpot.items.append(item) | ||
else: | ||
if item.brand in brand: | ||
newSpot.items.append(item) | ||
newSpots.append(newSpot) | ||
return newSpots | ||
|
||
|
||
def get_item_count(spots): | ||
item_count = 0 | ||
for spot in spots: | ||
item_count += len(spot.items) | ||
return item_count |
Oops, something went wrong.