def test_bar_chart_process_calls_push():
    with patch.object(GeckoboardService, '_push') as mocked_bar_chart_push:
        gecko_job_bar_chart = GeckoboardService(resp_ex.FULL_GROUP_RESP,
                                                req_ex.SERVICE_API_KEY,
                                                conf_ex.GECKO_BAR_CHART_CONFIG)
        gecko_job_bar_chart.process()
        assert mocked_bar_chart_push.called
Пример #2
0
def test__number_stat_push():
    httpretty.register_uri(httpretty.POST, req_ex.DEST_URL,
                           body="OK")
    gecko_job_number_stat = GeckoboardService(LeRestResponse(resp_ex.FULL_GROUP_RESP), req_ex.SERVICE_API_KEY, conf_ex.GECKO_NUMBER_STAT_CONFIG)
    gecko_job_number_stat.push({})

    assert httpretty.has_request()
Пример #3
0
def test_number_stat_transform():
    with patch.object(GeckoboardService, '_transform', return_value=None) as mock_transform:
        gecko_job_number_stat = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                                  req_ex.SERVICE_API_KEY,
                                                  conf_ex.GECKO_NUMBER_STAT_CONFIG)
        gecko_job_number_stat._transform()
        assert mock_transform.called
Пример #4
0
def test_bar_chart_push():
    httpretty.register_uri(httpretty.POST, req_ex.DEST_URL,
                           body="OK")
    gecko_job_bar_chart = GeckoboardService(LeRestResponse(resp_ex.FULL_GROUP_RESP), req_ex.SERVICE_API_KEY, conf_ex.GECKO_BAR_CHART_CONFIG)
    gecko_job_bar_chart.push({})

    assert httpretty.has_request()
Пример #5
0
def test_number_stat_process_calls_push():
    with patch.object(GeckoboardService, '_push') as mocked_number_stat_push:
        gecko_job_number_stat = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                                  req_ex.SERVICE_API_KEY,
                                                  conf_ex.GECKO_NUMBER_STAT_CONFIG)
        gecko_job_number_stat.process()
        assert mocked_number_stat_push.called
Пример #6
0
def test_bar_chart_process_calls_push():
    with patch.object(GeckoboardService, '_push') as mocked_bar_chart_push:
        gecko_job_bar_chart = GeckoboardService(resp_ex.FULL_GROUP_RESP,
                                                req_ex.SERVICE_API_KEY,
                                                conf_ex.GECKO_BAR_CHART_CONFIG)
        gecko_job_bar_chart.process()
        assert mocked_bar_chart_push.called
Пример #7
0
def test_line_chart_process_calls_push():
    with patch.object(GeckoboardService, '_push') as mocked_line_chart_push:
        gecko_job_line_chart = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                                 req_ex.SERVICE_API_KEY,
                                                 conf_ex.GECKO_LINE_CHART_CONFIG)
        gecko_job_line_chart.process()
        assert mocked_line_chart_push.called
Пример #8
0
def test_bar_chart_transform():
    with patch.object(GeckoboardService, '_transform', return_value=None) as mock_transform:
        gecko_job_bar_chart = GeckoboardService(resp_ex.FULL_GROUP_RESP,
                                                req_ex.SERVICE_API_KEY,
                                                conf_ex.GECKO_BAR_CHART_CONFIG)
        gecko_job_bar_chart._transform()
        assert mock_transform.called
def test_number_stat_process_calls_push():
    with patch.object(GeckoboardService, '_push') as mocked_number_stat_push:
        gecko_job_number_stat = GeckoboardService(
            resp_ex.FULL_TIMESERIES_RESP, req_ex.SERVICE_API_KEY,
            conf_ex.GECKO_NUMBER_STAT_CONFIG)
        gecko_job_number_stat.process()
        assert mocked_number_stat_push.called
def test_line_chart_process_calls_push():
    with patch.object(GeckoboardService, '_push') as mocked_line_chart_push:
        gecko_job_line_chart = GeckoboardService(
            resp_ex.FULL_TIMESERIES_RESP, req_ex.SERVICE_API_KEY,
            conf_ex.GECKO_LINE_CHART_CONFIG)
        gecko_job_line_chart.process()
        assert mocked_line_chart_push.called
def test_line_chart_push():
    httpretty.register_uri(httpretty.POST, req_ex.DEST_URL, body="OK")
    gecko_job_line_chart = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                             req_ex.SERVICE_API_KEY,
                                             conf_ex.GECKO_LINE_CHART_CONFIG)
    gecko_job_line_chart._push({})

    assert httpretty.has_request()
