Ejemplo n.º 1
0
 def test_update(self):
     with helpers.shard_entry(self.controller, self.project,
                              self.queue, u'a') as expect:
         p, q, s = expect
         self.controller.update(p, q, shard=u'b')
         entry = self.controller.get(p, q)
         self._check_value(entry, xqueue=q, xproject=p, xshard=u'b')
Ejemplo n.º 2
0
 def test_exists(self):
     with helpers.shard_entry(self.controller,
                              self.project,
                              self.queue, u'a') as expect:
         p, q, _ = expect
         self.assertTrue(self.controller.exists(p, q))
     self.assertFalse(self.controller.exists('nada', 'not_here'))
Ejemplo n.º 3
0
 def test_get(self):
     with helpers.shard_entry(self.controller,
                              self.project,
                              self.queue, u'a') as expect:
         p, q, s = expect
         e = self.controller.get(p, q)
         self._check_value(e, xqueue=q, xproject=p, xshard=s)
Ejemplo n.º 4
0
 def test_update(self):
     with helpers.shard_entry(self.controller, self.project, self.queue,
                              u'a') as expect:
         p, q, s = expect
         self.controller.update(p, q, shard=u'b')
         entry = self.controller.get(p, q)
         self._check_value(entry, xqueue=q, xproject=p, xshard=u'b')
Ejemplo n.º 5
0
 def test_exists(self):
     with helpers.shard_entry(self.controller,
                              self.project,
                              self.queue, u'a') as expect:
         p, q, _ = expect
         self.assertTrue(self.controller.exists(p, q))
     self.assertFalse(self.controller.exists('nada', 'not_here'))
Ejemplo n.º 6
0
 def test_get(self):
     with helpers.shard_entry(self.controller,
                              self.project,
                              self.queue, u'a') as expect:
         p, q, s = expect
         e = self.controller.get(p, q)
         self._check_value(e, xqueue=q, xproject=p, xshard=s)
Ejemplo n.º 7
0
 def test_get_raises_if_does_not_exist(self):
     with helpers.shard_entry(self.controller, self.project, self.queue,
                              u'a') as expect:
         p, q, _ = expect
         self.assertRaises(errors.QueueNotMapped, self.controller.get, p,
                           'non_existing')
         self.assertRaises(errors.QueueNotMapped, self.controller.get,
                           'non_existing', q)
         self.assertRaises(errors.QueueNotMapped, self.controller.get,
                           'non_existing', 'non_existing')
Ejemplo n.º 8
0
 def test_get_raises_if_does_not_exist(self):
     with helpers.shard_entry(self.controller,
                              self.project,
                              self.queue, u'a') as expect:
         p, q, _ = expect
         self.assertRaises(errors.QueueNotMapped,
                           self.controller.get,
                           p, 'non_existing')
         self.assertRaises(errors.QueueNotMapped,
                           self.controller.get,
                           'non_existing', q)
         self.assertRaises(errors.QueueNotMapped,
                           self.controller.get,
                           'non_existing', 'non_existing')
Ejemplo n.º 9
0
    def test_catalogue_entry_life_cycle(self):
        queue = self.queue
        project = self.project

        # check listing is initially empty
        for p in self.controller.list(project):
            self.fail('There should be no entries at this time')

        # create a listing, check its length
        with helpers.shard_entries(self.controller, 10) as expect:
            project = expect[0][0]
            xs = list(self.controller.list(project))
            self.assertEqual(len(xs), 10)

        # create, check existence, delete
        with helpers.shard_entry(self.controller, project, queue, u'a'):
            self.assertTrue(self.controller.exists(project, queue))

        # verify it no longer exists
        self.assertFalse(self.controller.exists(project, queue))

        # verify it isn't listable
        self.assertEqual(len(list(self.controller.list(project))), 0)
Ejemplo n.º 10
0
    def test_catalogue_entry_life_cycle(self):
        queue = self.queue
        project = self.project

        # check listing is initially empty
        for p in self.controller.list(project):
            self.fail('There should be no entries at this time')

        # create a listing, check its length
        with helpers.shard_entries(self.controller, 10) as expect:
            project = expect[0][0]
            xs = list(self.controller.list(project))
            self.assertEqual(len(xs), 10)

        # create, check existence, delete
        with helpers.shard_entry(self.controller, project, queue, u'a'):
            self.assertTrue(self.controller.exists(project, queue))

        # verify it no longer exists
        self.assertFalse(self.controller.exists(project, queue))

        # verify it isn't listable
        self.assertEqual(len(list(self.controller.list(project))), 0)
Ejemplo n.º 11
0
 def test_exists(self):
     with helpers.shard_entry(self.controller, self.project, self.queue, u"a") as expect:
         p, q, _ = expect
         self.assertTrue(self.controller.exists(p, q))
     self.assertFalse(self.controller.exists("nada", "not_here"))