def test_valid_modes_returns_true(self): for mode in list(FuzzyMode): request = construct_dummy_request(json_body={'type': mode}) response = valid_fuzzy_search_mode(request) self.assertTrue(response) self.assertIsInstance(response, bool)
def test_empty_type_is_false(self): request = construct_dummy_request({'type': ''}) response = valid_fuzzy_search_mode(request) self.assertFalse(response) self.assertIsInstance(response, bool)
def test_invalid_mode_number_is_false(self): request = construct_dummy_request(json_body={'type': -1}) response = valid_fuzzy_search_mode(request) self.assertFalse(response) self.assertIsInstance(response, bool)
def test_valid_modes_returns_true(self): for mode in [0, 1, 2, 3, 4, 8, 9]: request = construct_dummy_request({'type': mode}) response = valid_fuzzy_search_mode(request) self.assertTrue(response) self.assertIsInstance(response, bool)