# Path: apps/preferences/models.py
# class PreferencesManager(models.Manager):
#     def get_all(self):
#         p = Preferences.objects.all().values('key', 'value')
#         c = {}
#         for item in p:
#             c[item['key']] = item['value']
#         return c
# 
#     def get_contact(self):
#         p = Preferences.objects.filter(key__in=['PHONE', 'EMAIL', 'SKYPE']).values('key', 'value')
#         c = {}
#         for item in p:
#             c[item['key'].lower()] = item['value']
#         return c


from django.test import TestCase
from django.test.client import Client
from apps.preferences.models import PreferencesManager



class PreferencesTestCase(TestCase):
    fixtures = ['preferences.json']

    def setUp(self):
        pass

    def test_api_key_true(self):
        p = PreferencesManager().get_all()
        api_key = p.get('REST_API')
        self.assertEqual(api_key, 'True')

    def test_keys_true(self):

# Path: apps/preferences/models.py
# class PreferencesManager(models.Manager):
#     def get_all(self):
#         p = Preferences.objects.all().values('key', 'value')
#         c = {}
#         for item in p:
#             c[item['key']] = item['value']
#         return c
# 
#     def get_contact(self):
#         p = Preferences.objects.filter(key__in=['PHONE', 'EMAIL', 'SKYPE']).values('key', 'value')
#         c = {}
#         for item in p:
#             c[item['key'].lower()] = item['value']
#         return c


# Path: apps/preferences/tests/test_preferences.py
from django.test import TestCase
from django.test.client import Client
from apps.preferences.models import PreferencesManager




class PreferencesTestCase(TestCase):
    fixtures = ['preferences.json']

    def setUp(self):
        pass

    def test_api_key_true(self):
        p = PreferencesManager().get_all()
        api_key = p.get('REST_API')
        self.assertEqual(api_key, 'True')

    def test_keys_true(self):

        p_keys = PreferencesManager().get_all().keys()