Пример #1
0
def test_list_with_filters():
    responses.add(responses.GET,
                  'http://api/v2/licenses',
                  json=answers.LICENSES_LIST)
    manager = LicenseManager(client)

    ips = manager.list(project_id="e7081cb46966421fb8b3f3fd9b4db75b")
    assert len(ips) == 1
    assert ips[0]["project_id"] == "e7081cb46966421fb8b3f3fd9b4db75b"

    ips = manager.list(region="ru-2")
    assert len(ips) == 1
    assert ips[0]["region"] == "ru-2"

    ips = manager.list(project_id="e7081cb46966421fb8b3f3fd9b4db75b",
                       region="ru-2")
    assert len(ips) == 0
Пример #2
0
def test_list():
    responses.add(responses.GET,
                  'http://api/v2/licenses',
                  json=answers.LICENSES_LIST)
    manager = LicenseManager(client)

    licenses = manager.list(return_raw=True)

    assert licenses == answers.LICENSES_LIST["licenses"]
Пример #3
0
def test_list():
    responses.add(responses.GET,
                  'http://api/v2/licenses',
                  json=answers.LICENSES_LIST)
    manager = LicenseManager(client)

    licenses = manager.list()

    assert len(licenses) == 2
Пример #4
0
def test_delete_from_single_obj():
    responses.add(responses.GET,
                  'http://api/v2/licenses',
                  json=answers.LICENSES_LIST)
    responses.add(responses.DELETE, 'http://api/v2/licenses/0', status=204)
    manager = LicenseManager(client)

    license = manager.list()[0]
    result = license.delete()

    assert result is None