Beispiel #1
0
def test_boolean_true():
    url = "/v1/company_query_builder?ecommerce=true"
    response = get_es_query(url)
    assert response == full_es_query(
        {'term': {
            'ecommerce.is_ecommerce': True
        }})
Beispiel #2
0
def test_range_top_end():
    url = "/v1/company_query_builder?revenue=-100"
    response = get_es_query(url)
    assert response == revenue_range_template(None, 100)
Beispiel #3
0
def test_range_bottom_end():
    url = "/v1/company_query_builder?revenue=1-"
    response = get_es_query(url)
    assert response == revenue_range_template(1, None)
Beispiel #4
0
def test_range_both_ends():
    url = "/v1/company_query_builder?revenue=1-100"
    response = get_es_query(url)
    assert response == revenue_range_template(1, 100)
Beispiel #5
0
def test_all(url):
    get_es_query(url)
Beispiel #6
0
def test_lte_lessThan_gte():
    url = "/v1/company_query_builder?revenue=-1--100"
    with pytest.raises(Exception):
        response = get_es_query(url)
Beispiel #7
0
def test_negative_lte_gte():
    url = "/v1/company_query_builder?revenue=-100--1"
    response = get_es_query(url)
    assert response == revenue_range_template(-100, -1)
Beispiel #8
0
def test_date_range_upper_end():
    url = "/v1/company_query_builder?trading_activity=-20160101"
    response = get_es_query(url)
    assert response == trade_activity_template(None, "2016-01-01")
Beispiel #9
0
def test_date_range_bottom_end():
    url = "/v1/company_query_builder?trading_activity=20150101-"
    response = get_es_query(url)
    assert response == trade_activity_template("2015-01-01", None)
Beispiel #10
0
def test_boolean_false():
    url = "/v1/company_query_builder?ecommerce=false"
    response = get_es_query(url)
    assert response == full_es_query(None)