def test_clean_data_newline_strip(self):
     '''
 Test new line characters are stripped
 '''
     withNewLine = dict(to_clean='test\n')
     expected = dict(to_clean='test')
     result = clean_data(withNewLine)
     self.assertEqual(expected, result), (expected, result)
 def test_clean_data_empty_request_params(self):
     '''
 Test not including a payload
 '''
     params = None
     expected = None
     result = clean_data(None)
     self.assertEqual(expected, result), (expected, result)
 def test_clean_data_doesnt_strip_from_key_value_that_is_not_body(self):
     '''
 Test html is not stripped from other key, values
 '''
     withHtml = dict(to_clean='<head>test</head>')
     expected = dict(to_clean='<head>test</head>')
     result = clean_data(withHtml)
     self.assertEqual(expected, result), (expected, result)
 def test_clean_data_whitespace_strip(self):
     '''
 Test whitespace is stripped
 '''
     withWhiteSpace = dict(to_clean='   test   ')
     expected = dict(to_clean='test')
     result = clean_data(withWhiteSpace)
     self.assertEqual(expected, result), (expected, result)
 def test_clean_data_html_strip_from_body(self):
   '''
   Test html is stripped
   '''
   withHtml = dict(body='<head>test</head>')
   expected = dict(body='test')
   result = clean_data(withHtml)
   self.assertEqual(expected, result), (expected, result)
 def test_clean_data_html_strip_from_body(self):
     '''
 Test html is stripped
 '''
     withHtml = dict(body='<head>test</head>')
     expected = dict(body='test')
     result = clean_data(withHtml)
     self.assertEqual(expected, result), (expected, result)
 def test_clean_data_empty_request_params(self):
   '''
   Test not including a payload
   '''
   params = None
   expected = None
   result = clean_data(None)
   self.assertEqual(expected, result), (expected, result)
 def test_clean_data_newline_strip(self):
   '''
   Test new line characters are stripped
   '''
   withNewLine = dict(to_clean='test\n')
   expected = dict(to_clean='test')
   result = clean_data(withNewLine)
   self.assertEqual(expected, result), (expected, result)
 def test_clean_data_whitespace_strip(self):
   '''
   Test whitespace is stripped
   '''
   withWhiteSpace = dict(to_clean='   test   ')
   expected = dict(to_clean='test')
   result = clean_data(withWhiteSpace)
   self.assertEqual(expected, result), (expected, result)
示例#10
0
 def test_clean_data_doesnt_strip_from_key_value_that_is_not_body(self):
   '''
   Test html is not stripped from other key, values
   '''
   withHtml = dict(to_clean='<head>test</head>')
   expected = dict(to_clean='<head>test</head>')
   result = clean_data(withHtml)
   self.assertEqual(expected, result), (expected, result)
示例#11
0
def send_mail():
  cleaned_data = clean_data(request.form)
  v_data = validate_data(cleaned_data)
  sendemail = sendEmail()
  response = sendemail.send(v_data)
  return Response(response)