def test_create_vocab_dict_format_json():
    prop = factories.PropertyFactory()
    vocab = prop.term_key.vocab_list

    vocab_handler = VocabularyHandler().py_response(vocab)
    vocab_dict = vocab_handler.create_vocab_dict('json')

    assert vocab_dict['created'] == str(vocab.created)
    assert vocab_dict['modified'] == str(vocab.modified)
def test_create_vocab_dict_format_json():
    prop = factories.PropertyFactory()
    vocab = prop.term_key.vocab_list

    vocab_handler = VocabularyHandler().py_response(vocab)
    vocab_dict = vocab_handler.create_vocab_dict('json')

    assert vocab_dict['created'] == str(vocab.created)
    assert vocab_dict['modified'] == str(vocab.modified)
def test_create_vocab_dict_properties_sub_dict():
    """Test that the embedded dictionary contains the right information."""
    prop = factories.PropertyFactory()

    vocab_handler = VocabularyHandler().py_response(prop.term_key.vocab_list)
    vocab_dict = vocab_handler.create_vocab_dict('py')

    prop_dict = vocab_dict['terms'][0]['properties'][0]
    assert prop_dict['property_name'] == prop.property_name
    assert prop_dict['label'] == prop.label
def test_create_vocab_dict_properties_sub_dict():
    """Test that the embedded dictionary contains the right information."""
    prop = factories.PropertyFactory()

    vocab_handler = VocabularyHandler().py_response(prop.term_key.vocab_list)
    vocab_dict = vocab_handler.create_vocab_dict('py')

    prop_dict = vocab_dict['terms'][0]['properties'][0]
    assert prop_dict['property_name'] == prop.property_name
    assert prop_dict['label'] == prop.label
def test_create_vocab_dict_term_sub_dict():
    """Test that the embedded dictionary contains the right information."""
    prop = factories.PropertyFactory()
    term = prop.term_key
    vocab = term.vocab_list

    vocab_handler = VocabularyHandler().py_response(vocab)
    vocab_dict = vocab_handler.create_vocab_dict('py')

    term_dict = vocab_dict['terms'][0]
    assert term_dict['name'] == term.name
    assert term_dict['label'] == term.label
    assert term_dict['order'] == term.order
    assert term_dict['url'] == 'http://purl.org/NET/UNTL/vocabularies/{}/#{}'.format(
        vocab.name, term.name)
    assert 'properties' in term_dict
def test_create_vocab_dict():
    # Create a vocab, term, and property that should be in the vocab_dict.
    prop = factories.PropertyFactory()
    vocab = prop.term_key.vocab_list

    vocab_handler = VocabularyHandler().py_response(vocab)
    vocab_dict = vocab_handler.create_vocab_dict('py')

    assert vocab_dict['name'] == vocab.name
    assert vocab_dict['label'] == vocab.label
    assert vocab_dict['order'] == vocab.order
    assert vocab_dict['maintainerEmail'] == vocab.maintainerEmail
    assert vocab_dict['definition'] == vocab.definition
    assert vocab_dict['created'] == vocab.created
    assert vocab_dict['modified'] == vocab.modified
    assert 'terms' in vocab_dict.keys()
def test_create_vocab_dict_term_sub_dict():
    """Test that the embedded dictionary contains the right information."""
    prop = factories.PropertyFactory()
    term = prop.term_key
    vocab = term.vocab_list

    vocab_handler = VocabularyHandler().py_response(vocab)
    vocab_dict = vocab_handler.create_vocab_dict('py')

    term_dict = vocab_dict['terms'][0]
    assert term_dict['name'] == term.name
    assert term_dict['label'] == term.label
    assert term_dict['order'] == term.order
    assert term_dict['url'] == 'http://purl.org/NET/UNTL/vocabularies/{}/#{}'.format(
        vocab.name, term.name)
    assert 'properties' in term_dict
def test_create_vocab_dict():
    # Create a vocab, term, and property that should be in the vocab_dict.
    prop = factories.PropertyFactory()
    vocab = prop.term_key.vocab_list

    vocab_handler = VocabularyHandler().py_response(vocab)
    vocab_dict = vocab_handler.create_vocab_dict('py')

    assert vocab_dict['name'] == vocab.name
    assert vocab_dict['label'] == vocab.label
    assert vocab_dict['order'] == vocab.order
    assert vocab_dict['maintainerEmail'] == vocab.maintainerEmail
    assert vocab_dict['definition'] == vocab.definition
    assert vocab_dict['created'] == vocab.created
    assert vocab_dict['modified'] == vocab.modified
    assert 'terms' in vocab_dict.keys()