def test_get_character_non_existent_no_states(self): from elixir_models import Object MockCharacter = Mock() MockCharacter.get_objects = Mock(side_effect=Object.DoesNotExist('')) MockCharacter.DoesNotExist = Object.DoesNotExist with patch.object(zoneserver, 'Object', MockCharacter): result = self.character_controller.get_character("character") self.assertFalse(result)
def test_is_owner_no_char(self): username = "******" character = "character" MockObject = Mock(name="NoChar") from elixir_models import Object MockObject.DoesNotExist = Object.DoesNotExist MockObject.get_objects = Mock(side_effect=Object.DoesNotExist('')) with patch.object(zoneserver, 'Object', MockObject): result = self.character_controller.is_owner(username, character) self.assertEqual(result, None)