コード例 #1
0
    def test_posting_with_book(self):
        backend = impl_dir.DirBackend(conf={
            'path': self.makeTmpDir(),
        })
        backend.get_connection().upgrade()
        book, flow_detail = p_utils.temporary_flow_detail(backend)
        self.assertEqual(1, len(book))

        client, board = create_board(persistence=backend)
        self.addCleanup(board.close)

        with connect_close(board):
            board.post('test', book)
            client.flush()

            possible_jobs = list(board.iterjobs(only_unclaimed=True))
            self.assertEqual(1, len(possible_jobs))
            j = possible_jobs[0]
            self.assertEqual(1, len(j.book))
            self.assertEqual(book.name, j.book.name)
            self.assertEqual(book.uuid, j.book.uuid)

            flow_details = list(j.book)
            self.assertEqual(flow_detail.uuid, flow_details[0].uuid)
            self.assertEqual(flow_detail.name, flow_details[0].name)
コード例 #2
0
 def setUp(self):
     super(DirPersistenceTest, self).setUp()
     self.path = tempfile.mkdtemp()
     self.backend = impl_dir.DirBackend({
         'path':
         self.path,
         'max_cache_size':
         self.max_cache_size,
     })
     with contextlib.closing(self._get_connection()) as conn:
         conn.upgrade()
コード例 #3
0
 def _get_connection(self):
     conf = {
         'path': self.path,
     }
     return impl_dir.DirBackend(conf).get_connection()