Пример #1
0
def test_get_memory_base_list(mocker, monkeypatch, bc_obj,
                              mock_request_entity):
    parameters.set_parameter({"page_size": 2})
    mb_list = bc_obj.get_memory_base_list(page=10)
    mock_request_entity.assert_called_with(
        "braincube/bcname/braincube/mb/all/summary?offset=20&size=2",
        braincube_name=bc_obj.get_braincube_name(),
    )
Пример #2
0
def test_get_datagroup_list(mocker, monkeypatch, mb_obj, mock_request_entity):
    parameters.set_parameter({"page_size": 2})
    group_list = mb_obj.get_datagroup_list(page=0)
    assert group_list[0]._name == "name0"
    request_path = "braincube/bcname/braincube/mb/1/dataGroups/summary?offset=0&size=2"
    mock_request_entity.assert_called_with(request_path, braincube_name="")
    mock_request_entity.reset_mock()
    parameters.set_parameter({"page_size": 4})
    group_list = mb_obj.get_datagroup_list(page=0, page_size=2)
    mock_request_entity.assert_called_with(request_path, braincube_name="")
Пример #3
0
def test_get_rule_list(mocker, monkeypatch, mb_obj, mock_request_entity):
    parameters.set_parameter({"page_size": 2})
    rule_list = mb_obj.get_rule_list(page=0)
    assert rule_list[0]._name == "name0"
    request_path = "braincube/bcname/braincube/mb/1/rules/all/selector?offset=0&size=2"
    mock_request_entity.assert_called_with(request_path, braincube_name="")
    mock_request_entity.reset_mock()
    parameters.set_parameter({"page_size": 4})
    rule_list = mb_obj.get_rule_list(page=0, page_size=2)
    mock_request_entity.assert_called_with(request_path, braincube_name="")
Пример #4
0
def test_get_variable_list(mocker, monkeypatch, mb_obj, mock_request_entity):
    mock_request_entity.return_value = {
        "items": [{
            "standard": "name{}".format(i),
            "bcId": str(i)
        } for i in range(3)]
    }
    parameters.set_parameter({"page_size": 2})
    var_list = mb_obj.get_variable_list(page=0)
    assert var_list[0]._name == "name0"

    request_path = "braincube/bcname/braincube/mb/1/variables/summary?offset=0&size=2"
    mock_request_entity.assert_called_with(request_path, braincube_name="")
    mock_request_entity.reset_mock()
    parameters.set_parameter({"page_size": 4})
    var_list = mb_obj.get_variable_list(page=0, page_size=2)
    mock_request_entity.assert_called_with(request_path, braincube_name="")