# Path: tests_app/tests/functional/key_constructor/bits/models.py
# class KeyConstructorUserProperty(models.Model):
#     name = models.CharField(max_length=100)


from django.test import override_settings
from rest_framework.test import APITestCase
from .models import KeyConstructorUserProperty




@override_settings(ROOT_URLCONF='tests_app.tests.functional.key_constructor.bits.urls')
class ListSqlQueryKeyBitTestBehaviour(APITestCase):
    """Regression tests for https://github.com/chibisov/drf-extensions/issues/28#issuecomment-51711927

    `rest_framework.filters.DjangoFilterBackend` uses defalut `FilterSet`.
    When there is no filtered fk in db, then `FilterSet.form` is invalid with errors:
        {'property': [u'Select a valid choice. That choice is not one of the available choices.']}
    In that case `FilterSet.qs` returns `self.queryset.none()`
    """

    def test_with_fk_in_db(self):

# Path: tests_app/tests/functional/key_constructor/bits/models.py
# class KeyConstructorUserProperty(models.Model):
#     name = models.CharField(max_length=100)


# Path: tests_app/tests/functional/key_constructor/bits/tests.py
from django.test import override_settings
from rest_framework.test import APITestCase
from .models import KeyConstructorUserProperty





@override_settings(ROOT_URLCONF='tests_app.tests.functional.key_constructor.bits.urls')
class ListSqlQueryKeyBitTestBehaviour(APITestCase):
    """Regression tests for https://github.com/chibisov/drf-extensions/issues/28#issuecomment-51711927

    `rest_framework.filters.DjangoFilterBackend` uses defalut `FilterSet`.
    When there is no filtered fk in db, then `FilterSet.form` is invalid with errors:
        {'property': [u'Select a valid choice. That choice is not one of the available choices.']}
    In that case `FilterSet.qs` returns `self.queryset.none()`
    """

    def test_with_fk_in_db(self):

        KeyConstructorUserProperty.objects.create(name='some property')