Skip to content

Commit

Permalink
fixes bug 1263242 - Allow api/ProductVersions/ to filter by build_type (
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Bengtsson committed Apr 11, 2016
1 parent a1a45a3 commit 9f6053c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions socorro/external/postgresql/products.py
Expand Up @@ -43,6 +43,7 @@ def get(self, **kwargs):
("end_date", None, SmartDate()),
("active", None, bool),
("is_rapid_beta", None, bool),
("build_type", None, [str]),
]
params = external_common.parse_arguments(filters, kwargs, modern=True)
where = []
Expand Down
16 changes: 16 additions & 0 deletions socorro/unittest/external/postgresql/test_products.py
Expand Up @@ -481,6 +481,22 @@ def test_filter_by_is_rapid_beta(self):
true_results['total'] + false_results['total']
)

#--------------------------------------------------------------------------
def test_filter_by_build_type(self):
productversions = ProductVersions(config=self.config)

res = productversions.get(
build_type=['Beta'],
)
eq_(res['total'], 1)
for hit in res['hits']:
eq_(hit['build_type'], 'Beta')

res = productversions.get(
build_type=['JUNK'],
)
eq_(res['total'], 0)

#--------------------------------------------------------------------------
def test_post(self):
products = ProductVersions(config=self.config)
Expand Down
1 change: 1 addition & 0 deletions webapp-django/crashstats/crashstats/models.py
Expand Up @@ -594,6 +594,7 @@ class ProductVersions(SocorroMiddleware):
'end_date',
('active', bool),
('is_rapid_beta', bool),
('build_type', list),
)

API_WHITELIST = (
Expand Down

0 comments on commit 9f6053c

Please sign in to comment.