user availability test
This commit is contained in:
parent
1eca11e4a4
commit
a8b10b79a5
2 changed files with 21 additions and 14 deletions
|
|
@ -696,17 +696,26 @@ class ApplicationApiFlowsTests(APITestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
url_promote = reverse('promotions-application:application-user-plan-promote',
|
url_promote = reverse('promotions-application:application-user-plan-promote',
|
||||||
kwargs={"pk": self.first_ad_view_reward_plan.uuid, "user_uuid": '1f9c72e4-3cc3-420d-928b-b0a3d65a4612'})
|
kwargs={"pk": self.first_ad_view_reward_plan.uuid,
|
||||||
|
"user_uuid": '1f9c72e4-3cc3-420d-928b-b0a3d65a4611'})
|
||||||
response = self.client.post(url_promote, event_create_data, HTTP_AUTHORIZATION=auth, format='json')
|
response = self.client.post(url_promote, event_create_data, HTTP_AUTHORIZATION=auth, format='json')
|
||||||
# print(response.json())
|
|
||||||
|
|
||||||
self.first_ad_view_reward_plan.refresh_from_db()
|
|
||||||
self.assertEqual(self.first_ad_view_reward_plan.balance, 10000 - 800)
|
|
||||||
|
|
||||||
# url_get_promotion = reverse('promotions-application:plan-list',
|
|
||||||
# kwargs={"pk": self.first_ad_view_reward_plan.uuid, "user_uuid": self.user_1_uuid})
|
|
||||||
url_get_promotion = reverse('promotions-application:application-user-plan-detail',
|
|
||||||
kwargs={"pk": self.first_ad_view_reward_plan.uuid, "user_uuid": '1f9c72e4-3cc3-420d-928b-b0a3d65a4612'})
|
|
||||||
|
|
||||||
response = self.client.get(url_get_promotion, HTTP_AUTHORIZATION=auth, format='json')
|
|
||||||
print(response.json())
|
print(response.json())
|
||||||
|
|
||||||
|
def test_application_user__user_not_fount__404(self):
|
||||||
|
self.first_ad_view_reward_plan, _created = Plan.objects.get_or_create(
|
||||||
|
title=self.first_ad_view_reward_label,
|
||||||
|
balance=10000,
|
||||||
|
user=self.user_1,
|
||||||
|
application=self.application,
|
||||||
|
event_list=[self.first_ad_view_reward_label]
|
||||||
|
)
|
||||||
|
|
||||||
|
auth = self._create_authorization_header(self.application_access_token.token)
|
||||||
|
event_create_data = {}
|
||||||
|
|
||||||
|
url_promote = reverse('promotions-application:application-user-plan-promote',
|
||||||
|
kwargs={"pk": self.first_ad_view_reward_plan.uuid,
|
||||||
|
"user_uuid": '11111111-1111-1111-1111-111111111111'})
|
||||||
|
response = self.client.post(url_promote, event_create_data, HTTP_AUTHORIZATION=auth, format='json')
|
||||||
|
print(response.json())
|
||||||
|
self.assertEqual(response.status_code, 404)
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@ class ApplicationUserPlanViewSet(
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
application = get_application(self.request)
|
application = get_application(self.request)
|
||||||
# TODO: get user from accounts
|
|
||||||
|
|
||||||
if not self.request.user:
|
if not self.request.user:
|
||||||
user_uuid = self.kwargs.get('user_uuid')
|
user_uuid = self.kwargs.get('user_uuid')
|
||||||
user = User.objects.filter(uuid=user_uuid).first()
|
user = User.objects.filter(uuid=user_uuid).first()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue