Пример #1
0
    def test_get_profile_model(self):
        # missing settings attrs
        delattr(settings, 'PROFILE_APP_NAME')
        profile = get_profile_model()
        self.assertIsNone(profile)

        # providing wrong attribute value, an exception is raised
        setattr(settings, 'PROFILE_APP_NAME', 'wrong')
        self.assertRaises(LookupError, get_profile_model)

        # attribute value is None
        setattr(settings, 'PROFILE_APP_NAME', None)
        profile = get_profile_model()
        self.assertIsNone(profile)

        # success
        setattr(settings, 'PROFILE_APP_NAME', 'user_profile')
        profile = get_profile_model()
        self.assertIsNotNone(profile)
Пример #2
0
    def test_get_profile_model(self):
        # missing settings attrs
        delattr(settings, 'PROFILE_APP_NAME')
        profile = get_profile_model()
        self.assertIsNone(profile)

        # wrong attribute value
        setattr(settings, 'PROFILE_APP_NAME', 'wrong')
        profile = get_profile_model()
        self.assertIsNone(profile)

        # attribute value is None
        setattr(settings, 'PROFILE_APP_NAME', None)
        profile = get_profile_model()
        self.assertIsNone(profile)

        # success
        setattr(settings, 'PROFILE_APP_NAME', 'user_profile')
        profile = get_profile_model()
        self.assertIsNotNone(profile)
Пример #3
0
    def tests_success(self):
        profile = get_profile_model()

        self.assertIsNotNone(profile)
Пример #4
0
    def test_setting_attribute_not_set(self):
        profile = get_profile_model()

        self.assertIsNone(profile)