def test_bar_chart_transform():
    with patch.object(GeckoboardService, '_transform',
                      return_value=None) as mock_transform:
        gecko_job_bar_chart = GeckoboardService(resp_ex.FULL_GROUP_RESP,
                                                req_ex.SERVICE_API_KEY,
                                                conf_ex.GECKO_BAR_CHART_CONFIG)
        gecko_job_bar_chart._transform()
        assert mock_transform.called
def test_number_stat_transform():
    with patch.object(GeckoboardService, '_transform',
                      return_value=None) as mock_transform:
        gecko_job_number_stat = GeckoboardService(
            resp_ex.FULL_TIMESERIES_RESP, req_ex.SERVICE_API_KEY,
            conf_ex.GECKO_NUMBER_STAT_CONFIG)
        gecko_job_number_stat._transform()
        assert mock_transform.called
Пример #14
0
def test_format_line_chart_data():
    gecko_job_line_chart = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                             req_ex.SERVICE_API_KEY,
                                             conf_ex.GECKO_LINE_CHART_CONFIG)
    line_chart_data = gecko_job_line_chart.format_line_chart_data()

    assert "data" in line_chart_data
    assert line_chart_data["data"]["series"][0]["name"] == conf_ex.GECKO_LINE_CHART_CONFIG["name"]
Пример #15
0
def test_format_bar_chart_data():
    gecko_job_bar_chart = GeckoboardService(LeRestResponse(resp_ex.FULL_GROUP_RESP), req_ex.SERVICE_API_KEY, conf_ex.GECKO_BAR_CHART_CONFIG)
    bar_chart_json = gecko_job_bar_chart.format_bar_chart_data()

    assert "data" in bar_chart_json
    bar_chart_data = bar_chart_json.get("data")
    assert "x_axis" in bar_chart_data
    assert "y_axis" in bar_chart_data
    assert "series" in bar_chart_data
Пример #16
0
def test_line_chart_push():
    httpretty.register_uri(httpretty.POST, req_ex.DEST_URL,
                           body="OK")
    gecko_job_line_chart = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                             req_ex.SERVICE_API_KEY,
                                             conf_ex.GECKO_LINE_CHART_CONFIG)
    gecko_job_line_chart._push({})

    assert httpretty.has_request()
def test_format_line_chart_data():
    gecko_job_line_chart = GeckoboardService(resp_ex.FULL_TIMESERIES_RESP,
                                             req_ex.SERVICE_API_KEY,
                                             conf_ex.GECKO_LINE_CHART_CONFIG)
    line_chart_data = gecko_job_line_chart.format_line_chart_data()

    assert "data" in line_chart_data
    assert line_chart_data["data"]["series"][0][
        "name"] == conf_ex.GECKO_LINE_CHART_CONFIG["name"]
Пример #18
0
def test_format_pie_chart_data():
    gecko_job_pie_chart = GeckoboardService(LeRestResponse(resp_ex.FULL_GROUP_RESP), req_ex.SERVICE_API_KEY, conf_ex.GECKO_PIE_CHART_CONFIG)
    pie_data = gecko_job_pie_chart.format_pie_chart_data()

    assert "data" in pie_data

    item_data = pie_data["data"]
    assert "item" in item_data
    assert len(resp_ex.GROUP_STATISTICS.get('groups')) == len(pie_data['data']['item'])
Пример #19
0
def test_format_number_stat_data():
    gecko_job_number_stat = GeckoboardService(LeRestResponse(resp_ex.FULL_GROUP_RESP), req_ex.SERVICE_API_KEY, conf_ex.GECKO_NUMBER_STAT_CONFIG)
    number_stat = gecko_job_number_stat.format_number_stat_data()

    assert "data" in number_stat
    number_stat_data = number_stat.get("data")
    assert "item" in number_stat_data
    item = number_stat_data["item"]
    assert item[0]

    the_item = item[0]
    assert "value" in the_item
    assert the_item["value"] == 1234
    assert "text" in the_item
    assert the_item["text"] == "number_stat_text"
Пример #20
0
def test_pie_chart_transform():
    with patch.object(GeckoboardService, 'transform', return_value=None) as mock_transform:
        gecko_job_pie_chart = GeckoboardService(LeRestResponse(resp_ex.FULL_GROUP_RESP), req_ex.SERVICE_API_KEY, conf_ex.GECKO_PIE_CHART_CONFIG)
        gecko_job_pie_chart.transform()
        assert mock_transform.called