Beispiel #1
0
    def test_clear(self):
        node_settings = GoogleDriveNodeSettingsFactory.build()
        user_settings = GoogleDriveUserSettingsFactory(access_token='abcde')
        node_settings.user_settings = user_settings
        node_settings.save()

        assert_true(user_settings.access_token)
        user_settings.clear()
        user_settings.save()
        assert_false(user_settings.access_token)
Beispiel #2
0
    def test_clear_clears_associated_node_settings(self):
        node_settings = GoogleDriveNodeSettingsFactory.build()
        user_settings = GoogleDriveUserSettingsFactory()
        node_settings.user_settings = user_settings
        node_settings.save()
        user_settings.clear()
        user_settings.save()

        # Node settings no longer associated with user settings
        assert_is(node_settings.folder_id, None)
        assert_is(node_settings.user_settings, None)
Beispiel #3
0
    def test_clear_wo_oauth_settings(self, mock_revoke_access_token):
        user_settings = GoogleDriveUserSettingsFactory(access_token='abcde')
        user_settings.oauth_settings = None
        user_settings.save()
        node_settings = GoogleDriveNodeSettingsFactory.build()
        node_settings.user_settings = user_settings
        node_settings.save()

        assert_false(user_settings.oauth_settings)
        user_settings.clear()
        user_settings.save()

        assert_false(mock_revoke_access_token.called)