Beispiel #1
0
 def test_mailpost_with_auth(self):
     """
     auth:
     url: - url where login form located
     form: (all fields should be exact as the fields in the login form)
         username: '******'
         password: '******'
        this_is_the_login_form :'1'
     """
     self.sample_rules[0]['auth'] = {'url':
                                 'http://127.0.0.1:8082/login/',
                                 'form': {'username': '******',
                                          'password': '******',
                                          'this_is_the_login_form': '1'}}
     server = TestServerThread("127.0.0.1", 8082)
     server.start()
     results = []
     try:
         mapper = Mapper(self.sample_rules,
                     'http://127.0.0.1:8082')
         for url, result in mapper.process(self.msg_list):
             results.append([url, result])
     except Exception, e:
         server.stop()
         raise e
Beispiel #2
0
    def test_mapper_current_workflow(self, *args, **kwargs):

        mapper = Mapper(self.sample_rules, 'http://localhost:8000')
        mapping = mapper.map(self.message)
        self.assert_(self.sample_rules[0]['conditions']['subject'][0]\
                      in mapping[1]['conditions']['subject'],
                      mapping[1]['conditions']['subject'])
Beispiel #3
0
 def test_mapper_desired_workflow(self, *args, **kwargs):
     sample_rules_2 = self.sample_rules
     sample_rules_2[0]['conditions']['subject'][0] =\
          '\[AVAILABLE FOR TRANSLATION\]*'
     mapper = Mapper(sample_rules_2, 'http://localhost:8000')
     mapping = mapper.map(self.message)
     self.assert_(self.sample_rules[0]['conditions']['subject'][0]\
                   in mapping[1]['conditions']['subject'],
                   mapping[1]['conditions']['subject'])
Beispiel #4
0
 def test_mailpost_without_auth(self):
     """
     auth:
     form:
         username: '******'
         passwd: 'pass'
     """
     server = TestServerThread("127.0.0.1", 8082)
     server.start()
     results = []
     try:
         mapper = Mapper(self.sample_rules,
                     'http://127.0.0.1:8082')
         for url, result in mapper.process(self.msg_list):
             results.append([url, result])
     except Exception, e:
         server.stop()
         raise e
Beispiel #5
0
    def test_message_id(self, *args, **kwargs):

        mapper = Mapper(self.sample_rules, 'http://localhost:8000')
        mapping = mapper.map(self.message)
        assert 'Message-ID' in mapping[1]['msg_params']