def setUp(self): # FIXME: update assignements for none string types e.g boolean and int self._unique_id = self.id_generator() self._model = TaskListGroup() # noqa: E501 self._model.description = self._unique_id self._model.task_lists = self._unique_id self._model.name = self._unique_id
def test_serializeTaskListGroup(self): #We will use HttpListenerPolicy as our test model model = TaskListGroup() # noqa: E501 model.name = self._unique_id model.task_lists = None j = self._serialization.serialize(model) data = json.loads(j) #print j self.assertEqual(data['name'], self._unique_id)
def testTaskListGroup_constructor(self): """Test TaskListGroup""" # FIXME: update assignements for none string types e.g boolean and int model = TaskListGroup(description=None, task_lists=None, name=None) # noqa: E501 self.assertTrue(isinstance(model, TaskListGroup))
def setUp(self): self._api = task_list_groups_api.TaskListGroupsApi() self._unique_id = helper.id_generator() self._model = TaskListGroup() # noqa: E501 self._model.name = self._unique_id self._model.description = self._unique_id
def test_task_list_groups_api_set2(self, mock_put): ''' Tests when requests gets a 500 response from forum ''' test_name = sys._getframe().f_code.co_name model = TaskListGroup() # noqa: E501 model.name = "bill" mock_resp = helper._mock_response(status=500, raise_for_status="internal error") mock_put.return_value = mock_resp with self.assertRaises(ForumHTTPError) as e: taskListGroup = self._api.set("bill", model) #print e.exception.message self.assertEqual(500, e.exception.cause.response.status_code) self.assertIn('internal error', e.exception.message)
def test_task_list_groups_api_set1(self, mock_put): ''' Tests when requests gets a successful response from forum ''' test_name = sys._getframe().f_code.co_name #mock_get.return_value = self.loadMock(test_name) mock_resp = helper._mock_response(test_name=test_name) mock_put.return_value = mock_resp model = TaskListGroup() # noqa: E501 model.name = test_name model.description = test_name model.task_lists = "" created = self._api.set(test_name, model) self.assertIsInstance(created, TaskListGroup) self.assertEqual(created, model) self.assertEqual(created.name, test_name)
def testTaskListGroup(self): """Test TaskListGroup""" model = TaskListGroup() # noqa: E501 self.assertTrue(isinstance(model, TaskListGroup))
class TestTaskListGroup(unittest.TestCase): """TaskListGroup unit test stubs""" def id_generator(self, size=6, chars=string.ascii_uppercase + string.digits): return ''.join(random.choice(chars) for _ in range(size)) def setUp(self): # FIXME: update assignements for none string types e.g boolean and int self._unique_id = self.id_generator() self._model = TaskListGroup() # noqa: E501 self._model.description = self._unique_id self._model.task_lists = self._unique_id self._model.name = self._unique_id def tearDown(self): pass ''' >>>> custom tests ''' # # Replace with custom tests to increase coverage to 100%. Typically this will be where a value error is thrown on a setter method. This is difficult to template. # ''' <<<< custom tests ''' def testTaskListGroup(self): """Test TaskListGroup""" model = TaskListGroup() # noqa: E501 self.assertTrue(isinstance(model, TaskListGroup)) def testTaskListGroup_constructor(self): """Test TaskListGroup""" # FIXME: update assignements for none string types e.g boolean and int model = TaskListGroup(description=None, task_lists=None, name=None) # noqa: E501 self.assertTrue(isinstance(model, TaskListGroup)) def testTaskListGroup_constructor_none_default(self): """Test TaskListGroup""" # FIXME: update assignements for none string types e.g boolean and int model = TaskListGroup(description=self._unique_id, task_lists=self._unique_id, name=self._unique_id) # noqa: E501 self.assertTrue(isinstance(model, TaskListGroup)) def testTaskListGroup_properties(self): """Test TaskListGroup""" # FIXME: update assignements for none string types e.g boolean and int new_unique_id = self.id_generator() self._model.description = new_unique_id self.assertEqual(self._model.description, new_unique_id) self.assertNotEqual(self._model.description, self._unique_id) self._model.task_lists = new_unique_id self.assertEqual(self._model.task_lists, new_unique_id) self.assertNotEqual(self._model.task_lists, self._unique_id) self._model.name = new_unique_id self.assertEqual(self._model.name, new_unique_id) self.assertNotEqual(self._model.name, self._unique_id) def testTaskListGroup_compare(self): """Test TaskListGroup""" new_unique_id = self.id_generator() model_copy = copy.deepcopy(self._model) #check out compare works self.assertEqual(model_copy, self._model) #change something on the model model_copy.name = new_unique_id #check our compare detects they arent equal self.assertNotEqual(model_copy, self._model) def testTaskListGroup_to_dict(self): """Test TaskListGroup""" to_dict_object = self._model.to_dict() self.assertTrue(isinstance(to_dict_object, dict)) def testTaskListGroup_to_str(self): """Test TaskListGroup""" to_str_object = self._model.to_str() self.assertTrue(isinstance(to_str_object, str))