Exemplo n.º 1
0
 def testCreateTag(self):
     n = Namespace(u'test')
     self.db.add_resp(201, 'application/json', '{"id": "4", "URI": "https')
     new_tag = n.create_tag(u'test', 'a test')
     self.assertTrue(isinstance(new_tag, Tag))
     self.assertEqual(self.last, ('POST', u'/tags/test', {
         u'indexed': False,
         u'name': u'test',
         u'description': 'a test'
     }, None, None))
Exemplo n.º 2
0
 def testCreateTag(self):
     n = Namespace(u'test')
     self.db.add_resp(201, 'application/json',
         '{"id": "4", "URI": "https')
     new_tag = n.create_tag(u'test', 'a test')
     self.assertTrue(isinstance(new_tag, Tag))
     self.assertEqual(self.last, (
         'POST',
         u'/tags/test',
         {u'indexed': False,
          u'name': u'test',
          u'description': 'a test'},
         None,
         None))
Exemplo n.º 3
0
    def testQueryWithUnicodeTagName(self):
        """
        Make sure that a query using a tag whose name contains non-ASCII
        unicode characters works correctly.

        See https://bugs.edge.launchpad.net/fluiddb/+bug/681354 for the reason
        this is tested.
        """
        # Use the testuser1 root namespace.
        ns = Namespace('testuser1')
        # Umlauts FTW!
        tag_name = u'C\xfc\xe4h'
        # Create the tag.
        tag = ns.create_tag(tag_name, 'Used for testing purposes', False)
        try:
            # Run a query that uses the tag.  If we haven't fixed the bug,
            # FluidDB will hang at this point.
            result = Object.filter('has testuser1/%s' % tag_name)
            # Check the result is an empty list (i.e., no results found).
            self.assertEqual([], result)
        finally:
            # Clean up the tag.
            tag.delete()
Exemplo n.º 4
0
    def testQueryWithUnicodeTagName(self):
        """
        Make sure that a query using a tag whose name contains non-ASCII
        unicode characters works correctly.

        See https://bugs.edge.launchpad.net/fluiddb/+bug/681354 for the reason
        this is tested.
        """
        # Use the testuser1 root namespace.
        ns = Namespace('testuser1')
        # Umlauts FTW!
        tag_name = u'C\xfc\xe4h'
        # Create the tag.
        tag = ns.create_tag(tag_name, 'Used for testing purposes', False)
        try:
            # Run a query that uses the tag.  If we haven't fixed the bug,
            # FluidDB will hang at this point.
            result = Object.filter('has testuser1/%s' % tag_name)
            # Check the result is an empty list (i.e., no results found).
            self.assertEqual([], result)
        finally:
            # Clean up the tag.
            tag.delete()
Exemplo n.º 5
0
fluid = sandbox_fluid()

# let's start by creating a new Namespace for this application and then some
# tags

# Use the test user's namespace
ns = Namespace(u'test')

# create a child namespace for ourselves
ns.create_namespace(u'maptest', u'a test namespace')

# use our child namespace
ns = Namespace(u'test/maptest')

# create some tags
ns.create_tag(u'description', u'description', indexed=False)
ns.create_tag(u'timestamp', u'description', indexed=False)
ns.create_tag(u'username', u'description', indexed=False)


# Now we will define some behaviours mapping to groups of individual tags

class Describable(Object):
    """Mixin to provide describable behaviour
    """
    description = tag_value(u'test/maptest/description')


class Auditable(Object):
    """Mixin to provide auditable behaviour
    """
Exemplo n.º 6
0
fluid = sandbox_fluid()

# let's start by creating a new Namespace for this application and then some
# tags

# Use the test user's namespace
ns = Namespace(u'test')

# create a child namespace for ourselves
ns.create_namespace(u'maptest', u'a test namespace')

# use our child namespace
ns = Namespace(u'test/maptest')

# create some tags
ns.create_tag(u'description', u'description', indexed=False)
ns.create_tag(u'timestamp', u'description', indexed=False)
ns.create_tag(u'username', u'description', indexed=False)

# Now we will define some behaviours mapping to groups of individual tags


class Describable(Object):
    """Mixin to provide describable behaviour
    """
    description = tag_value(u'test/maptest/description')


class Auditable(Object):
    """Mixin to provide auditable behaviour
    """
Exemplo n.º 7
0
def create_tags():
    ns = Namespace(u'test/medical')
    ns.create(u'Medical tags')
    ns.create_tag(u'date_of_birth', u'Date of birth', True)
    ns.create_tag(u'age', u'Decimal age', True)
    ns.create_tag(u'height', u'Height', True)
    ns.create_tag(u'weight', u'Weight', True)
    ns.create_tag(u'bmi', u'Body Mass Index', True)
    ns.create_tag(u'date', u'Date', True)
    ns.create_tag(u'sex', u'Sex', True)
    ns.create_tag(u'pubertal_stage', u'Pubertal stage')