예제 #1
0
 def testSetPrimitive(self):
     o = Object()
     o.uid = '9'
     for i, value in enumerate((None, True, False, 123, 45.67, 'hey')):
         o.set(u'test/test', value)
         self.assertEqual(value, o._cache[u'test/test'])
         self.assertEqual(
             self.db.reqs[i],
             ('PUT', u'/objects/9/test/test', value, None, None))
예제 #2
0
 def testSetOpaque(self):
     o = Object()
     o.uid = '7'
     o.set(u'test/test', 'xyz', 'application/bananas')
     self.assertEqual(self.last, (
         'PUT',
         u'/objects/7/test/test',
         'xyz',
         None,
         'application/bananas'))
예제 #3
0
 def testSetPrimitive(self):
     o = Object()
     o.uid = '9'
     for i, value in enumerate(
         (None, True, False, 123, 45.67, 'hey')):
         o.set(u'test/test', value)
         self.assertEqual(value, o._cache[u'test/test'])
         self.assertEqual(self.db.reqs[i], (
             'PUT',
             u'/objects/9/test/test',
             value,
             None,
             None))
예제 #4
0
파일: load.py 프로젝트: fluidinfo/fluiddb
def generateNamespaceData(username):
    """Generate random namespace, tag and tag value data.

    @param username: The username to connect as.
    """
    rootNamespace = Namespace(username)
    name = 'namespace-%s' % ''.join(choice(ascii_letters)
                                    for i in xrange(randint(8, 12)))
    namespace = rootNamespace.create_namespace(name, 'A child namespace')
    logQueue.put(('CREATE_NAMESPACE path=%s/%s', (username, name)))
    countQueue.put(1)

    for tagName in WORDS:
        tag = namespace.create_tag(tagName, 'A tag', False)
        logQueue.put(('CREATE_TAG path=%s/%s/%s', (username, name, tagName)))
        countQueue.put(1)
        for i in range(randint(2, 20)):
            value = getRandomValue()
            about = 'namespace %s tag %s count %d' % (name, tagName, i)
            obj = Object(uuid4(), about=about)
            obj.set(tag.path, value)
            logQueue.put(('CREATE_TAG_VALUE value=%s tag=%s/%s/%s',
                          (value, username, name, tagName)))
            countQueue.put(1)
예제 #5
0
def generateNamespaceData(username):
    """Generate random namespace, tag and tag value data.

    @param username: The username to connect as.
    """
    rootNamespace = Namespace(username)
    name = 'namespace-%s' % ''.join(
        choice(ascii_letters) for i in xrange(randint(8, 12)))
    namespace = rootNamespace.create_namespace(name, 'A child namespace')
    logQueue.put(('CREATE_NAMESPACE path=%s/%s', (username, name)))
    countQueue.put(1)

    for tagName in WORDS:
        tag = namespace.create_tag(tagName, 'A tag', False)
        logQueue.put(('CREATE_TAG path=%s/%s/%s', (username, name, tagName)))
        countQueue.put(1)
        for i in range(randint(2, 20)):
            value = getRandomValue()
            about = 'namespace %s tag %s count %d' % (name, tagName, i)
            obj = Object(uuid4(), about=about)
            obj.set(tag.path, value)
            logQueue.put(('CREATE_TAG_VALUE value=%s tag=%s/%s/%s',
                          (value, username, name, tagName)))
            countQueue.put(1)
예제 #6
0
 def testSetOpaque(self):
     o = Object()
     o.uid = '7'
     o.set(u'test/test', 'xyz', 'application/bananas')
     self.assertEqual(self.last, ('PUT', u'/objects/7/test/test', 'xyz',
                                  None, 'application/bananas'))