コード例 #1
0
def test_positive_delete(name, module_org):
    """Create gpg key with valid name and valid gpg key via file
    import then delete it

    :id: 9640cabc-e0c3-41a0-b4de-99b06bf51c02

    :parametrized: yes

    :expectedresults: gpg key is deleted

    :CaseImportance: Critical
    """
    gpg_key = make_content_credential({
        'name': name,
        'organization-id': module_org.id
    })
    result = ContentCredential.exists(
        {'organization-id': module_org.id},
        (search_key, gpg_key[search_key]),
    )
    assert gpg_key[search_key] == result[search_key]
    ContentCredential.delete({'name': name, 'organization-id': module_org.id})
    result = ContentCredential.exists(
        {'organization-id': module_org.id},
        (search_key, gpg_key[search_key]),
    )
    assert (len(result)) == 0
コード例 #2
0
def test_positive_search(name, module_org):
    """Create gpg key and search for it

    :id: f72648f1-b468-4662-9653-3464e7d0c349

    :expectedresults: gpg key can be found

    :CaseImportance: Critical
    """
    gpg_key = make_content_credential({
        'key': VALID_GPG_KEY_FILE_PATH,
        'name': name,
        'organization-id': module_org.id,
    })
    # Can we find the new object?
    result = ContentCredential.exists({'organization-id': module_org.id},
                                      search=('name', gpg_key['name']))
    assert gpg_key['name'] == result['name']
コード例 #3
0
def test_positive_create_with_default_org(name, module_org, default_org):
    """Create gpg key with valid name and valid gpg key via file
    import using the default created organization

    :id: 4265dfd1-dc64-4119-8a64-8724b09d6fb7

    :expectedresults: gpg key is created

    :CaseImportance: Critical
    """
    org = Org.info({'name': DEFAULT_ORG})
    gpg_key = make_content_credential({
        'key': VALID_GPG_KEY_FILE_PATH,
        'name': name,
        'organization-id': org['id']
    })
    # Can we find the new object?
    result = ContentCredential.exists({'organization-id': org['id']},
                                      (search_key, gpg_key[search_key]))
    assert gpg_key[search_key] == result[search_key]
コード例 #4
0
def test_positive_create_with_custom_org(name, module_org):
    """Create gpg key with valid name and valid gpg key via file
    import using a new organization

    :id: 10dd9fc0-e088-4cf1-9fb6-24fe04df2895

    :expectedresults: gpg key is created

    :CaseImportance: Critical
    """
    gpg_key = make_content_credential({
        'key': VALID_GPG_KEY_FILE_PATH,
        'name': name,
        'organization-id': module_org.id,
    })
    # Can we find the new object?
    result = ContentCredential.exists(
        {'organization-id': module_org.id},
        (search_key, gpg_key[search_key]),
    )
    assert gpg_key[search_key] == result[search_key]
コード例 #5
0
def test_negative_create_with_same_name(module_org):
    """Create gpg key with valid name and valid gpg key via file
    import then try to create new one with same name

    :id: 8751745c-5cf6-42f7-8fbd-6c23119da486

    :expectedresults: gpg key is not created

    :CaseImportance: Critical
    """
    name = gen_string('alphanumeric')
    gpg_key = make_content_credential({
        'name': name,
        'organization-id': module_org.id
    })
    # Can we find the new object?
    result = ContentCredential.exists({'organization-id': module_org.id},
                                      (search_key, gpg_key[search_key]))
    assert gpg_key[search_key] == result[search_key]
    with pytest.raises(CLIFactoryError):
        make_content_credential({
            'name': name,
            'organization-id': module_org.id
        })