Ejemplo n.º 1
0
def test_gem_table_entity_dict():
    table = GemTable.build(GemTableDataFactory())
    entity = table.as_entity_dict()

    assert entity == {'id': str(table.uid), 'type': 'TABLE'}
Ejemplo n.º 2
0
def Table(*args, **kwargs):  # pragma: no cover
    """[DEPRECATED] Use GemTable instead."""
    warn(
        "Table is deprecated and will soon be removed. "
        "Please use GemTable instead", DeprecationWarning)
    return GemTable(*args, **kwargs)
Ejemplo n.º 3
0
def test_delete_table(collection, table):
    with pytest.raises(NotImplementedError):
        collection.delete(GemTable.build(GemTableDataFactory()).uid)
Ejemplo n.º 4
0
 def _table(download_url: str) -> GemTable:
     return GemTable.build(
         GemTableDataFactory(signed_download_url=download_url, version=2))
Ejemplo n.º 5
0
def test_update_table(collection, table):
    with pytest.raises(RuntimeError):
        collection.update(GemTable.build(GemTableDataFactory()))
Ejemplo n.º 6
0
def test_register_table(collection):
    with pytest.raises(RuntimeError):
        collection.register(GemTable.build(GemTableDataFactory()))
Ejemplo n.º 7
0
def test_init_table():
    gem_table = GemTable()
    assert gem_table.uid is None
    assert gem_table.version is None
    assert gem_table.download_url is None
Ejemplo n.º 8
0
def test_simple_serialization(valid_data):
    table: GemTable = GemTable.build(valid_data)
    serialized = table.dump()
    assert serialized == valid_data
Ejemplo n.º 9
0
def test_simple_deserialization(valid_data):
    """Ensure that a deserialized Table looks normal."""
    table: GemTable = GemTable.build(valid_data)
    assert table.uid == UUID(valid_data['id'])
    assert table.version == valid_data["version"]
    assert table.download_url == "https://s3.amazonaws.citrine.io/bucketboi"