Exemplo n.º 1
0
def get_db_size(request):
    """Return the size of the DB on disk in MB."""
    size_tuple = pushlog_refdata.get_db_size()
    #JSON can't serialize a decimal, so converting size_MB to string
    result = []
    for item in size_tuple:
        item["size_mb"] = str(item["size_mb"])
        result.append(item)
    return HttpResponse(json.dumps(result), content_type=API_CONTENT_TYPE)
Exemplo n.º 2
0
def get_db_size(request):
    """Return the size of the DB on disk in MB."""
    size_tuple = pushlog_refdata.get_db_size()
    #JSON can't serialize a decimal, so converting size_MB to string
    result = []
    for item in size_tuple:
        item["size_mb"] = str(item["size_mb"])
        result.append(item)
    return HttpResponse(json.dumps(result), content_type=API_CONTENT_TYPE)
Exemplo n.º 3
0
def test_get_db_size(plrdm, monkeypatch):
    """Test the get_db_size method."""
    def mock_plrdm():
        return plrdm
    monkeypatch.setattr(factory, 'get_plrdm', mock_plrdm)

    size = pushlog_refdata.get_db_size()

    assert size[0]["db_name"] == u'{0}_hgmozilla_1'.format(plrdm.project)
    assert size[0]["size_mb"] > 0
Exemplo n.º 4
0
def test_get_db_size(plrdm, monkeypatch):
    """Test the get_db_size method."""
    def mock_plrdm():
        return plrdm

    monkeypatch.setattr(factory, 'get_plrdm', mock_plrdm)

    size = pushlog_refdata.get_db_size()

    assert size[0]["db_name"] == u'{0}_hgmozilla_1'.format(plrdm.project)
    assert size[0]["size_mb"] > 0