Пример #1
0
def test_no_interesction():
    view = SpendingByAwardVisualizationViewSet()
    view.filters = {}
    view.filters["award_type_codes"] = ["one", "two", "three"]
    assert not view.if_no_intersection(), "false positive"

    view.filters["award_type_codes"].append("no intersection")
    assert view.if_no_intersection(), "Faulty check method!!!"
Пример #2
0
def instantiate_view_for_tests():
    view = SpendingByAwardVisualizationViewSet()
    view.is_subaward = True
    view.constants = GLOBAL_MAP["subaward"]
    view.filters = {"award_type_codes": ["A"]}
    view.original_filters = {"award_type_codes": ["A"]}
    view.fields = ["Sub-Award Type", "Prime Award ID"]
    view.pagination = {
        "limit": 5,
        "lower_bound": 1,
        "page": 1,
        "sort_key": "Prime Award ID",
        "sort_order": "desc",
        "upper_bound": 6,
    }
    return view
Пример #3
0
def instantiate_view_for_tests():
    view = SpendingByAwardVisualizationViewSet()
    view.is_subaward = False
    view.constants = GLOBAL_MAP["award"]
    view.filters = {"award_type_codes": ["A"]}
    view.original_filters = {"award_type_codes": ["A"]}
    view.fields = [
        "Award ID", "Start Date", "End Date", "Award Amount", "Description"
    ]
    view.pagination = {
        "limit": 5,
        "lower_bound": 1,
        "page": 1,
        "sort_key": "Description",
        "sort_order": "desc",
        "upper_bound": 6,
    }
    return view
Пример #4
0
from django.conf.urls import url
from django.urls import include

from usaspending_api.search.v2.views import search_elasticsearch as es
from usaspending_api.search.v2.views.new_awards_over_time import NewAwardsOverTimeVisualizationViewSet
from usaspending_api.search.v2.views.spending_by_award import SpendingByAwardVisualizationViewSet
from usaspending_api.search.v2.views.spending_by_award_count import SpendingByAwardCountVisualizationViewSet
from usaspending_api.search.v2.views.spending_by_category import SpendingByCategoryVisualizationViewSet
from usaspending_api.search.v2.views.spending_by_geography import SpendingByGeographyVisualizationViewSet
from usaspending_api.search.v2.views.spending_over_time import SpendingOverTimeVisualizationViewSet

urlpatterns = [
    url(r"^new_awards_over_time", NewAwardsOverTimeVisualizationViewSet.as_view()),
    url(r"^spending_by_award_count", SpendingByAwardCountVisualizationViewSet.as_view()),
    url(r"^spending_by_award", SpendingByAwardVisualizationViewSet.as_view()),
    url(r"^spending_by_category/", include("usaspending_api.search.v2.urls_spending_by_category")),
    url(r"^spending_by_category", SpendingByCategoryVisualizationViewSet.as_view()),
    url(r"^spending_by_geography", SpendingByGeographyVisualizationViewSet.as_view()),
    url(r"^spending_by_transaction_count", es.SpendingByTransactionCountVisualizaitonViewSet.as_view()),
    url(r"^spending_by_transaction", es.SpendingByTransactionVisualizationViewSet.as_view()),
    url(r"^spending_over_time", SpendingOverTimeVisualizationViewSet.as_view()),
    url(r"^transaction_spending_summary", es.TransactionSummaryVisualizationViewSet.as_view()),
]