def test_push_to_fluiddb(self):
        # set stuff up...
        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)
        # the good case
        push_to_fluiddb(TEMPLATE, root_path, fom_class, 'foo',
                        'flimp_test')
        # check an object was created
        result = Object.filter("has %s/foo" % root_path)
        self.assertEqual(1, len(result))
        # lets try the other good case where we don't have an about tag field
        push_to_fluiddb(TEMPLATE, root_path, fom_class, None,
                        'flimp_test')
        # we should have *two* objects now
        result = Object.filter("has %s/foo" % root_path)
        self.assertEqual(2, len(result))
        # check we have all the expected tags on the objects
        for obj in result:
            tag_paths = obj.tag_paths
            for k in tags:
                self.assertTrue(k in tag_paths)
        # ok... lets make sure that the allowEmpty flag is handled properly
        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)
        # check an object was created
        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