def test_wrong_text(self): result = get_translate(self.example_wrong_text['text'], self.example_translation['lang']) self.assertTrue(result['code'], 422)
def test_wrong_api(self): with patch(self.configuration_token.join('1234567')) as _: result = get_translate(self.example_translation['text'], self.example_translation['lang'])['code'] self.assertTrue(result, 401)
def test_translation(self): result_translate = get_translate(self.example_translation['text'], self.example_translation['lang']) self.assertTrue(result_translate['text'], 'Hi')
def test_block_api(self): with patch(self.configuration_token) as _: result = get_translate(self.example_translation['text'], self.example_translation['lang'])['code'] self.assertTrue(result, 402)
def test_200(self): result = get_translate(self.example_translation['text'], self.example_translation['lang']) self.assertEqual(result['code'], 200)