def test_get(self): user_res = UserProfileResource() dummy_res = DummyResource(user_res) request = HttpRequest() request.method = "GET" response = dummy_res.get(request, 1) self.assertEqual(200, response.status_code) self.assertEqual(user_res._meta.examples['GET'], json.loads(response.content))
def test_post(self): user_res = UserProfileResource() dummy_res = DummyResource(user_res) request = Dummy() request.method = "POST" request.raw_post_data = json.dumps(user_res._meta.examples['POST']) request.path = "/api/resources/userprofile/" response = dummy_res.post(request) self.assertEqual(201, response.status_code) self.assertEqual("", response.content)
from places.resources import PlaceResource, PointResource, CityResource from places.resources import PlaceFullResource, PointFullResource from prices.resources import PriceResource # =========================== # = Instantiate Api Version = # =========================== api_v1 = Api(api_name='v1') # ======================= # = User / Registration = # ======================= api_v1.register(UserResource()) api_v1.register(ApiKeyResource()) api_v1.register(PasswordResetResource()) api_v1.register(UserProfileResource()) # ========================== # = Event / Recommendation = # ========================== api_v1.register(EventResource(), canonical=True) api_v1.register(EventFullResource()) api_v1.register(FeaturedEventResource()) api_v1.register(OccurrenceResource(), canonical=True) api_v1.register(OccurrenceFullResource()) api_v1.register(EventSummaryResource(), canonical=True) api_v1.register(EventRecommendationResource()) # ========== # = Places = # ==========
from api.resources import LoginResource from api.resources import RatingsResource from api.resources import PageResource from eyebrowse.views import about from eyebrowse.views import faq from eyebrowse.views import tutorial from eyebrowse.views import mft, mft_results_treatment, mft_results_control from eyebrowse.views import api_docs from eyebrowse.views import consent_accept from eyebrowse.views import consent from eyebrowse.views import getting_started v1_api = Api(api_name='v1') v1_api.register(UserResource()) v1_api.register(UserProfileResource()) v1_api.register(WhiteListItemResource()) v1_api.register(BlackListItemResource()) v1_api.register(EyeHistoryResource()) v1_api.register(EyeHistoryMessageResource()) v1_api.register(ChatMessageResource()) v1_api.register(MuteListResource()) v1_api.register(LoginResource()) v1_api.register(RatingsResource()) v1_api.register(PageResource()) # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns(