Пример #1
0
 def test_two_items_missing_or_long_email(self):
     "missing or long incorrect email"
     data = example_data_products.copy()
     del data["EMAL"]
     self.assertIn('MODE', data)
     expected = {
         'ERRO':
         221,
         'ERROR_COUNT':
         1,
         'MODE':
         'E',
         'WARNING_COUNT':
         0,
         'ERROR_0':
         "221 MISSING_EMAL Cause: "
         "[Non-empty value was required in this case], "
         "Field: [EMAL], Value: []"
     }
     for raise_errors in [True, False]:
         actual = self._client(raise_errors=raise_errors)._execute(data)
         self.assertEqual(actual, expected)
     data["EMAL"] = "a" * 57 + "@aaa.com"
     response = self._client(raise_errors=False)._execute(data)
     self.assertEqual(321, response['ERRO'])
Пример #2
0
 def test_2_items_bad_s2em(self):
     """bad S2EM"""
     bad = example_data_products["S2EM"].replace('@', "%40")
     data = example_data_products.copy()
     data["S2EM"] = bad
     actual = self._client(raise_errors=False)._execute(params=data)
     del (actual['TRAN'], actual['RULE_ID_0'], actual['VELO'],
          actual['VMAX'])
     self.assertEqual(actual, self._expected_response())
Пример #3
0
 def test_api_kount_2_items(self):
     "expected modified 'TRAN'"
     data = example_data_products.copy()
     self.assertIn('MODE', data)
     for raise_errors in [True, False]:
         actual = self._client(raise_errors=raise_errors)._execute(data)
         del (actual['TRAN'], actual['RULE_ID_0'], actual['VELO'],
              actual['VMAX'])
         self.assertEqual(actual, self._expected_response())
Пример #4
0
 def test_two_items_none_email(self):
     "email = None"
     data = example_data_products.copy()
     data["EMAL"] = None
     self.assertIn('MODE', data)
     expected = {
         'ERRO':
         221,
         'ERROR_COUNT':
         1,
         'MODE':
         'E',
         'WARNING_COUNT':
         0,
         'ERROR_0':
         "221 MISSING_EMAL Cause: "
         "[Non-empty value was required in this case], "
         "Field: [EMAL], Value: []"
     }
     for raise_errors in [True, False]:
         actual = self._client(raise_errors=raise_errors)._execute(data)
         self.assertEqual(actual, expected)
Пример #5
0
    def test_last_2_items_bad_email(self):
        "last_2_items_bad_email"
        data = example_data_products.copy()
        self.assertIn('MODE', CURLED)
        bad = CURLED['EMAL'].replace('@', "%40")
        data["EMAL"] = bad

        expected = {
            'ERROR_0':
            "321 BAD_EMAL Cause: [[%s is an invalid email address],"
            " Field: [EMAL], Value: [%s]" % (bad, bad),
            'ERRO':
            321,
            'ERROR_COUNT':
            1,
            'WARNING_COUNT':
            0,
            'MODE':
            'E'
        }
        actual = self._client(raise_errors=False)._execute(data)
        self.assertEqual(actual, expected)