Пример #1
0
 def test_create_duplicated_requestor(self):
     """ Verify that a new requestor with an existing email cannot be created """
     helpers.create_dummy_requestor(1)
     
     try:
         helpers.create_dummy_requestor(1)
         self.fail('Created duplicated requestor')
     except(RequestorException):
         pass
Пример #2
0
 def test_retrieve_open_requests_by_requestor(self):
     requestor_manager_1 = self.requestor_manager
     request_manager_1 = self.request_manager
     
     requestor_manager_2 = helpers.create_dummy_requestor(2)
     request_manager_2 = RequestorRequestManager(requestor_manager_2.get_requestor())
     
     # Create 7 requests, mixing the 2 requestors
     helpers.create_dummy_request(request_manager_1, 1) 
     helpers.create_dummy_request(request_manager_2, 2) 
     helpers.create_dummy_request(request_manager_1, 3) 
     helpers.create_dummy_request(request_manager_2, 4) 
     helpers.create_dummy_request(request_manager_1, 5) 
     helpers.create_dummy_request(request_manager_2, 6) 
     helpers.create_dummy_request(request_manager_1, 7)
     
     requests_1 = request_manager_1.list_requests()
     requests_2 = request_manager_2.list_requests()
     
     # Verify that each request manager returns own requests only
     self.assertEqual(len(requests_1), 4)
     self.assertEqual(len(requests_2), 3)
      
     for request in requests_1:
         self.assertEqual(request.requestor.key(), requestor_manager_1.get_requestor().key())
          
     for request in requests_2:
         self.assertEqual(request.requestor.key(), requestor_manager_2.get_requestor().key())
Пример #3
0
    def setUp(self):
        super(Test_ManageResponderRequests, self).setUp()
        
        (self._category_1, self._category_2) = helpers.create_dummy_request_categories()

        # Create 2 requestors
        self._requestor_manager_1 = helpers.create_dummy_requestor(1)
        request_manager_1 = RequestorRequestManager(self._requestor_manager_1.get_requestor())
        
        self._requestor_manager_2 = helpers.create_dummy_requestor(2)
        request_manager_2 = RequestorRequestManager(self._requestor_manager_2.get_requestor())

        # Create 7 requests, mixing the 2 requestors
        helpers.create_dummy_request(request_manager_1, 1) 
        helpers.create_dummy_request(request_manager_2, 2) 
        helpers.create_dummy_request(request_manager_1, 3) 
        helpers.create_dummy_request(request_manager_2, 4) 
        helpers.create_dummy_request(request_manager_1, 5) 
        helpers.create_dummy_request(request_manager_2, 6) 
        helpers.create_dummy_request(request_manager_1, 7)
        
        self._request_manager = ResponderRequestManager()
Пример #4
0
 def setUp(self):
     super(Test_ManageRequests, self).setUp()
     self.requestor_manager = helpers.create_dummy_requestor(1)
     self.request_manager = RequestorRequestManager(self.requestor_manager.get_requestor())
     helpers.create_dummy_request_categories()
Пример #5
0
 def test_verify_default_rank_on_requestor_creation(self):
     """ Verify that default rank is 999998 """
     requestor_manager = helpers.create_dummy_requestor(1)
     self.assertEqual(requestor_manager.get_requestor().rank, 999998)