コード例 #1
0
ファイル: test_api.py プロジェクト: bigbeer/Comment
    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)