

def test_push_to_fluiddb(self):
    name = str(uuid.uuid4())
    root_path = ('test/%s' % name)
    tags = create_schema(TEMPLATE, root_path, 'flimp_test', 'flimp unit-test suite')
    self.assertEqual(4, len(tags))
    fom_class = create_class(tags)
    push_to_fluiddb(TEMPLATE, root_path, fom_class, 'foo', 'flimp_test')
    result = Object.filter(('has %s/foo' % root_path))
    self.assertEqual(1, len(result))
    push_to_fluiddb(TEMPLATE, root_path, fom_class, None, 'flimp_test')
    result = Object.filter(('has %s/foo' % root_path))
    self.assertEqual(2, len(result))
    for obj in result:
        tag_paths = obj.tag_paths
        for k in tags:
            self.assertTrue((k in tag_paths))
    template = [{
        'foo-x': None,
        'bar-x': {
            'baz-x': '',
        },
        'bof-x': 'Hello',
        'qux-x': False,
    }]
    tags = create_schema(template, root_path, 'flimp_test', 'flimp unit-test suite')
    self.assertEqual(4, len(tags))
    fom_class = create_class(tags)
    push_to_fluiddb(template, root_path, fom_class, None, 'flimp_test', allowEmpty=False)
    result = Object.filter(('has %s/bof-x' % root_path))
    self.assertEqual(1, len(result))
    tag_paths = result[0].tag_paths
    self.assertEqual(3, len(tag_paths))

dataset/ETHPy150Open fluidinfo/flimp/tests/test_utils.py TestUtils.test_push_to_fluiddb/original