Exemplo n.º 1
0
    def create_and_test_matches(self):
        dbman.create_product("SquashCity", session=self.session)
        for m in self.messages:
            dbman.register_user("SquashCity",
                                user_name=m[1][0],
                                priority=m[1][1],
                                session=self.session)
        server = CommandServer([
            Message(i, 'CMD SquashCity ' + msg[0], msg[1][0])
            for (i, msg) in enumerate(self.messages)
        ])
        #print list(server)
        context = Context(self.session)
        for c in list(server):
            _ = c.execute(context)
        requests = dbman.active_product_requests('squashcity',
                                                 session=self.session)
        self.assertEqual(3, len(requests))

        matches = match(requests, self.search_results)
        req_george = dbman.active_user_requests('George',
                                                'SquashCity',
                                                session=self.session)[0]
        self.assertEqual(self.search_results[0], matches[req_george])
        req_ina = dbman.active_user_requests('Ina',
                                             'SquashCity',
                                             session=self.session)[0]
        self.assertEqual(self.search_results[1], matches[req_ina])
        req_lucian = dbman.active_user_requests('Luci',
                                                'SquashCity',
                                                session=self.session)[0]
        self.assertFalse(req_lucian in matches)
        return matches
Exemplo n.º 2
0
 def closing_test(self, matches):
     dbman.close_requests(matches, self.session)
     self.assertEqual(
         1,
         len(
             dbman.active_product_requests('squashcity',
                                           session=self.session)))
     self.assertEqual(
         1,
         len(
             dbman.active_user_requests('Luci',
                                        'squashcity',
                                        session=self.session)))
Exemplo n.º 3
0
 def active_user_requests(self):
     requests = dbman.active_user_requests(self.user, self.product, session=self.session)
     self.assertEqual(1, len(requests))
     self.assertIsNone(requests[0].closing_date)