-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
49 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
# from django.test import TestCase | ||
import pytest | ||
|
||
# from nc.prime_cache import run | ||
# from nc.tests import factories | ||
from nc import prime_cache | ||
|
||
|
||
# class PrimeCacheTests(TestCase): | ||
# """ | ||
# This merely gives the cache priming code a chance to blow up if silly | ||
# changes are made. No results are verified. | ||
# """ | ||
@pytest.fixture(autouse=True) | ||
def group_urls(): | ||
"""Monkeypatch API_ENDPOINT_NAMES to return a single group URL for tests""" | ||
prime_cache.API_ENDPOINT_NAMES = ("nc:arrests-percentage-of-stops",) | ||
|
||
# databases = "__all__" | ||
|
||
# def test_prime_cache(self): | ||
# factories.AgencyFactory(id=-1) # Statewide data | ||
def test_get_group_urls_empty_allowed_hosts(settings): | ||
settings.ALLOWED_HOSTS = [] | ||
assert ( | ||
prime_cache.get_group_urls(agency_id=99)[0] | ||
== "http://127.0.0.1:8000/api/agency/99/arrests-percentage-of-stops/" | ||
) | ||
|
||
# factories.ContrabandFactory() | ||
# factories.ContrabandFactory() | ||
# factories.ContrabandFactory() | ||
# factories.ContrabandFactory() | ||
# factories.ContrabandFactory() | ||
# run() | ||
|
||
def test_get_group_urls_allowed_hosts(settings): | ||
settings.ALLOWED_HOSTS = ["nccopwatch.org"] | ||
assert ( | ||
prime_cache.get_group_urls(agency_id=99)[0] | ||
== "https://nccopwatch.org/api/agency/99/arrests-percentage-of-stops/" | ||
) |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ isort | |
pytest | ||
pytest-cov | ||
pytest-django | ||
requests-mock | ||
factory_boy | ||
coverage | ||
# Linting | ||
|
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