Пример #1
0
def test_oc_get_services_doc_example():
    env = {
        'OcGetService': openshift_get.OcGetService,
        'setting_dic': openshift_get.OcGetService(context_wrap(OC_GET_SERVICE))
    }
    failed, total = doctest.testmod(openshift_get, globs=env)
    assert failed == 0
Пример #2
0
def test_oc_get_service_yml():
    result = openshift_get.OcGetService(context_wrap(OC_GET_SERVICE))
    assert result.data['items'][0]['kind'] == 'Service'
    assert result.data['items'][0]['spec']['clusterIP'] == '172.30.0.1'
    assert result.data['items'][0]['metadata']['name'] == 'kubernetes'
    assert result.data['items'][1]['metadata']['name'] == 'router-1'
    assert result.data['items'][1]['spec']['ports'][0]['port'] == 80
    assert result.data['kind'] == 'List'
    assert result.data['metadata'] == {}
    assert result.get("items")[0]['spec']['clusterIP'] == '172.30.0.1'
    assert "zjj-project" in result.data['items'][1]['metadata']['namespace']
    assert result.services["router-1"]["metadata"]["resourceVersion"] == "1638401"