How to use client method in pact-foundation-pact

Best JavaScript code snippet using pact-foundation-pact

test_views.py

Source:test_views.py Github

copy

Full Screen

1import datetime2import json3import re4import uuid5from typing import Dict, List6import mock7import pytest8import pytz9from dateutil import parser10from django.contrib.gis.geos import Point11from django.urls import reverse12from django.utils import timezone13from django_dynamic_fixture import G14from freezegun import freeze_time15from push_notifications.models import APNSDevice16from rest_framework import status17from rest_framework.permissions import IsAuthenticated18from api.common.constants import HIGH_LEVEL_API_ERROR_CODES as common_errors19from api.common.permissions import ClientPermission20from api.v1.client.constants import ErrorMessages as client_errors, NEW_YORK_LOCATION21from api.v1.client.serializers import AppointmentValidationMixin22from api.v1.client.urls import urlpatterns23from api.v1.client.views import HistoryView, HomeView, SearchStylistView24from appointment.constants import (25 AppointmentStatus,26 ErrorMessages as appointment_errors,27)28from appointment.models import Appointment29from client.models import Client, PreferredStylist30from client.types import ClientPrivacy31from core.constants import (32 EMAIL_VERIFICATION_FAILIURE_REDIRECT_URL, EMAIL_VERIFICATION_SUCCESS_REDIRECT_URL33)34from integrations.push.types import MobileAppIdType35from notifications.models import Notification36from notifications.types import NotificationCode37from salon.models import (38 Invitation,39 Salon,40 Stylist,41 StylistAvailableWeekDay,42 StylistService,43 StylistWeekdayDiscount,44 Weekday,45)46from salon.tests.test_models import stylist_appointments_data47from salon.types import ClientPriceOnDate, InvitationStatus48from salon.utils import generate_client_prices_for_stylist_services49class TestClientProfileView:50 @pytest.mark.django_db51 def test_submit_profile(self, client, authorized_client_user, mocker, mailoutbox):52 slack_mock = mocker.patch('api.v1.client.serializers.send_slack_client_profile_update')53 user, auth_token = authorized_client_user54 data = {55 'phone': user.phone,56 'first_name': 'Tom',57 'last_name': 'Cruise',58 "email": 'test@example.com',59 'has_seen_educational_screens': True60 }61 profile_url = reverse('api:v1:client:client-profile')62 response = client.post(profile_url, data=data, HTTP_AUTHORIZATION=auth_token)63 assert (response.status_code == status.HTTP_200_OK)64 data = response.data65 assert (data['first_name'] == 'Tom')66 assert (data['last_name'] == 'Cruise')67 user.refresh_from_db()68 assert(user.client is not None)69 slack_mock.assert_called_once_with(user.client)70 assert (user.client.has_seen_educational_screens is True)71 assert len(mailoutbox) == 172 @pytest.mark.django_db73 def test_update_profile(self, client, authorized_client_user, mocker, mailoutbox):74 slack_mock = mocker.patch('api.v1.client.serializers.send_slack_client_profile_update')75 user, auth_token = authorized_client_user76 data = {77 'first_name': 'Tom',78 'last_name': 'Cruise',79 'email': 'test@example.com'80 }81 profile_url = reverse('api:v1:client:client-profile')82 response = client.post(profile_url, data=data, HTTP_AUTHORIZATION=auth_token)83 assert (response.status_code == status.HTTP_200_OK)84 data = response.data85 assert (data['first_name'] == 'Tom')86 assert (data['last_name'] == 'Cruise')87 updated_data = {88 'first_name': 'Tommy',89 'has_seen_educational_screens': True90 }91 user.refresh_from_db()92 assert (user.client is not None)93 slack_mock.assert_called_once_with(user.client)94 slack_mock.reset_mock()95 response = client.patch(profile_url, data=json.dumps(updated_data),96 HTTP_AUTHORIZATION=auth_token,97 content_type='application/json')98 assert (response.status_code == status.HTTP_200_OK)99 data = response.data100 assert (data['first_name'] == 'Tommy')101 assert (data['last_name'] == 'Cruise')102 assert (float(data['profile_completeness']) == 0.6)103 user.refresh_from_db()104 slack_mock.assert_called_once_with(user.client)105 assert(user.client.has_seen_educational_screens is True)106 assert len(mailoutbox) == 1107 @pytest.mark.django_db108 def test_client_email_verification(self, client, authorized_client_user, mocker, mailoutbox):109 # test for email verification success110 with freeze_time(pytz.UTC.localize(datetime.datetime(2018, 1, 7, 18, 30))):111 user, auth_header = authorized_client_user112 mocker.patch('api.v1.client.serializers.send_slack_client_profile_update')113 G(Stylist, user=user)114 profile_url = reverse('api:v1:client:client-profile')115 client.patch(profile_url, data={116 'email': 'test@test.com'117 }, HTTP_AUTHORIZATION=auth_header, content_type='application/json')118 assert len(mailoutbox) == 1119 message_body = mailoutbox[0].body120 verification_url = re.findall(121 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',122 message_body)[0]123 verification_response = client.get(verification_url)124 assert (verification_response.status_code == 302)125 assert (verification_response.url == EMAIL_VERIFICATION_SUCCESS_REDIRECT_URL)126 # Should fail if already verified127 verification_response = client.get(verification_url)128 assert (verification_response.status_code == 302)129 assert (verification_response.url == EMAIL_VERIFICATION_FAILIURE_REDIRECT_URL)130 # Should expire if verified after 72 hours131 client.patch(profile_url, data={132 'email': 'test2@test.com'133 }, HTTP_AUTHORIZATION=auth_header, content_type='application/json')134 assert len(mailoutbox) == 2135 message_body = mailoutbox[1].body136 verification_url = re.findall(137 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',138 message_body)[0]139 with freeze_time(pytz.UTC.localize(datetime.datetime(2018, 1, 11, 18, 30))):140 verification_response = client.get(verification_url)141 assert (verification_response.status_code == 302)142 assert (verification_response.url == EMAIL_VERIFICATION_FAILIURE_REDIRECT_URL)143 @pytest.mark.django_db144 def test_view_permissions(145 self, client, authorized_stylist_user, authorized_client_user146 ):147 user, token = authorized_stylist_user148 data = {149 'first_name': 'Tom',150 'last_name': 'Cruise',151 'email': 'test@example.com'152 }153 profile_url = reverse('api:v1:client:client-profile')154 response = client.post(profile_url, data=data, HTTP_AUTHORIZATION=token)155 assert(response.status_code == status.HTTP_403_FORBIDDEN)156 user, token = authorized_client_user157 data = {158 'first_name': 'Tom',159 'last_name': 'Cruise',160 'email': 'test@example.com'161 }162 profile_url = reverse('api:v1:client:client-profile')163 response = client.post(profile_url, data=data, HTTP_AUTHORIZATION=token)164 assert(status.is_success(response.status_code))165class TestPreferredStylistListCreateView(object):166 @pytest.mark.django_db167 def test_add_preferred_stylists(168 self, client, stylist_data: Stylist, authorized_client_user169 ):170 user, auth_token = authorized_client_user171 data = {172 'stylist_uuid': stylist_data.uuid173 }174 preferred_stylist_url = reverse('api:v1:client:preferred-stylist')175 response = client.post(preferred_stylist_url, data=data, HTTP_AUTHORIZATION=auth_token)176 assert (response.status_code == status.HTTP_201_CREATED)177 response_data = response.data178 assert (response_data['preference_uuid'] is not None)179 response = client.post(preferred_stylist_url, data=data, HTTP_AUTHORIZATION=auth_token)180 assert (response.status_code == status.HTTP_400_BAD_REQUEST)181 response = client.get(preferred_stylist_url, HTTP_AUTHORIZATION=auth_token)182 assert (response.status_code == status.HTTP_200_OK)183 data = response.data184 assert (len(data['stylists']) == 1)185 assert (data['stylists'][0]['uuid'] == str(stylist_data.uuid))186 @pytest.mark.django_db187 def test_list_preferred_stylists(188 self, client, authorized_client_user189 ):190 user, auth_token = authorized_client_user191 client_obj = user.client192 other_client = G(Client)193 our_stylist = G(Stylist)194 foreign_stylist = G(Stylist)195 G(PreferredStylist, client=client_obj, stylist=our_stylist)196 G(PreferredStylist, client=other_client, stylist=foreign_stylist)197 preferred_stylists_url = reverse('api:v1:client:preferred-stylist')198 response = client.get(preferred_stylists_url, HTTP_AUTHORIZATION=auth_token)199 assert(status.is_success(response.status_code))200 assert (201 frozenset([str(c['uuid']) for c in response.data['stylists']]) ==202 frozenset([str(our_stylist.uuid), ])203 )204 @pytest.mark.django_db205 def test_view_permissions(self, client, authorized_stylist_user):206 user, auth_token = authorized_stylist_user207 preferred_stylists_url = reverse('api:v1:client:preferred-stylist')208 response = client.get(preferred_stylists_url, HTTP_AUTHORIZATION=auth_token)209 assert(response.status_code == status.HTTP_403_FORBIDDEN)210 response = client.post(preferred_stylists_url, HTTP_AUTHORIZATION=auth_token)211 assert (response.status_code == status.HTTP_403_FORBIDDEN)212class TestPreferredStylistDeleteView(object):213 @pytest.mark.django_db214 def test_delete_preferred_stylist(215 self, client, stylist_data: Stylist, authorized_client_user216 ):217 user, auth_token = authorized_client_user218 data = {219 'stylist_uuid': stylist_data.uuid220 }221 preferred_stylist_url = reverse('api:v1:client:preferred-stylist')222 response = client.post(preferred_stylist_url, data=data, HTTP_AUTHORIZATION=auth_token)223 assert (response.status_code == status.HTTP_201_CREATED)224 response_data = response.data225 assert (response_data['preference_uuid'] is not None)226 delete_preferred_stylist_url = reverse('api:v1:client:preferred-stylist-delete', kwargs={227 'uuid': response_data['preference_uuid']228 })229 response = client.delete(delete_preferred_stylist_url, HTTP_AUTHORIZATION=auth_token)230 assert (response.status_code == status.HTTP_204_NO_CONTENT)231 response = client.get(preferred_stylist_url, HTTP_AUTHORIZATION=auth_token)232 assert (response.status_code == status.HTTP_200_OK)233 data = response.data234 assert (len(data['stylists']) == 0)235 @pytest.mark.django_db236 def test_view_permissions(self, client, authorized_client_user, authorized_stylist_user):237 user, auth_token = authorized_client_user238 client_obj = user.client239 other_client = G(Client)240 our_stylist = G(Stylist)241 foreign_stylist = G(Stylist)242 our_preference = G(PreferredStylist, client=client_obj, stylist=our_stylist)243 foreign_preference = G(PreferredStylist, client=other_client, stylist=foreign_stylist)244 # try deleting others' preferred stylist245 delete_preferred_stylist_url = reverse('api:v1:client:preferred-stylist-delete', kwargs={246 'uuid': foreign_preference.uuid247 })248 response = client.delete(delete_preferred_stylist_url, HTTP_AUTHORIZATION=auth_token)249 assert (response.status_code == status.HTTP_404_NOT_FOUND)250 delete_preferred_stylist_url = reverse('api:v1:client:preferred-stylist-delete', kwargs={251 'uuid': our_preference.uuid252 })253 # try without client permission254 user, auth_token = authorized_stylist_user255 response = client.delete(delete_preferred_stylist_url, HTTP_AUTHORIZATION=auth_token)256 assert (response.status_code == status.HTTP_403_FORBIDDEN)257 # ensure positive path258 user, auth_token = authorized_client_user259 response = client.delete(delete_preferred_stylist_url, HTTP_AUTHORIZATION=auth_token)260 assert (status.is_success(response.status_code))261class TestSearchStylistView(object):262 @pytest.mark.django_db263 def test_search_stylists(self, client, stylist_data: Stylist):264 location = stylist_data.salon.location265 G(Salon, location=location)266 stylist_data_2 = G(Stylist)267 client_data = G(Client)268 results = SearchStylistView._search_stylists(269 '', '', location=location, country='US', client_id=client_data.id)270 assert (len(results) == 1)271 results = SearchStylistView._search_stylists(272 'Fred', 'los altos', location=location, country='US', client_id=client_data.id)273 assert (len(results) == 1)274 assert (results[0] == stylist_data)275 assert (results[0].preference_uuid is None)276 preference = G(PreferredStylist, client=client_data, stylist=stylist_data)277 results = SearchStylistView._search_stylists(278 'mcbob fr', 'rilma', location=location, country='US', client_id=client_data.id)279 assert (len(results) == 1)280 assert (results[0] == stylist_data)281 assert (results[0].preference_uuid == preference.uuid)282 results = SearchStylistView._search_stylists(283 'mcbob fr', 'junk-address', location=location, country='US', client_id=client_data.id)284 assert (len(results) == 0)285 salon = stylist_data_2.salon286 salon.location = location287 salon.country = 'US'288 salon.save()289 results = SearchStylistView._search_stylists(290 stylist_data_2.get_full_name(), '', location=location,291 country='US', client_id=client_data.id)292 assert (len(results) == 1)293 assert (results[0] == stylist_data_2)294 results = SearchStylistView._search_stylists(295 'some-junk-text', '', location=location, country='US', client_id=client_data.id)296 assert (len(results) == 0)297 # Test with deactivated stylist298 stylist_data.deactivated_at = timezone.now()299 stylist_data.save()300 results = SearchStylistView._search_stylists(301 'Fred', 'los altos', location=location, country='US', client_id=client_data.id)302 assert (len(results) == 0)303 @pytest.mark.django_db304 def test_search_stylists_when_no_results(self, stylist_data: Stylist):305 salon_2 = G(Salon, location=NEW_YORK_LOCATION, country='CA')306 G(Stylist, salon=salon_2)307 client_data = G(Client)308 location = Point(77.303474, 11.1503445, srid=4326)309 results = SearchStylistView._search_stylists(310 '', '', location=location, country='US', client_id=client_data.id)311 assert (len(results) == 1)312 assert results[0] == stylist_data313 @pytest.mark.django_db314 def test_view_permissions(self, client, authorized_stylist_user):315 user, auth_token = authorized_stylist_user316 stylist_search_url = reverse('api:v1:client:search-stylist')317 response = client.post(318 stylist_search_url,319 data={}, HTTP_AUTHORIZATION=auth_token)320 assert (response.status_code == status.HTTP_403_FORBIDDEN)321class TestStylistServicesView(object):322 @pytest.mark.django_db323 def test_view_permissions(324 self, client, authorized_stylist_user, authorized_client_user325 ):326 stylist = G(Stylist)327 user, auth_token = authorized_client_user328 stylist_service_url = reverse('api:v1:client:stylist-services', kwargs={329 'uuid': stylist.uuid330 })331 response = client.get(332 stylist_service_url,333 data={}, HTTP_AUTHORIZATION=auth_token)334 assert (status.is_success(response.status_code))335 # Test with deactivated stylist336 stylist.deactivated_at = timezone.now()337 stylist.save()338 response = client.get(339 stylist_service_url,340 data={}, HTTP_AUTHORIZATION=auth_token)341 assert (status.is_client_error(response.status_code))342class TestStylistServicePriceView(object):343 @pytest.mark.django_db344 def test_view_permissions(self, client, authorized_stylist_user, authorized_client_user):345 our_stylist = G(Stylist)346 foreign_stylist = G(Stylist)347 user, auth_token = authorized_client_user348 client_obj = user.client349 G(PreferredStylist, client=client_obj, stylist=our_stylist)350 our_service = G(StylistService, stylist=our_stylist, duration=datetime.timedelta(0))351 foreign_service = G(352 StylistService, stylist=foreign_stylist, duration=datetime.timedelta(0)353 )354 client_service_pricing_url = reverse('api:v1:client:services-pricing')355 response = client.post(356 client_service_pricing_url,357 data={358 'service_uuids': [our_service.uuid]359 }, HTTP_AUTHORIZATION=auth_token)360 assert (status.is_success(response.status_code))361 response = client.post(362 client_service_pricing_url,363 data={364 'stylist_uuid': foreign_stylist.uuid365 }, HTTP_AUTHORIZATION=auth_token)366 assert (status.is_success(response.status_code))367 assert (response.data['service_uuids'][0] == str(foreign_service.uuid))368 user, stylist_auth_token = authorized_stylist_user369 response = client.post(370 client_service_pricing_url,371 data={372 'service_uuid': our_service.uuid373 }, HTTP_AUTHORIZATION=stylist_auth_token)374 assert (response.status_code == status.HTTP_403_FORBIDDEN)375 # Test with deactivated stylist376 our_stylist.deactivated_at = timezone.now()377 our_stylist.save()378 response = client.post(379 client_service_pricing_url,380 data={381 'service_uuids': [our_service.uuid]382 }, HTTP_AUTHORIZATION=auth_token)383 assert (response.status_code == status.HTTP_400_BAD_REQUEST)384 @pytest.mark.django_db385 def test_prices(self, client, authorized_client_user):386 salon: Salon = G(Salon, timezone=pytz.UTC)387 our_stylist = G(388 Stylist, salon=salon,389 first_time_book_discount_percent=10,390 )391 G(StylistWeekdayDiscount, weekday=Weekday.THURSDAY,392 discount_percent=40, stylist=our_stylist)393 for weekday in range(1, 8):394 G(395 StylistAvailableWeekDay, stylist=our_stylist, weekday=weekday,396 work_start_at=datetime.time(8, 0), work_end_at=datetime.time(18, 0),397 is_available=True)398 user, auth_token = authorized_client_user399 client_obj = user.client400 G(PreferredStylist, client=client_obj, stylist=our_stylist)401 service: StylistService = G(402 StylistService, stylist=our_stylist, duration=datetime.timedelta(0),403 regular_price=50404 )405 with freeze_time(pytz.UTC.localize(datetime.datetime(2018, 1, 7, 18, 30))):406 expected_prices: List[ClientPriceOnDate] = generate_client_prices_for_stylist_services(407 stylist=our_stylist, services=[service], client=client_obj,408 )409 client_service_pricing_url = reverse('api:v1:client:services-pricing')410 response = client.post(411 client_service_pricing_url,412 data={413 'stylist_uuid': our_stylist.uuid,414 'service_uuids': [str(service.uuid)]415 }, HTTP_AUTHORIZATION=auth_token416 )417 assert(status.is_success(response.status_code))418 prices = response.data['prices']419 assert(len(expected_prices) == len(prices))420 for idx, price_item in enumerate(prices):421 assert(expected_prices[idx].date.isoformat() == price_item['date'])422 assert(expected_prices[idx].price == price_item['price'])423class TestAppointmentListCreateAPIView(object):424 @pytest.mark.django_db425 @mock.patch.object(426 AppointmentValidationMixin, 'validate_datetime_start_at', lambda s, a: a)427 @mock.patch.object(428 AppointmentValidationMixin, 'validate_services', lambda s, a: a)429 def test_view_permissions(self, client, authorized_client_user, authorized_stylist_user):430 user, auth_token = authorized_client_user431 client_obj = user.client432 appointments_url = reverse('api:v1:client:appointments')433 stylist = G(Stylist)434 # test create with non-preferred user435 data = {436 'stylist_uuid': stylist.uuid,437 'datetime_start_at': datetime.datetime(2018, 1, 1, 0, 0, 0),438 'services': []439 }440 response = client.post(441 appointments_url,442 data=data, HTTP_AUTHORIZATION=auth_token443 )444 assert(response.status_code == status.HTTP_400_BAD_REQUEST)445 assert(446 {'code': appointment_errors.ERR_NOT_A_PREFERRED_STYLIST} in447 response.data['field_errors']['stylist_uuid']448 )449 user, auth_token = authorized_stylist_user450 response = client.post(451 appointments_url,452 data=data, HTTP_AUTHORIZATION=auth_token453 )454 assert (response.status_code == status.HTTP_403_FORBIDDEN)455 # test list others' appointments456 user, auth_token = authorized_client_user457 foreign_client = G(Client)458 our_appointment = G(459 Appointment,460 client=client_obj,461 created_by=user462 )463 G(Appointment, client=foreign_client, created_by=user)464 response = client.get(465 appointments_url, HTTP_AUTHORIZATION=auth_token466 )467 assert(frozenset([a['uuid'] for a in response.data]) == frozenset([468 str(our_appointment.uuid)469 ]))470 user, auth_token = authorized_stylist_user471 response = client.get(472 appointments_url, HTTP_AUTHORIZATION=auth_token473 )474 assert (response.status_code == status.HTTP_403_FORBIDDEN)475 @pytest.mark.django_db476 @mock.patch.object(477 AppointmentValidationMixin, 'validate_datetime_start_at', lambda s, a: a)478 @mock.patch.object(479 AppointmentValidationMixin, 'validate_services', lambda s, a: a)480 def test_create(self, client, authorized_client_user, authorized_stylist_user):481 user, auth_token = authorized_client_user482 client_obj: Client = user.client483 stylist_user, _ = authorized_stylist_user484 G(APNSDevice, user=stylist_user, application_id=MobileAppIdType.IOS_STYLIST_DEV)485 salon: Salon = G(Salon, timezone=pytz.UTC)486 stylist: Stylist = stylist_user.stylist487 stylist.google_access_token = 'token'488 stylist.google_refresh_token = 'token'489 stylist.salon = salon490 stylist.save()491 G(PreferredStylist, stylist=stylist, client=client_obj)492 service_1: StylistService = G(StylistService, stylist=stylist)493 service_2: StylistService = G(StylistService, stylist=stylist)494 data = {495 'stylist_uuid': stylist.uuid,496 'datetime_start_at': datetime.datetime(2018, 1, 1, 0, 0, 0),497 'services': [service_1.uuid, service_2.uuid]498 }499 appointments_url = reverse('api:v1:client:appointments')500 response = client.post(501 appointments_url,502 data=data, HTTP_AUTHORIZATION=auth_token503 )504 assert (status.is_success(response.status_code))505 appointment = Appointment.objects.last()506 assert(appointment is not None)507 notification: Notification = Notification.objects.last()508 assert(notification is not None)509 assert(appointment.stylist_new_appointment_notification == notification)510 assert(notification.user == stylist.user)511class TestAppointmentRetriveUpdateView(object):512 @pytest.mark.django_db513 @mock.patch.object(514 AppointmentValidationMixin, 'validate_datetime_start_at', lambda s, a: a)515 @mock.patch.object(516 AppointmentValidationMixin, 'validate_services', lambda s, a: a)517 def test_view_permissions(518 self, client, authorized_client_user, authorized_stylist_user519 ):520 user, auth_token = authorized_client_user521 client_obj = user.client522 stylist = G(Stylist)523 foreign_client = G(Client)524 our_appointment = G(525 Appointment,526 client=client_obj,527 datetime_start_at=datetime.datetime(2018, 1, 1, 0, 0, tzinfo=pytz.UTC),528 stylist=stylist529 )530 foreign_appointment = G(531 Appointment,532 client=foreign_client,533 datetime_start_at=datetime.datetime(2018, 1, 1, 0, 0, tzinfo=pytz.UTC),534 stylist=stylist535 )536 # test retrieve537 appointment_url = reverse(538 'api:v1:client:appointment', kwargs={'uuid': foreign_appointment.uuid}539 )540 response = client.get(appointment_url, HTTP_AUTHORIZATION=auth_token)541 assert(response.status_code == status.HTTP_404_NOT_FOUND)542 appointment_url = reverse(543 'api:v1:client:appointment', kwargs={'uuid': our_appointment.uuid}544 )545 response = client.get(appointment_url, HTTP_AUTHORIZATION=auth_token)546 assert (status.is_success(response.status_code))547 # test update548 data = {'status': AppointmentStatus.CANCELLED_BY_CLIENT}549 appointment_url = reverse(550 'api:v1:client:appointment', kwargs={'uuid': foreign_appointment.uuid}551 )552 response = client.post(553 appointment_url, data=data, HTTP_AUTHORIZATION=auth_token)554 assert (response.status_code == status.HTTP_404_NOT_FOUND)555 appointment_url = reverse(556 'api:v1:client:appointment', kwargs={'uuid': our_appointment.uuid}557 )558 response = client.post(559 appointment_url, data=data, HTTP_AUTHORIZATION=auth_token,560 )561 assert (status.is_success(response.status_code))562 @pytest.mark.django_db563 @mock.patch.object(564 AppointmentValidationMixin, 'validate_datetime_start_at', lambda s, a: a)565 @mock.patch.object(566 AppointmentValidationMixin, 'validate_services', lambda s, a: a)567 def test_cancel(self, client, authorized_client_user):568 stylist: Stylist = G(Stylist)569 user, auth_token = authorized_client_user570 client_obj: Client = user.client571 G(APNSDevice, user=stylist.user, application_id=MobileAppIdType.IOS_STYLIST_DEV)572 new_appt_notification = G(573 Notification, code=NotificationCode.NEW_APPOINTMENT,574 user=stylist.user575 )576 appointment: Appointment = G(577 Appointment, client=client_obj, stylist=stylist,578 stylist_new_appointment_notification=new_appt_notification,579 created_by=client_obj.user580 )581 appointment_url = reverse(582 'api:v1:client:appointment', kwargs={'uuid': appointment.uuid}583 )584 data = {'status': AppointmentStatus.CANCELLED_BY_CLIENT}585 response = client.post(586 appointment_url, data=data, HTTP_AUTHORIZATION=auth_token,587 )588 assert (status.is_success(response.status_code))589 appointment.refresh_from_db()590 assert(appointment.stylist_new_appointment_notification is None)591 assert (Notification.objects.count() == 1)592 assert(Notification.objects.exclude(593 code=NotificationCode.CLIENT_CANCELLED_APPOINTMENT).count() == 0)594class TestAvailableTimeSlotView(object):595 @pytest.mark.django_db596 @freeze_time('2018-05-14 13:30:00 UTC')597 def test_view_permissions(598 self, client, authorized_client_user, stylist_data599 ):600 user, auth_token = authorized_client_user601 client_obj = user.client602 other_client = G(Client)603 our_stylist = stylist_data604 salon = G(Salon, timezone=pytz.utc)605 foreign_stylist = G(Stylist, salon=salon)606 G(PreferredStylist, client=client_obj, stylist=our_stylist)607 G(PreferredStylist, client=other_client, stylist=foreign_stylist)608 date = datetime.datetime.now().date()609 availability_url = reverse(610 'api:v1:client:available-times'611 )612 stylist_appointments_data(our_stylist)613 our_stylist.available_days.filter(weekday=date.isoweekday()).update(614 work_start_at="09:00", work_end_at="18:00", is_available=True)615 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={616 "date": "2018-05-14",617 "stylist_uuid": our_stylist.uuid})618 assert (status.is_success(response.status_code))619 start_times = [slot['start'] for slot in response.data['time_slots']]620 # assert all the returned slots are future slots621 assert all(parser.parse(date) > timezone.now() for date in start_times)622 stylist_appointments_data(foreign_stylist)623 foreign_stylist.available_days.filter(weekday=date.isoweekday()).update(624 work_start_at="09:00", work_end_at="18:00", is_available=True)625 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={626 "date": "2018-05-14",627 "stylist_uuid": foreign_stylist.uuid})628 assert (response.status_code == status.HTTP_404_NOT_FOUND)629 # Test with deactivated stylist630 our_stylist.deactivated_at = timezone.now()631 our_stylist.save()632 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={633 "date": "2018-05-14",634 "stylist_uuid": our_stylist.uuid})635 assert (status.is_client_error(response.status_code))636 @pytest.mark.django_db637 @freeze_time('2018-05-14 22:30:00 UTC')638 def test_after_stylist_eod(639 self, client, authorized_client_user, stylist_data640 ):641 user, auth_token = authorized_client_user642 client_obj = user.client643 other_client = G(Client)644 our_stylist = stylist_data645 salon = G(Salon, timezone=pytz.utc)646 foreign_stylist = G(Stylist, salon=salon)647 G(PreferredStylist, client=client_obj, stylist=our_stylist)648 G(PreferredStylist, client=other_client, stylist=foreign_stylist)649 availability_url = reverse(650 'api:v1:client:available-times'651 )652 stylist_appointments_data(our_stylist)653 date = datetime.date(2018, 5, 13)654 our_stylist.available_days.filter(weekday=date.isoweekday()).update(655 work_start_at="09:00", work_end_at="18:00", is_available=True)656 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={657 "date": "2018-05-13",658 "stylist_uuid": our_stylist.uuid})659 # Return empty for past dates660 assert len(response.data['time_slots']) == 0661 date = datetime.date(2018, 5, 14)662 our_stylist.available_days.filter(weekday=date.isoweekday()).update(663 work_start_at="09:00", work_end_at="18:00", is_available=True)664 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={665 "date": "2018-05-14",666 "stylist_uuid": our_stylist.uuid})667 # Return empty if time is past stylist end of day668 assert len(response.data['time_slots']) == 0669 date = datetime.date(2018, 5, 15)670 our_stylist.available_days.filter(weekday=date.isoweekday()).update(671 work_start_at="09:00", work_end_at="18:00", is_available=True)672 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={673 "date": "2018-05-15",674 "stylist_uuid": our_stylist.uuid})675 # Return actual slots for tomorrow's date676 assert len(response.data['time_slots']) > 0677 date = datetime.date(2018, 5, 16)678 our_stylist.available_days.filter(weekday=date.isoweekday()).update(679 work_start_at="09:00", work_end_at="11:01", is_available=True)680 response = client.post(availability_url, HTTP_AUTHORIZATION=auth_token, data={681 "date": "2018-05-16",682 "stylist_uuid": our_stylist.uuid})683 assert len(response.data['time_slots']) == 4684 service = our_stylist.services.first()685 data = {686 'stylist_uuid': str(our_stylist.uuid),687 'datetime_start_at': '2018-05-16T11:00:00+00:00',688 'services': [689 {'service_uuid': str(service.uuid)}690 ]691 }692 appointments_url = reverse(693 'api:v1:client:appointments'694 )695 response = client.post(appointments_url, HTTP_AUTHORIZATION=auth_token,696 data=json.dumps(data), content_type='application/json')697 assert (status.is_success(response.status_code))698class TestClientViewPermissions(object):699 def test_view_permissions(self):700 """Go over all configured urls an make sure they have necessary permissions"""701 for url_resolver in urlpatterns:702 view_class = url_resolver.callback.view_class703 assert (704 frozenset(view_class.permission_classes) == frozenset([705 ClientPermission, IsAuthenticated706 ])707 )708class TestHomeAPIView(object):709 @freeze_time('2018-05-14 14:10:00 UTC')710 def test_get_upcoming_appointments(self, stylist_data, client_data):711 client: Client = client_data712 G(PreferredStylist, client=client, stylist=stylist_data)713 appointments: Dict[str, Appointment] = stylist_appointments_data(stylist_data)714 appointments['past_appointment'].set_status(715 AppointmentStatus.CHECKED_OUT, updated_by=stylist_data.user)716 appointments['future_appointment'].set_status(717 AppointmentStatus.CHECKED_OUT, updated_by=stylist_data.user)718 for a in appointments.values():719 a.client = client720 a.save(update_fields=['client', ])721 upcoming_appointments = HomeView.get_upcoming_appointments(client)722 assert (upcoming_appointments.count() == 4)723 # Test with deactivated stylist724 stylist_data.deactivated_at = timezone.now()725 stylist_data.save()726 upcoming_appointments = HomeView.get_upcoming_appointments(client)727 assert (upcoming_appointments.count() == 0)728 @freeze_time('2018-05-14 13:00:00 UTC')729 def test_get_preferred_stylist(self, stylist_data, client_data):730 client: Client = client_data731 G(PreferredStylist, client=client, stylist=stylist_data)732 stylist_2 = G(Stylist)733 user = stylist_2.user734 user.photo = ''735 user.phone = '+19876543210'736 user.save()737 G(PreferredStylist, client=client, stylist=stylist_2)738 stylist_3 = G(Stylist)739 user = stylist_3.user740 user.phone = ''741 user.save()742 G(PreferredStylist, client=client, stylist=stylist_3)743 preferred_stylists = HomeView.get_preferred_stylists(client)744 assert (preferred_stylists.count() == 3)745 @freeze_time('2018-05-14 13:00:00 UTC')746 def test_get_last_visit(self, stylist_data, client_data):747 client: Client = client_data748 G(PreferredStylist, client=client, stylist=stylist_data)749 appointments: Dict[str, Appointment] = stylist_appointments_data(stylist_data)750 appointments['last_week_appointment'].set_status(751 AppointmentStatus.CHECKED_OUT, updated_by=stylist_data.user)752 for a in appointments.values():753 a.client = client754 a.save(update_fields=['client', ])755 last_appointment = HomeView.get_last_visited_object(client)756 assert (last_appointment == appointments['last_week_appointment'])757class TestHistoryAPIView(object):758 @freeze_time('2018-05-14 14:00:00 UTC')759 def test_historical_appointments(self, stylist_data, client_data):760 client: Client = client_data761 G(PreferredStylist, client=client, stylist=stylist_data)762 appointments: Dict[str, Appointment] = stylist_appointments_data(stylist_data)763 appointments['current_appointment'].set_status(status=AppointmentStatus.CHECKED_OUT,764 updated_by=client.user)765 for a in appointments.values():766 a.client = client767 a.save(update_fields=['client', ])768 past_appointments = HistoryView.get_historical_appointments(client)769 assert (past_appointments.count() == 2)770 # Test with deactivated stylist771 stylist_data.deactivated_at = timezone.now()772 stylist_data.save()773 past_appointments = HistoryView.get_historical_appointments(client)774 assert (past_appointments.count() == 0)775class TestStylistFollowersView(object):776 @pytest.mark.django_db777 def test_stylist_validation(self, client, authorized_client_user):778 """Verify that non-preferred or missing stylist raise 404"""779 user, auth_token = authorized_client_user780 client_obj: Client = user.client781 url = reverse('api:v1:client:stylist-followers', kwargs={'stylist_uuid': uuid.uuid4()})782 response = client.get(url, HTTP_AUTHORIZATION=auth_token)783 assert(response.status_code == status.HTTP_404_NOT_FOUND)784 assert({'code': appointment_errors.ERR_STYLIST_DOES_NOT_EXIST} in785 response.data['non_field_errors']786 )787 assert(response.data['code'] == common_errors[404])788 foreign_stylist = G(Stylist)789 url = reverse(790 'api:v1:client:stylist-followers', kwargs={'stylist_uuid': foreign_stylist.uuid}791 )792 response = client.get(url, HTTP_AUTHORIZATION=auth_token)793 assert (status.is_success(response.status_code))794 G(PreferredStylist, stylist=foreign_stylist, client=client_obj)795 response = client.get(url, HTTP_AUTHORIZATION=auth_token)796 assert(status.is_success(response.status_code))797 @pytest.mark.django_db798 def test_privacy_setting(self, client, authorized_client_user):799 """Verify that if current client has private setting, 400 is returned"""800 user, auth_token = authorized_client_user801 client_obj: Client = user.client802 client_obj.privacy = ClientPrivacy.PRIVATE803 client_obj.save(update_fields=['privacy', ])804 stylist: Stylist = G(Stylist)805 G(PreferredStylist, stylist=stylist, client=client_obj)806 url = reverse('api:v1:client:stylist-followers', kwargs={'stylist_uuid': stylist.uuid})807 response = client.get(url, HTTP_AUTHORIZATION=auth_token)808 assert (response.status_code == status.HTTP_400_BAD_REQUEST)809 assert (response.data['code'] == common_errors[400])810 assert ({'code': client_errors.ERR_PRIVACY_SETTING_PRIVATE} in811 response.data['non_field_errors']812 )813 @pytest.mark.django_db814 def test_output(self, client, authorized_client_user):815 user, auth_token = authorized_client_user816 client_obj: Client = user.client817 stylist: Stylist = G(Stylist)818 G(PreferredStylist, stylist=stylist, client=client_obj)819 client_with_privacy = G(Client, privacy=ClientPrivacy.PRIVATE)820 G(PreferredStylist, stylist=stylist, client=client_with_privacy)821 G(822 Appointment, status=AppointmentStatus.CHECKED_OUT,823 client=client_with_privacy, stylist=stylist824 )825 client_with_cancelled_appointment = G(Client)826 G(PreferredStylist, stylist=stylist, client=client_with_cancelled_appointment)827 G(828 Appointment, status=AppointmentStatus.CANCELLED_BY_CLIENT,829 client=client_with_cancelled_appointment, stylist=stylist830 )831 client_with_successful_appointment = G(Client)832 G(PreferredStylist, stylist=stylist, client=client_with_successful_appointment)833 G(834 Appointment, status=AppointmentStatus.CHECKED_OUT,835 client=client_with_successful_appointment, stylist=stylist836 )837 client_with_new_appointment = G(Client)838 G(PreferredStylist, stylist=stylist, client=client_with_new_appointment)839 G(840 Appointment, status=AppointmentStatus.NEW,841 client=client_with_new_appointment, stylist=stylist842 )843 client_without_appointments = G(Client)844 G(PreferredStylist, stylist=stylist, client=client_without_appointments)845 url = reverse('api:v1:client:stylist-followers', kwargs={'stylist_uuid': stylist.uuid})846 response = client.get(url, HTTP_AUTHORIZATION=auth_token)847 assert(status.is_success(response.status_code))848 assert(frozenset([r['uuid'] for r in response.data['followers']]) == frozenset([849 str(client_with_successful_appointment.uuid),850 str(client_with_new_appointment.uuid),851 str(client_with_cancelled_appointment.uuid),852 str(client_without_appointments.uuid),853 str(client_obj.uuid)854 ]))855 appt_count = {u['uuid']: u['booking_count'] for u in response.data['followers']}856 assert(appt_count[str(client_with_successful_appointment.uuid)] == 1)857 assert(appt_count[str(client_with_new_appointment.uuid)] == 1)858 assert(appt_count[str(client_with_cancelled_appointment.uuid)] == 0)859 assert(appt_count[str(client_without_appointments.uuid)] == 0)860 @pytest.mark.django_db861 def test_sorted_output(self, client, authorized_client_user):862 user, auth_token = authorized_client_user863 stylist: Stylist = G(Stylist)864 client_with_privacy = G(Client, privacy=ClientPrivacy.PRIVATE)865 G(PreferredStylist, stylist=stylist, client=client_with_privacy)866 client_with_name_and_photo = G(Client)867 G(PreferredStylist, stylist=stylist, client=client_with_name_and_photo)868 client_without_name_or_photo = G(Client)869 G(PreferredStylist, stylist=stylist, client=client_without_name_or_photo)870 client_without_name_or_photo.user.first_name = ""871 client_without_name_or_photo.user.last_name = ""872 client_without_name_or_photo.user.photo = None873 client_without_name_or_photo.user.save()874 client_with_name_without_photo = G(Client)875 G(PreferredStylist, stylist=stylist, client=client_with_name_without_photo)876 client_with_name_without_photo.user.photo = None877 client_with_name_without_photo.user.save()878 client_without_name_with_photo = G(Client)879 G(PreferredStylist, stylist=stylist, client=client_without_name_with_photo)880 client_without_name_with_photo.user.first_name = ""881 client_without_name_with_photo.user.last_name = ""882 client_without_name_with_photo.user.save()883 url = reverse('api:v1:client:stylist-followers', kwargs={'stylist_uuid': stylist.uuid})884 response = client.get(url, HTTP_AUTHORIZATION=auth_token)885 assert (status.is_success(response.status_code))886 assert (response.data['followers'][0]['uuid'] == str(client_with_name_and_photo.uuid))887 assert (response.data['followers'][1]['uuid'] == str(client_with_name_without_photo.uuid))888 assert (response.data['followers'][2]['uuid'] == str(client_without_name_with_photo.uuid))889 assert (response.data['followers'][3]['uuid'] == str(client_without_name_or_photo.uuid))890class TestInvitationDeclineView:891 @pytest.mark.django_db892 def test_decline_invitation(self, client, authorized_client_user):893 user, auth_token = authorized_client_user894 stylist: Stylist = G(Stylist)895 invitation = G(Invitation, stylist=stylist, phone=user.phone)896 assert (invitation.status == InvitationStatus.INVITED)897 url = reverse('api:v1:client:decline-invitation', kwargs={'uuid': stylist.uuid})898 response = client.delete(url, HTTP_AUTHORIZATION=auth_token)899 assert (status.is_success(response.status_code))900 invitation.refresh_from_db()901 assert (invitation.status == InvitationStatus.DECLINED)902class TestClientToClientInvitationView:903 @pytest.mark.django_db904 def test_send_invitation(self, client, authorized_client_user):905 user, auth_token = authorized_client_user906 client_invitation = reverse('api:v1:client:client-invitation')907 data = [908 {909 'phone': '+13471111111',910 'invite_target': 'stylist'911 },912 {913 'phone': '+13471111112'914 }915 ]916 response = client.post(client_invitation, HTTP_AUTHORIZATION=auth_token,917 data=json.dumps(data), content_type='application/json')918 assert (status.is_success(response.status_code))919 assert (response.data['invitations'][0]['invite_target'] == 'stylist')...

Full Screen

Full Screen

chromeos.gyp

Source:chromeos.gyp Github

copy

Full Screen

1# Copyright (c) 2012 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4{5 'variables': {6 'chromium_code': 1,7 # These files lists are shared with the GN build.8 'chromeos_sources': [9 'accelerometer/accelerometer_reader.cc',10 'accelerometer/accelerometer_reader.h',11 'accelerometer/accelerometer_types.cc',12 'accelerometer/accelerometer_types.h',13 'app_mode/kiosk_oem_manifest_parser.cc',14 'app_mode/kiosk_oem_manifest_parser.h',15 'attestation/attestation_constants.cc',16 'attestation/attestation_constants.h',17 'attestation/attestation_flow.cc',18 'attestation/attestation_flow.h',19 'audio/audio_device.cc',20 'audio/audio_device.h',21 'audio/audio_devices_pref_handler.h',22 'audio/audio_devices_pref_handler_impl.cc',23 'audio/audio_devices_pref_handler_impl.h',24 'audio/audio_devices_pref_handler_stub.cc',25 'audio/audio_devices_pref_handler_stub.h',26 'audio/audio_pref_observer.h',27 'audio/chromeos_sounds.h',28 'audio/cras_audio_handler.cc',29 'audio/cras_audio_handler.h',30 'cert_loader.cc',31 'cert_loader.h',32 'chromeos_constants.cc',33 'chromeos_constants.h',34 'chromeos_export.h',35 'chromeos_paths.cc',36 'chromeos_paths.h',37 'chromeos_pref_names.cc',38 'chromeos_pref_names.h',39 'chromeos_switches.cc',40 'chromeos_switches.h',41 'cryptohome/async_method_caller.cc',42 'cryptohome/async_method_caller.h',43 'cryptohome/cryptohome_parameters.cc',44 'cryptohome/cryptohome_parameters.h',45 'cryptohome/cryptohome_util.cc',46 'cryptohome/cryptohome_util.h',47 'cryptohome/homedir_methods.cc',48 'cryptohome/homedir_methods.h',49 'cryptohome/system_salt_getter.cc',50 'cryptohome/system_salt_getter.h',51 'dbus/amplifier_client.cc',52 'dbus/amplifier_client.h',53 'dbus/ap_manager_client.cc',54 'dbus/ap_manager_client.h',55 'dbus/audio_dsp_client.cc',56 'dbus/audio_dsp_client.h',57 'dbus/audio_node.cc',58 'dbus/audio_node.h',59 'dbus/blocking_method_caller.cc',60 'dbus/blocking_method_caller.h',61 'dbus/bluetooth_adapter_client.cc',62 'dbus/bluetooth_adapter_client.h',63 'dbus/bluetooth_le_advertising_manager_client.cc',64 'dbus/bluetooth_le_advertising_manager_client.h',65 'dbus/bluetooth_le_advertisement_service_provider.cc',66 'dbus/bluetooth_le_advertisement_service_provider.h',67 'dbus/bluetooth_agent_manager_client.cc',68 'dbus/bluetooth_agent_manager_client.h',69 'dbus/bluetooth_agent_service_provider.cc',70 'dbus/bluetooth_agent_service_provider.h',71 'dbus/bluetooth_device_client.cc',72 'dbus/bluetooth_device_client.h',73 'dbus/bluetooth_gatt_characteristic_client.cc',74 'dbus/bluetooth_gatt_characteristic_client.h',75 'dbus/bluetooth_gatt_characteristic_service_provider.cc',76 'dbus/bluetooth_gatt_characteristic_service_provider.h',77 'dbus/bluetooth_gatt_descriptor_client.cc',78 'dbus/bluetooth_gatt_descriptor_client.h',79 'dbus/bluetooth_gatt_descriptor_service_provider.cc',80 'dbus/bluetooth_gatt_descriptor_service_provider.h',81 'dbus/bluetooth_gatt_manager_client.cc',82 'dbus/bluetooth_gatt_manager_client.h',83 'dbus/bluetooth_gatt_service_client.cc',84 'dbus/bluetooth_gatt_service_client.h',85 'dbus/bluetooth_gatt_service_service_provider.cc',86 'dbus/bluetooth_gatt_service_service_provider.h',87 'dbus/bluetooth_input_client.cc',88 'dbus/bluetooth_input_client.h',89 'dbus/bluetooth_media_client.cc',90 'dbus/bluetooth_media_client.h',91 'dbus/bluetooth_media_endpoint_service_provider.cc',92 'dbus/bluetooth_media_endpoint_service_provider.h',93 'dbus/bluetooth_media_transport_client.cc',94 'dbus/bluetooth_media_transport_client.h',95 'dbus/bluetooth_profile_manager_client.cc',96 'dbus/bluetooth_profile_manager_client.h',97 'dbus/bluetooth_profile_service_provider.cc',98 'dbus/bluetooth_profile_service_provider.h',99 'dbus/cras_audio_client.cc',100 'dbus/cras_audio_client.h',101 'dbus/cros_disks_client.cc',102 'dbus/cros_disks_client.h',103 'dbus/cryptohome_client.cc',104 'dbus/cryptohome_client.h',105 'dbus/dbus_client_bundle.cc',106 'dbus/dbus_client_bundle.h',107 'dbus/dbus_client_implementation_type.h',108 'dbus/dbus_method_call_status.cc',109 'dbus/dbus_method_call_status.h',110 'dbus/dbus_thread_manager.cc',111 'dbus/dbus_thread_manager.h',112 'dbus/debug_daemon_client.cc',113 'dbus/debug_daemon_client.h',114 'dbus/easy_unlock_client.cc',115 'dbus/easy_unlock_client.h',116 'dbus/fake_amplifier_client.cc',117 'dbus/fake_amplifier_client.h',118 'dbus/fake_ap_manager_client.cc',119 'dbus/fake_ap_manager_client.h',120 'dbus/fake_audio_dsp_client.cc',121 'dbus/fake_audio_dsp_client.h',122 'dbus/fake_bluetooth_adapter_client.cc',123 'dbus/fake_bluetooth_adapter_client.h',124 'dbus/fake_bluetooth_le_advertising_manager_client.cc',125 'dbus/fake_bluetooth_le_advertising_manager_client.h',126 'dbus/fake_bluetooth_le_advertisement_service_provider.cc',127 'dbus/fake_bluetooth_le_advertisement_service_provider.h',128 'dbus/fake_bluetooth_agent_manager_client.cc',129 'dbus/fake_bluetooth_agent_manager_client.h',130 'dbus/fake_bluetooth_agent_service_provider.cc',131 'dbus/fake_bluetooth_agent_service_provider.h',132 'dbus/fake_bluetooth_device_client.cc',133 'dbus/fake_bluetooth_device_client.h',134 'dbus/fake_bluetooth_gatt_characteristic_client.cc',135 'dbus/fake_bluetooth_gatt_characteristic_client.h',136 'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc',137 'dbus/fake_bluetooth_gatt_characteristic_service_provider.h',138 'dbus/fake_bluetooth_gatt_descriptor_client.cc',139 'dbus/fake_bluetooth_gatt_descriptor_client.h',140 'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc',141 'dbus/fake_bluetooth_gatt_descriptor_service_provider.h',142 'dbus/fake_bluetooth_gatt_manager_client.cc',143 'dbus/fake_bluetooth_gatt_manager_client.h',144 'dbus/fake_bluetooth_gatt_service_client.cc',145 'dbus/fake_bluetooth_gatt_service_client.h',146 'dbus/fake_bluetooth_gatt_service_service_provider.cc',147 'dbus/fake_bluetooth_gatt_service_service_provider.h',148 'dbus/fake_bluetooth_input_client.cc',149 'dbus/fake_bluetooth_input_client.h',150 'dbus/fake_bluetooth_media_client.cc',151 'dbus/fake_bluetooth_media_client.h',152 'dbus/fake_bluetooth_media_endpoint_service_provider.cc',153 'dbus/fake_bluetooth_media_endpoint_service_provider.h',154 'dbus/fake_bluetooth_media_transport_client.cc',155 'dbus/fake_bluetooth_media_transport_client.h',156 'dbus/fake_bluetooth_profile_manager_client.cc',157 'dbus/fake_bluetooth_profile_manager_client.h',158 'dbus/fake_bluetooth_profile_service_provider.cc',159 'dbus/fake_bluetooth_profile_service_provider.h',160 'dbus/fake_cras_audio_client.cc',161 'dbus/fake_cras_audio_client.h',162 'dbus/fake_cros_disks_client.cc',163 'dbus/fake_cros_disks_client.h',164 'dbus/fake_cryptohome_client.cc',165 'dbus/fake_cryptohome_client.h',166 'dbus/fake_debug_daemon_client.cc',167 'dbus/fake_debug_daemon_client.h',168 'dbus/fake_easy_unlock_client.cc',169 'dbus/fake_easy_unlock_client.h',170 'dbus/fake_gsm_sms_client.cc',171 'dbus/fake_gsm_sms_client.h',172 'dbus/fake_image_burner_client.cc',173 'dbus/fake_image_burner_client.h',174 'dbus/fake_introspectable_client.cc',175 'dbus/fake_introspectable_client.h',176 'dbus/fake_lorgnette_manager_client.cc',177 'dbus/fake_lorgnette_manager_client.h',178 'dbus/fake_modem_messaging_client.cc',179 'dbus/fake_modem_messaging_client.h',180 'dbus/fake_nfc_adapter_client.cc',181 'dbus/fake_nfc_adapter_client.h',182 'dbus/fake_nfc_device_client.cc',183 'dbus/fake_nfc_device_client.h',184 'dbus/fake_nfc_manager_client.cc',185 'dbus/fake_nfc_manager_client.h',186 'dbus/fake_nfc_record_client.cc',187 'dbus/fake_nfc_record_client.h',188 'dbus/fake_nfc_tag_client.cc',189 'dbus/fake_nfc_tag_client.h',190 'dbus/fake_peer_daemon_manager_client.cc',191 'dbus/fake_peer_daemon_manager_client.h',192 'dbus/fake_permission_broker_client.cc',193 'dbus/fake_permission_broker_client.h',194 'dbus/fake_privet_daemon_manager_client.cc',195 'dbus/fake_privet_daemon_manager_client.h',196 'dbus/fake_shill_device_client.cc',197 'dbus/fake_shill_device_client.h',198 'dbus/fake_shill_ipconfig_client.cc',199 'dbus/fake_shill_ipconfig_client.h',200 'dbus/fake_shill_manager_client.cc',201 'dbus/fake_shill_manager_client.h',202 'dbus/fake_shill_profile_client.cc',203 'dbus/fake_shill_profile_client.h',204 'dbus/fake_shill_service_client.cc',205 'dbus/fake_shill_service_client.h',206 'dbus/fake_shill_third_party_vpn_driver_client.cc',207 'dbus/fake_shill_third_party_vpn_driver_client.h',208 'dbus/fake_sms_client.cc',209 'dbus/fake_sms_client.h',210 'dbus/fake_system_clock_client.cc',211 'dbus/fake_system_clock_client.h',212 'dbus/gsm_sms_client.cc',213 'dbus/gsm_sms_client.h',214 'dbus/image_burner_client.cc',215 'dbus/image_burner_client.h',216 'dbus/introspectable_client.cc',217 'dbus/introspectable_client.h',218 'dbus/lorgnette_manager_client.cc',219 'dbus/lorgnette_manager_client.h',220 'dbus/modem_messaging_client.cc',221 'dbus/modem_messaging_client.h',222 'dbus/nfc_adapter_client.cc',223 'dbus/nfc_adapter_client.h',224 'dbus/nfc_client_helpers.cc',225 'dbus/nfc_client_helpers.h',226 'dbus/nfc_device_client.cc',227 'dbus/nfc_device_client.h',228 'dbus/nfc_manager_client.cc',229 'dbus/nfc_manager_client.h',230 'dbus/nfc_property_set.cc',231 'dbus/nfc_property_set.h',232 'dbus/nfc_record_client.cc',233 'dbus/nfc_record_client.h',234 'dbus/nfc_tag_client.cc',235 'dbus/nfc_tag_client.h',236 'dbus/peer_daemon_manager_client.cc',237 'dbus/peer_daemon_manager_client.h',238 'dbus/permission_broker_client.cc',239 'dbus/permission_broker_client.h',240 'dbus/pipe_reader.cc',241 'dbus/pipe_reader.h',242 'dbus/power_manager_client.cc',243 'dbus/power_manager_client.h',244 'dbus/power_policy_controller.cc',245 'dbus/power_policy_controller.h',246 'dbus/privet_daemon_manager_client.cc',247 'dbus/privet_daemon_manager_client.h',248 'dbus/services/console_service_provider.cc',249 'dbus/services/console_service_provider.h',250 'dbus/services/cros_dbus_service.cc',251 'dbus/services/cros_dbus_service.h',252 'dbus/services/display_power_service_provider.cc',253 'dbus/services/display_power_service_provider.h',254 'dbus/services/liveness_service_provider.cc',255 'dbus/services/liveness_service_provider.h',256 'dbus/services/proxy_resolution_service_provider.cc',257 'dbus/services/proxy_resolution_service_provider.h',258 'dbus/session_manager_client.cc',259 'dbus/session_manager_client.h',260 'dbus/shill_client_helper.cc',261 'dbus/shill_client_helper.h',262 'dbus/shill_device_client.cc',263 'dbus/shill_device_client.h',264 'dbus/shill_ipconfig_client.cc',265 'dbus/shill_ipconfig_client.h',266 'dbus/shill_manager_client.cc',267 'dbus/shill_manager_client.h',268 'dbus/shill_profile_client.cc',269 'dbus/shill_profile_client.h',270 'dbus/shill_service_client.cc',271 'dbus/shill_service_client.h',272 'dbus/shill_third_party_vpn_driver_client.cc',273 'dbus/shill_third_party_vpn_driver_client.h',274 'dbus/sms_client.cc',275 'dbus/sms_client.h',276 'dbus/system_clock_client.cc',277 'dbus/system_clock_client.h',278 'dbus/update_engine_client.cc',279 'dbus/update_engine_client.h',280 'dbus/volume_state.cc',281 'dbus/volume_state.h',282 'disks/disk_mount_manager.cc',283 'disks/disk_mount_manager.h',284 'disks/suspend_unmount_manager.cc',285 'disks/suspend_unmount_manager.h',286 'geolocation/geoposition.cc',287 'geolocation/geoposition.h',288 'geolocation/simple_geolocation_provider.cc',289 'geolocation/simple_geolocation_provider.h',290 'geolocation/simple_geolocation_request.cc',291 'geolocation/simple_geolocation_request.h',292 'login/auth/auth_attempt_state.cc',293 'login/auth/auth_attempt_state.h',294 'login/auth/auth_attempt_state_resolver.cc',295 'login/auth/auth_attempt_state_resolver.h',296 'login/auth/auth_status_consumer.cc',297 'login/auth/auth_status_consumer.h',298 'login/auth/authenticator.cc',299 'login/auth/authenticator.h',300 'login/auth/cryptohome_authenticator.cc',301 'login/auth/cryptohome_authenticator.h',302 'login/auth/extended_authenticator.cc',303 'login/auth/extended_authenticator.h',304 'login/auth/extended_authenticator_impl.cc',305 'login/auth/extended_authenticator_impl.h',306 'login/auth/key.cc',307 'login/auth/key.h',308 'login/auth/login_performer.cc',309 'login/auth/login_performer.h',310 'login/auth/online_attempt.cc',311 'login/auth/online_attempt.h',312 'login/auth/online_attempt_host.cc',313 'login/auth/online_attempt_host.h',314 'login/auth/stub_authenticator.cc',315 'login/auth/stub_authenticator.h',316 'login/auth/test_attempt_state.cc',317 'login/auth/test_attempt_state.h',318 'login/auth/user_context.cc',319 'login/auth/user_context.h',320 'login/login_state.cc',321 'login/login_state.h',322 'login/user_names.cc',323 'login/user_names.h',324 'login_event_recorder.cc',325 'login_event_recorder.h',326 'network/auto_connect_handler.cc',327 'network/auto_connect_handler.h',328 'network/certificate_pattern.cc',329 'network/certificate_pattern.h',330 'network/client_cert_resolver.cc',331 'network/client_cert_resolver.h',332 'network/client_cert_util.cc',333 'network/client_cert_util.h',334 'network/device_state.cc',335 'network/device_state.h',336 'network/dhcp_proxy_script_fetcher_chromeos.cc',337 'network/dhcp_proxy_script_fetcher_chromeos.h',338 'network/geolocation_handler.cc',339 'network/geolocation_handler.h',340 'network/host_resolver_impl_chromeos.cc',341 'network/host_resolver_impl_chromeos.h',342 'network/managed_network_configuration_handler.cc',343 'network/managed_network_configuration_handler.h',344 'network/managed_network_configuration_handler_impl.cc',345 'network/managed_network_configuration_handler_impl.h',346 'network/managed_state.cc',347 'network/managed_state.h',348 'network/firewall_hole.cc',349 'network/firewall_hole.h',350 'network/network_activation_handler.cc',351 'network/network_activation_handler.h',352 'network/network_cert_migrator.cc',353 'network/network_cert_migrator.h',354 'network/network_change_notifier_chromeos.cc',355 'network/network_change_notifier_chromeos.h',356 'network/network_change_notifier_factory_chromeos.cc',357 'network/network_change_notifier_factory_chromeos.h',358 'network/network_configuration_handler.cc',359 'network/network_configuration_handler.h',360 'network/network_configuration_observer.h',361 'network/network_connection_handler.cc',362 'network/network_connection_handler.h',363 'network/network_connection_observer.cc',364 'network/network_connection_observer.h',365 'network/network_device_handler.cc',366 'network/network_device_handler.h',367 'network/network_device_handler_impl.cc',368 'network/network_device_handler_impl.h',369 'network/network_event_log.h',370 'network/network_handler.cc',371 'network/network_handler.h',372 'network/network_handler_callbacks.cc',373 'network/network_handler_callbacks.h',374 'network/network_ip_config.cc',375 'network/network_ip_config.h',376 'network/network_profile.cc',377 'network/network_profile.h',378 'network/network_profile_handler.cc',379 'network/network_profile_handler.h',380 'network/network_profile_observer.h',381 'network/network_sms_handler.cc',382 'network/network_sms_handler.h',383 'network/network_state.cc',384 'network/network_state.h',385 'network/network_state_handler.cc',386 'network/network_state_handler.h',387 'network/network_state_handler_observer.cc',388 'network/network_state_handler_observer.h',389 'network/network_type_pattern.cc',390 'network/network_type_pattern.h',391 'network/network_ui_data.cc',392 'network/network_ui_data.h',393 'network/network_util.cc',394 'network/network_util.h',395 'network/onc/onc_certificate_importer.h',396 'network/onc/onc_certificate_importer_impl.cc',397 'network/onc/onc_certificate_importer_impl.h',398 'network/onc/onc_mapper.cc',399 'network/onc/onc_mapper.h',400 'network/onc/onc_merger.cc',401 'network/onc/onc_merger.h',402 'network/onc/onc_normalizer.cc',403 'network/onc/onc_normalizer.h',404 'network/onc/onc_signature.cc',405 'network/onc/onc_signature.h',406 'network/onc/onc_translation_tables.cc',407 'network/onc/onc_translation_tables.h',408 'network/onc/onc_translator.h',409 'network/onc/onc_translator_onc_to_shill.cc',410 'network/onc/onc_translator_shill_to_onc.cc',411 'network/onc/onc_utils.cc',412 'network/onc/onc_utils.h',413 'network/onc/onc_validator.cc',414 'network/onc/onc_validator.h',415 'network/policy_applicator.cc',416 'network/policy_applicator.h',417 'network/policy_util.cc',418 'network/policy_util.h',419 'network/portal_detector/network_portal_detector.cc',420 'network/portal_detector/network_portal_detector.h',421 'network/portal_detector/network_portal_detector_strategy.cc',422 'network/portal_detector/network_portal_detector_strategy.h',423 'network/shill_property_handler.cc',424 'network/shill_property_handler.h',425 'network/shill_property_util.cc',426 'network/shill_property_util.h',427 'process_proxy/process_output_watcher.cc',428 'process_proxy/process_output_watcher.h',429 'process_proxy/process_proxy.cc',430 'process_proxy/process_proxy.h',431 'process_proxy/process_proxy_registry.cc',432 'process_proxy/process_proxy_registry.h',433 'settings/cros_settings_names.cc',434 'settings/cros_settings_names.h',435 'settings/cros_settings_provider.cc',436 'settings/cros_settings_provider.h',437 'settings/timezone_settings.cc',438 'settings/timezone_settings.h',439 'settings/timezone_settings_helper.cc',440 'settings/timezone_settings_helper.h',441 'system/devicetype.cc',442 'system/devicetype.h',443 'system/name_value_pairs_parser.cc',444 'system/name_value_pairs_parser.h',445 'system/statistics_provider.cc',446 'system/statistics_provider.h',447 'system/version_loader.cc',448 'system/version_loader.h',449 'timezone/timezone_provider.cc',450 'timezone/timezone_provider.h',451 'timezone/timezone_request.cc',452 'timezone/timezone_request.h',453 'timezone/timezone_resolver.cc',454 'timezone/timezone_resolver.h',455 'tpm/tpm_password_fetcher.cc',456 'tpm/tpm_password_fetcher.h',457 'tpm/tpm_token_info_getter.cc',458 'tpm/tpm_token_info_getter.h',459 'tpm/tpm_token_loader.cc',460 'tpm/tpm_token_loader.h'461 ],462 'chromeos_test_sources': [463 'app_mode/kiosk_oem_manifest_parser_unittest.cc',464 'attestation/attestation_flow_unittest.cc',465 'audio/audio_devices_pref_handler_impl_unittest.cc',466 'audio/cras_audio_handler_unittest.cc',467 'cert_loader_unittest.cc',468 'cryptohome/homedir_methods_unittest.cc',469 'cryptohome/system_salt_getter_unittest.cc',470 'dbus/blocking_method_caller_unittest.cc',471 'dbus/cros_disks_client_unittest.cc',472 'dbus/dbus_client_bundle_unittest.cc',473 'dbus/fake_easy_unlock_client_unittest.cc',474 'dbus/gsm_sms_client_unittest.cc',475 'dbus/introspectable_client_unittest.cc',476 'dbus/modem_messaging_client_unittest.cc',477 'dbus/nfc_client_unittest.cc',478 'dbus/power_policy_controller_unittest.cc',479 'dbus/privet_daemon_manager_client_unittest.cc',480 'dbus/services/cros_dbus_service_unittest.cc',481 'dbus/services/proxy_resolution_service_provider_unittest.cc',482 'dbus/shill_client_unittest_base.cc',483 'dbus/shill_client_unittest_base.h',484 'dbus/shill_device_client_unittest.cc',485 'dbus/shill_ipconfig_client_unittest.cc',486 'dbus/shill_manager_client_unittest.cc',487 'dbus/shill_profile_client_unittest.cc',488 'dbus/shill_service_client_unittest.cc',489 'dbus/shill_third_party_vpn_driver_client_unittest.cc',490 'disks/disk_mount_manager_unittest.cc',491 'disks/suspend_unmount_manager_unittest.cc',492 'geolocation/simple_geolocation_unittest.cc',493 'login/auth/key_unittest.cc',494 'login/login_state_unittest.cc',495 'network/auto_connect_handler_unittest.cc',496 'network/client_cert_resolver_unittest.cc',497 'network/firewall_hole_unittest.cc',498 'network/geolocation_handler_unittest.cc',499 'network/host_resolver_impl_chromeos_unittest.cc',500 'network/managed_network_configuration_handler_unittest.cc',501 'network/network_cert_migrator_unittest.cc',502 'network/network_change_notifier_chromeos_unittest.cc',503 'network/network_configuration_handler_unittest.cc',504 'network/network_connection_handler_unittest.cc',505 'network/network_device_handler_unittest.cc',506 'network/network_profile_handler_stub.h',507 'network/network_sms_handler_unittest.cc',508 'network/network_state_handler_unittest.cc',509 'network/network_state_unittest.cc',510 'network/network_type_pattern_unittest.cc',511 'network/network_ui_data_unittest.cc',512 'network/network_util_unittest.cc',513 'network/onc/onc_certificate_importer_impl_unittest.cc',514 'network/onc/onc_merger_unittest.cc',515 'network/onc/onc_normalizer_unittest.cc',516 'network/onc/onc_translator_unittest.cc',517 'network/onc/onc_utils_unittest.cc',518 'network/onc/onc_validator_unittest.cc',519 'network/shill_property_handler_unittest.cc',520 'process_proxy/process_output_watcher_unittest.cc',521 'process_proxy/process_proxy_unittest.cc',522 'settings/timezone_settings_unittest.cc',523 'system/name_value_pairs_parser_unittest.cc',524 'system/version_loader_unittest.cc',525 'timezone/timezone_unittest.cc',526 'tpm/tpm_token_info_getter_unittest.cc',527 ],528 },529 'includes': [530 'chromeos_tools.gypi'531 ],532 'targets': [533 {534 # GN version: //chromeos535 'target_name': 'chromeos',536 'type': '<(component)',537 'dependencies': [538 '../base/base.gyp:base',539 '../base/base.gyp:base_i18n',540 '../base/base.gyp:base_prefs',541 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',542 '../build/linux/system.gyp:dbus',543 '../build/linux/system.gyp:ssl',544 '../components/components.gyp:cloud_policy_proto',545 '../components/components.gyp:device_event_log_component',546 '../components/components.gyp:onc_component',547 '../components/components.gyp:proxy_config',548 '../crypto/crypto.gyp:crypto',549 '../dbus/dbus.gyp:dbus',550 '../google_apis/google_apis.gyp:google_apis',551 '../net/net.gyp:net',552 '../third_party/icu/icu.gyp:icui18n',553 '../third_party/libxml/libxml.gyp:libxml',554 '../third_party/protobuf/protobuf.gyp:protobuf_lite',555 '../url/url.gyp:url_lib',556 'cryptohome_proto',557 'ime/input_method.gyp:gencode',558 'power_manager_proto',559 ],560 'defines': [561 'CHROMEOS_IMPLEMENTATION',562 ],563 'sources': [ '<@(chromeos_sources)' ],564 },565 {566 # GN version: //chromeos:test_support567 # This target contains mocks that can be used to write unit tests.568 'target_name': 'chromeos_test_support',569 'type': 'static_library',570 'dependencies': [571 '../build/linux/system.gyp:dbus',572 '../google_apis/google_apis.gyp:google_apis_test_support',573 '../testing/gmock.gyp:gmock',574 'chromeos',575 'chromeos_test_support_without_gmock',576 'cryptohome_proto',577 'power_manager_proto',578 ],579 # If you edit the file list of this target, please edit BUILD.gn as well.580 'sources': [581 'attestation/mock_attestation_flow.cc',582 'attestation/mock_attestation_flow.h',583 'chromeos_test_utils.cc',584 'chromeos_test_utils.h',585 'cryptohome/mock_async_method_caller.cc',586 'cryptohome/mock_async_method_caller.h',587 'cryptohome/mock_homedir_methods.cc',588 'cryptohome/mock_homedir_methods.h',589 'dbus/mock_cryptohome_client.cc',590 'dbus/mock_cryptohome_client.h',591 'dbus/mock_lorgnette_manager_client.cc',592 'dbus/mock_lorgnette_manager_client.h',593 'dbus/mock_permission_broker_client.cc',594 'dbus/mock_permission_broker_client.h',595 'dbus/mock_session_manager_client.cc',596 'dbus/mock_session_manager_client.h',597 'dbus/mock_shill_manager_client.cc',598 'dbus/mock_shill_manager_client.h',599 'dbus/mock_shill_profile_client.cc',600 'dbus/mock_shill_profile_client.h',601 'dbus/mock_shill_service_client.cc',602 'dbus/mock_shill_service_client.h',603 'dbus/services/service_provider_test_helper.cc',604 'dbus/services/service_provider_test_helper.h',605 'disks/mock_disk_mount_manager.cc',606 'disks/mock_disk_mount_manager.h',607 'login/auth/fake_extended_authenticator.cc',608 'login/auth/fake_extended_authenticator.h',609 'login/auth/mock_auth_attempt_state_resolver.cc',610 'login/auth/mock_auth_attempt_state_resolver.h',611 'login/auth/mock_auth_status_consumer.cc',612 'login/auth/mock_auth_status_consumer.h',613 'login/auth/mock_url_fetchers.cc',614 'login/auth/mock_url_fetchers.h',615 'network/fake_network_device_handler.cc',616 'network/fake_network_device_handler.h',617 'network/mock_managed_network_configuration_handler.cc',618 'network/mock_managed_network_configuration_handler.h',619 'network/onc/onc_test_utils.cc',620 'network/onc/onc_test_utils.h',621 'system/fake_statistics_provider.cc',622 'system/fake_statistics_provider.h',623 ],624 'include_dirs': [625 '..',626 ],627 },628 {629 # GN version: //chromeos:test_support_without_gmock630 'target_name': 'chromeos_test_support_without_gmock',631 'type': 'static_library',632 'export_dependent_settings': [633 # fake_power_manager_client.h includes pb.h files.634 'power_manager_proto',635 ],636 'dependencies': [637 '../build/linux/system.gyp:dbus',638 '../crypto/crypto.gyp:crypto',639 '../dbus/dbus.gyp:dbus',640 'chromeos',641 'cryptohome_proto',642 'power_manager_proto',643 ],644 # If you edit the file list of this target, please edit BUILD.gn as well.645 'sources': [646 'dbus/fake_power_manager_client.cc',647 'dbus/fake_power_manager_client.h',648 'dbus/fake_session_manager_client.cc',649 'dbus/fake_session_manager_client.h',650 'dbus/fake_shill_manager_client.cc',651 'dbus/fake_shill_manager_client.h',652 'dbus/fake_update_engine_client.cc',653 'dbus/fake_update_engine_client.h',654 ],655 'include_dirs': [656 '..',657 ],658 },659 {660 # GN version: //chromeos:chromeos_unittests661 'target_name': 'chromeos_unittests',662 'type': 'executable',663 'dependencies': [664 '../base/base.gyp:base_prefs_test_support',665 '../base/base.gyp:run_all_unittests',666 '../base/base.gyp:test_support_base',667 '../build/linux/system.gyp:dbus',668 '../build/linux/system.gyp:ssl',669 '../components/components.gyp:onc_component',670 '../components/components.gyp:proxy_config',671 '../crypto/crypto.gyp:crypto',672 '../crypto/crypto.gyp:crypto_test_support',673 '../dbus/dbus.gyp:dbus_test_support',674 '../google_apis/google_apis.gyp:google_apis',675 '../net/net.gyp:net',676 '../net/net.gyp:net_test_support',677 '../testing/gmock.gyp:gmock',678 '../testing/gtest.gyp:gtest',679 '../third_party/icu/icu.gyp:icuuc',680 '../third_party/icu/icu.gyp:icui18n',681 '../url/url.gyp:url_lib',682 'chromeos_test_support',683 'cryptohome_proto',684 'power_manager_proto',685 ],686 'sources': [ '<@(chromeos_test_sources)' ],687 'include_dirs': [688 '..',689 ],690 'conditions': [691 [ 'use_allocator!="none"', {692 'dependencies': [693 '../base/allocator/allocator.gyp:allocator',694 ],695 },696 ],697 ],698 },699 {700 # GN version: //chromeos:power_manager_proto701 # Protobuf compiler/generator for power-manager related protocol buffers.702 'target_name': 'power_manager_proto',703 'type': 'static_library',704 'sources': [705 '../third_party/cros_system_api/dbus/power_manager/input_event.proto',706 '../third_party/cros_system_api/dbus/power_manager/peripheral_battery_status.proto',707 '../third_party/cros_system_api/dbus/power_manager/policy.proto',708 '../third_party/cros_system_api/dbus/power_manager/power_supply_properties.proto',709 '../third_party/cros_system_api/dbus/power_manager/suspend.proto',710 ],711 'variables': {712 'proto_in_dir': '../third_party/cros_system_api/dbus/power_manager',713 'proto_out_dir': 'chromeos/dbus/power_manager',714 },715 'includes': ['../build/protoc.gypi'],716 },717 {718 # GN version: //chromeos:cryptohome_proto719 # Protobuf compiler/generator for cryptohome related protocol buffers.720 'target_name': 'cryptohome_proto',721 'type': 'static_library',722 'sources': [723 '../third_party/cros_system_api/dbus/cryptohome/key.proto',724 '../third_party/cros_system_api/dbus/cryptohome/rpc.proto',725 ],726 'variables': {727 'proto_in_dir': '../third_party/cros_system_api/dbus/cryptohome',728 'proto_out_dir': 'chromeos/dbus/cryptohome',729 },730 'includes': ['../build/protoc.gypi'],731 },732 {733 # GN version: //chromeos:cryptohome_signkey_proto734 # Protobuf compiler/generator for cryptohome key signing protocol buffer.735 'target_name': 'cryptohome_signkey_proto',736 'type': 'static_library',737 'sources': [738 '../third_party/cros_system_api/dbus/cryptohome/signed_secret.proto',739 ],740 'variables': {741 'proto_in_dir': '../third_party/cros_system_api/dbus/cryptohome',742 'proto_out_dir': 'chromeos/cryptohome',743 },744 'includes': ['../build/protoc.gypi'],745 },746 ],747 'conditions': [748 ['test_isolation_mode != "noop"', {749 'targets': [750 {751 'target_name': 'chromeos_unittests_run',752 'type': 'none',753 'dependencies': [754 'chromeos_unittests',755 ],756 'includes': [757 '../build/isolate.gypi',758 ],759 'sources': [760 'chromeos_unittests.isolate',761 ],762 },763 ],764 }],765 ],...

Full Screen

Full Screen

remoting_srcs.gypi

Source:remoting_srcs.gypi Github

copy

Full Screen

1# Copyright 2014 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4{5 'variables': {6 'daemon_controller_guid': '655bd819-c08c-4b04-80c2-f160739ff6ef',7 'rdp_desktop_session_guid': '6a7699f0-ee43-43e7-aa30-a6738f9bd470',8 'remoting_base_sources': [9 'base/auto_thread.cc',10 'base/auto_thread.h',11 'base/auto_thread_task_runner.cc',12 'base/auto_thread_task_runner.h',13 'base/buffered_socket_writer.cc',14 'base/buffered_socket_writer.h',15 'base/capabilities.cc',16 'base/capabilities.h',17 'base/compound_buffer.cc',18 'base/compound_buffer.h',19 'base/constants.cc',20 'base/constants.h',21 'base/plugin_thread_task_runner.cc',22 'base/plugin_thread_task_runner.h',23 'base/rate_counter.cc',24 'base/rate_counter.h',25 'base/resources.h',26 'base/resources_linux.cc',27 'base/resources_mac.cc',28 'base/resources_win.cc',29 'base/rsa_key_pair.cc',30 'base/rsa_key_pair.h',31 'base/running_average.cc',32 'base/running_average.h',33 'base/scoped_sc_handle_win.h',34 'base/service_urls.cc',35 'base/service_urls.h',36 'base/socket_reader.cc',37 'base/socket_reader.h',38 'base/typed_buffer.h',39 'base/url_request_context_getter.cc',40 'base/url_request_context_getter.h',41 'base/util.cc',42 'base/util.h',43 'base/vlog_net_log.cc',44 'base/vlog_net_log.h',45 ],46 'remoting_codec_sources': [47 'codec/audio_decoder.cc',48 'codec/audio_decoder.h',49 'codec/audio_decoder_opus.cc',50 'codec/audio_decoder_opus.h',51 'codec/audio_decoder_verbatim.cc',52 'codec/audio_decoder_verbatim.h',53 'codec/audio_encoder.h',54 'codec/audio_encoder_opus.cc',55 'codec/audio_encoder_opus.h',56 'codec/audio_encoder_verbatim.cc',57 'codec/audio_encoder_verbatim.h',58 'codec/scoped_vpx_codec.cc',59 'codec/scoped_vpx_codec.h',60 'codec/video_decoder.h',61 'codec/video_decoder_verbatim.cc',62 'codec/video_decoder_verbatim.h',63 'codec/video_decoder_vpx.cc',64 'codec/video_decoder_vpx.h',65 'codec/video_encoder.h',66 'codec/video_encoder_helper.cc',67 'codec/video_encoder_helper.h',68 'codec/video_encoder_verbatim.cc',69 'codec/video_encoder_verbatim.h',70 'codec/video_encoder_vpx.cc',71 'codec/video_encoder_vpx.h',72 ],73 'remoting_protocol_sources': [74 'protocol/audio_reader.cc',75 'protocol/audio_reader.h',76 'protocol/audio_stub.h',77 'protocol/audio_writer.cc',78 'protocol/audio_writer.h',79 'protocol/auth_util.cc',80 'protocol/auth_util.h',81 'protocol/authentication_method.cc',82 'protocol/authentication_method.h',83 'protocol/authenticator.cc',84 'protocol/authenticator.h',85 'protocol/capability_names.h',86 'protocol/channel_authenticator.h',87 'protocol/channel_dispatcher_base.cc',88 'protocol/channel_dispatcher_base.h',89 'protocol/channel_multiplexer.cc',90 'protocol/channel_multiplexer.h',91 'protocol/channel_socket_adapter.cc',92 'protocol/channel_socket_adapter.h',93 'protocol/chromium_port_allocator.cc',94 'protocol/chromium_port_allocator.h',95 'protocol/chromium_socket_factory.cc',96 'protocol/chromium_socket_factory.h',97 'protocol/client_control_dispatcher.cc',98 'protocol/client_control_dispatcher.h',99 'protocol/client_event_dispatcher.cc',100 'protocol/client_event_dispatcher.h',101 'protocol/client_stub.h',102 'protocol/client_video_dispatcher.cc',103 'protocol/client_video_dispatcher.h',104 'protocol/clipboard_echo_filter.cc',105 'protocol/clipboard_echo_filter.h',106 'protocol/clipboard_filter.cc',107 'protocol/clipboard_filter.h',108 'protocol/clipboard_stub.h',109 'protocol/clipboard_thread_proxy.cc',110 'protocol/clipboard_thread_proxy.h',111 'protocol/connection_to_client.cc',112 'protocol/connection_to_client.h',113 'protocol/connection_to_host.h',114 'protocol/connection_to_host_impl.cc',115 'protocol/connection_to_host_impl.h',116 'protocol/content_description.cc',117 'protocol/content_description.h',118 'protocol/datagram_channel_factory.h',119 'protocol/errors.h',120 'protocol/host_control_dispatcher.cc',121 'protocol/host_control_dispatcher.h',122 'protocol/host_event_dispatcher.cc',123 'protocol/host_event_dispatcher.h',124 'protocol/host_stub.h',125 'protocol/host_video_dispatcher.cc',126 'protocol/host_video_dispatcher.h',127 'protocol/input_event_tracker.cc',128 'protocol/input_event_tracker.h',129 'protocol/input_filter.cc',130 'protocol/input_filter.h',131 'protocol/input_stub.h',132 'protocol/it2me_host_authenticator_factory.cc',133 'protocol/it2me_host_authenticator_factory.h',134 'protocol/jingle_messages.cc',135 'protocol/jingle_messages.h',136 'protocol/jingle_session.cc',137 'protocol/jingle_session.h',138 'protocol/jingle_session_manager.cc',139 'protocol/jingle_session_manager.h',140 'protocol/libjingle_transport_factory.cc',141 'protocol/libjingle_transport_factory.h',142 'protocol/me2me_host_authenticator_factory.cc',143 'protocol/me2me_host_authenticator_factory.h',144 'protocol/message_decoder.cc',145 'protocol/message_decoder.h',146 'protocol/message_reader.cc',147 'protocol/message_reader.h',148 'protocol/message_serialization.cc',149 'protocol/message_serialization.h',150 'protocol/monitored_video_stub.cc',151 'protocol/monitored_video_stub.h',152 'protocol/mouse_input_filter.cc',153 'protocol/mouse_input_filter.h',154 'protocol/name_value_map.h',155 'protocol/negotiating_authenticator_base.cc',156 'protocol/negotiating_authenticator_base.h',157 'protocol/negotiating_client_authenticator.cc',158 'protocol/negotiating_client_authenticator.h',159 'protocol/negotiating_host_authenticator.cc',160 'protocol/negotiating_host_authenticator.h',161 'protocol/network_settings.h',162 'protocol/pairing_authenticator_base.cc',163 'protocol/pairing_authenticator_base.h',164 'protocol/pairing_client_authenticator.cc',165 'protocol/pairing_client_authenticator.h',166 'protocol/pairing_host_authenticator.cc',167 'protocol/pairing_host_authenticator.h',168 'protocol/pairing_registry.cc',169 'protocol/pairing_registry.h',170 'protocol/port_range.cc',171 'protocol/port_range.h',172 'protocol/pseudotcp_adapter.cc',173 'protocol/pseudotcp_adapter.h',174 'protocol/pseudotcp_channel_factory.cc',175 'protocol/pseudotcp_channel_factory.h',176 'protocol/secure_channel_factory.cc',177 'protocol/secure_channel_factory.h',178 'protocol/session.h',179 'protocol/session_config.cc',180 'protocol/session_config.h',181 'protocol/session_manager.h',182 'protocol/socket_util.cc',183 'protocol/socket_util.h',184 'protocol/ssl_hmac_channel_authenticator.cc',185 'protocol/ssl_hmac_channel_authenticator.h',186 'protocol/stream_channel_factory.h',187 'protocol/third_party_authenticator_base.cc',188 'protocol/third_party_authenticator_base.h',189 'protocol/third_party_client_authenticator.cc',190 'protocol/third_party_client_authenticator.h',191 'protocol/third_party_host_authenticator.cc',192 'protocol/third_party_host_authenticator.h',193 'protocol/token_validator.h',194 'protocol/transport.cc',195 'protocol/transport.h',196 'protocol/usb_key_codes.h',197 'protocol/v2_authenticator.cc',198 'protocol/v2_authenticator.h',199 'protocol/video_stub.h',200 'signaling/iq_sender.cc',201 'signaling/iq_sender.h',202 'signaling/jid_util.cc',203 'signaling/jid_util.h',204 'signaling/jingle_info_request.cc',205 'signaling/jingle_info_request.h',206 'signaling/log_to_server.cc',207 'signaling/log_to_server.h',208 'signaling/push_notification_subscriber.cc',209 'signaling/push_notification_subscriber.h',210 'signaling/server_log_entry.cc',211 'signaling/server_log_entry.h',212 'signaling/signal_strategy.h',213 'signaling/xmpp_signal_strategy.cc',214 'signaling/xmpp_signal_strategy.h',215 'signaling/xmpp_stream_parser.cc',216 'signaling/xmpp_stream_parser.h',217 'signaling/xmpp_login_handler.cc',218 'signaling/xmpp_login_handler.h',219 ],220 'remoting_client_sources': [221 'client/audio_decode_scheduler.cc',222 'client/audio_decode_scheduler.h',223 'client/audio_player.cc',224 'client/audio_player.h',225 'client/chromoting_client.cc',226 'client/chromoting_client.h',227 'client/chromoting_stats.cc',228 'client/chromoting_stats.h',229 'client/client_context.cc',230 'client/client_context.h',231 'client/client_status_logger.cc',232 'client/client_status_logger.h',233 'client/client_user_interface.h',234 'client/frame_consumer.h',235 'client/frame_consumer_proxy.cc',236 'client/frame_consumer_proxy.h',237 'client/frame_producer.h',238 'client/key_event_mapper.cc',239 'client/key_event_mapper.h',240 'client/server_log_entry_client.cc',241 'client/server_log_entry_client.h',242 'client/software_video_renderer.cc',243 'client/software_video_renderer.h',244 'client/token_fetcher_proxy.cc',245 'client/token_fetcher_proxy.h',246 'client/video_renderer.h',247 ],248 'remoting_client_plugin_sources': [249 'client/plugin/chromoting_instance.cc',250 'client/plugin/chromoting_instance.h',251 'client/plugin/delegating_signal_strategy.cc',252 'client/plugin/delegating_signal_strategy.h',253 'client/plugin/empty_cursor_filter.cc',254 'client/plugin/empty_cursor_filter.h',255 'client/plugin/normalizing_input_filter_cros.cc',256 'client/plugin/normalizing_input_filter_cros.h',257 'client/plugin/normalizing_input_filter_mac.cc',258 'client/plugin/normalizing_input_filter_mac.h',259 'client/plugin/pepper_address_resolver.cc',260 'client/plugin/pepper_address_resolver.h',261 'client/plugin/pepper_audio_player.cc',262 'client/plugin/pepper_audio_player.h',263 'client/plugin/pepper_cursor_setter.cc',264 'client/plugin/pepper_cursor_setter.h',265 'client/plugin/pepper_input_handler.cc',266 'client/plugin/pepper_input_handler.h',267 'client/plugin/pepper_mouse_locker.cc',268 'client/plugin/pepper_mouse_locker.h',269 'client/plugin/pepper_network_manager.cc',270 'client/plugin/pepper_network_manager.h',271 'client/plugin/pepper_packet_socket_factory.cc',272 'client/plugin/pepper_packet_socket_factory.h',273 'client/plugin/pepper_plugin_thread_delegate.cc',274 'client/plugin/pepper_plugin_thread_delegate.h',275 'client/plugin/pepper_port_allocator.cc',276 'client/plugin/pepper_port_allocator.h',277 'client/plugin/pepper_util.cc',278 'client/plugin/pepper_util.h',279 'client/plugin/pepper_video_renderer.h',280 'client/plugin/pepper_video_renderer_2d.cc',281 'client/plugin/pepper_video_renderer_2d.h',282 'client/plugin/pepper_video_renderer_3d.cc',283 'client/plugin/pepper_video_renderer_3d.h',284 'client/plugin/touch_input_scaler.cc',285 'client/plugin/touch_input_scaler.h',286 ],287 }...

Full Screen

Full Screen

test_lightweight_testing.py

Source:test_lightweight_testing.py Github

copy

Full Screen

...22 odl_client.cfg.CONF.set_override('enable_lightweight_testing',23 True, 'ml2_odl')24 # DietTestCase does not automatically cleans configuration overrides25 self.addCleanup(odl_client.cfg.CONF.reset)26 client = odl_client.OpenDaylightRestClient.create_client()27 self.assertIsInstance(client, lwt.OpenDaylightLwtClient)28 def test_create_client_with_lwt_disabled(self):29 """Have to do the importation here, otherwise there will be a loop"""30 from networking_odl.common import client as odl_client31 odl_client.cfg.CONF.set_override('enable_lightweight_testing',32 False, 'ml2_odl')33 # DietTestCase does not automatically cleans configuration overrides34 self.addCleanup(odl_client.cfg.CONF.reset)35 client = odl_client.OpenDaylightRestClient.create_client()36 self.assertIsInstance(client, odl_client.OpenDaylightRestClient)37 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,38 {'networks': {}}, clear=True)39 def test_post_single_resource(self):40 client = lwt.OpenDaylightLwtClient.create_client()41 fake_network1 = {'id': 'fakeid1', 'name': 'fake_network1'}42 obj = {'networks': fake_network1}43 response = client.sendjson('post', 'networks', obj)44 self.assertEqual(lwt.NO_CONTENT, response.status_code)45 lwt_dict = lwt.OpenDaylightLwtClient.lwt_dict46 self.assertEqual(lwt_dict['networks']['fakeid1'],47 fake_network1)48 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,49 {'networks': {}}, clear=True)50 def test_post_multiple_resources(self):51 client = lwt.OpenDaylightLwtClient.create_client()52 fake_network1 = {'id': 'fakeid1', 'name': 'fake_network1'}53 fake_network2 = {'id': 'fakeid2', 'name': 'fake_network2'}54 obj = {'networks': [fake_network1, fake_network2]}55 response = client.sendjson('post', 'networks', obj)56 self.assertEqual(lwt.NO_CONTENT, response.status_code)57 lwt_dict = lwt.OpenDaylightLwtClient.lwt_dict58 self.assertEqual(lwt_dict['networks']['fakeid1'],59 fake_network1)60 self.assertEqual(lwt_dict['networks']['fakeid2'],61 fake_network2)62 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,63 {'ports': {'fakeid1': {'id': 'fakeid1',64 'name': 'fake_port1'}}},65 clear=True)66 def test_get_single_resource(self):67 client = lwt.OpenDaylightLwtClient.create_client()68 url_path = 'ports/fakeid1'69 response = client.sendjson('get', url_path, None)70 self.assertEqual(lwt.OK, response.status_code)71 res = response.json()72 # For single resource, the return value is a dict73 self.assertEqual(res['port']['name'], 'fake_port1')74 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,75 {'ports': {'fakeid1': {'id': 'fakeid1',76 'name': 'fake_port1'},77 'fakeid2': {'id': 'fakeid2',78 'name': 'fake_port2'}}},79 clear=True)80 def test_get_multiple_resources(self):81 client = lwt.OpenDaylightLwtClient.create_client()82 url_path = 'ports/'83 response = client.sendjson('get', url_path, None)84 self.assertEqual(lwt.OK, response.status_code)85 res = response.json()86 for port in res:87 self.assertIn(port['port']['name'],88 ['fake_port1', 'fake_port2'])89 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,90 {'subnets': {'fakeid1': {'id': 'fakeid1',91 'name': 'fake_subnet1'}}},92 clear=True)93 def test_put_single_resource(self):94 client = lwt.OpenDaylightLwtClient.create_client()95 changed = {'id': 'fakeid1', 'name': 'fake_subnet1_changed'}96 obj = {'subnets': changed}97 url_path = 'subnets/fakeid1'98 response = client.sendjson('put', url_path, obj)99 self.assertEqual(lwt.NO_CONTENT, response.status_code)100 lwt_dict = lwt.OpenDaylightLwtClient.lwt_dict101 self.assertEqual('fake_subnet1_changed',102 lwt_dict['subnets']['fakeid1']['name'])103 """Check the client does not change the parameter"""104 self.assertEqual('fakeid1', changed['id'])105 self.assertEqual('fake_subnet1_changed', changed['name'])106 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,107 {'subnets': {'fakeid1': {'id': 'fakeid1',108 'name': 'fake_subnet1'},109 'fakeid2': {'id': 'fakeid2',110 'name': 'fake_subnet2'}}},111 clear=True)112 def test_put_multiple_resources(self):113 client = lwt.OpenDaylightLwtClient.create_client()114 changed1 = {'id': 'fakeid1', 'name': 'fake_subnet1_changed'}115 changed2 = {'id': 'fakeid2', 'name': 'fake_subnet2_changed'}116 obj = {'subnets': [changed1, changed2]}117 url_path = 'subnets/'118 response = client.sendjson('put', url_path, obj)119 self.assertEqual(lwt.NO_CONTENT, response.status_code)120 lwt_dict = lwt.OpenDaylightLwtClient.lwt_dict121 self.assertEqual('fake_subnet1_changed',122 lwt_dict['subnets']['fakeid1']['name'])123 self.assertEqual('fake_subnet2_changed',124 lwt_dict['subnets']['fakeid2']['name'])125 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,126 {'networks': {'fakeid1': {'id': 'fakeid1',127 'name': 'fake_network1'}}},128 clear=True)129 def test_delete_single_resource(self):130 client = lwt.OpenDaylightLwtClient.create_client()131 url_path = 'networks/fakeid1'132 response = client.sendjson('delete', url_path, None)133 self.assertEqual(lwt.NO_CONTENT, response.status_code)134 lwt_dict = lwt.OpenDaylightLwtClient.lwt_dict135 network = lwt_dict['networks'].get('fakeid1')136 self.assertEqual(None, network)137 @mock.patch.dict(lwt.OpenDaylightLwtClient.lwt_dict,138 {'networks': {'fakeid1': {'id': 'fakeid1',139 'name': 'fake_network1'},140 'fakeid2': {'id': 'fakeid2',141 'name': 'fake_network2'}}},142 clear=True)143 def test_delete_multiple_resources(self):144 client = lwt.OpenDaylightLwtClient.create_client()145 network1 = {'id': 'fakeid1'}146 network2 = {'id': 'fakeid2'}147 obj = {'networks': [network1, network2]}148 response = client.sendjson('delete', 'networks/', obj)149 self.assertEqual(lwt.NO_CONTENT, response.status_code)150 lwt_dict = lwt.OpenDaylightLwtClient.lwt_dict151 network = lwt_dict['networks'].get('fakeid1')152 self.assertEqual(None, network)153 network = lwt_dict['networks'].get('fakeid2')...

Full Screen

Full Screen

client.py

Source:client.py Github

copy

Full Screen

1import json2from typing import List3from typing import Dict4from typing import Union5from finnews.cnbc import CNBC6from finnews.nasdaq import NASDAQ7from finnews.market_watch import MarketWatch8from finnews.sp_global import SPGlobal9from finnews.seeking_alpha import SeekingAlpha10from finnews.cnn_finance import CNNFinance11from finnews.wsj import WallStreetJournal12from finnews.yahoo_finance import YahooFinance13class News():14 """15 Represents the main News Client that is used to access 16 the different news providers.17 """18 def __init__(self) -> None:19 """Initalizes the main `News` client.20 Usage:21 ----22 >>> from finnews.client import News23 >>> # Create a new instance of the News Client.24 >>> news_client = News()25 """26 self._cnbc_client = None27 self._nasdaq_client = None28 self._market_watch_client = None29 self._sp_global_client = None30 self._seeking_alpha_client = None31 self._cnn_finance_client = None32 self._wsj_client = None33 self._yahoo_finance_client = None34 def __repr__(self) -> str:35 """Represents the string representation of the client object.36 Returns:37 ----38 (str): The string representation.39 """40 return "<NewsClient Connected: True'>"41 @property42 def cnbc(self) -> CNBC:43 """Returns a new instance of the `CNBC` news client.44 Returns:45 ----46 CNBC: The `CNBC` news client that can be used to47 query different RSS feeds by topics.48 Usage:49 ----50 >>> from finnews.client import News51 >>> # Create a new instance of the News Client.52 >>> news_client = News()53 >>> # Grab the CNBC News Client.54 >>> cnbc_news_client = news_client.cnbc 55 """56 self._cnbc_client = CNBC()57 return self._cnbc_client58 @property59 def nasdaq(self) -> NASDAQ:60 """Returns a new instance of the `NASDAQ` news client.61 Returns:62 ----63 NASDAQ: The `NASDAQ` news client that can be used to64 query different RSS feeds by topics.65 Usage:66 ----67 >>> from finnews.client import News68 >>> # Create a new instance of the News Client.69 >>> news_client = News()70 >>> # Grab the NASDAQ News Client.71 >>> nasdaq_news_client = news_client.nasdaq 72 """73 self._nasdaq_client = NASDAQ()74 return self._nasdaq_client75 @property76 def market_Watch(self) -> MarketWatch:77 """Returns a new instance of the `MarketWatch` news client.78 Returns:79 ----80 MarketWatch: The `MarketWatch` news client that can be used to81 query different RSS feeds by topics.82 Usage:83 ----84 >>> from finnews.client import News85 >>> # Create a new instance of the News Client.86 >>> news_client = News()87 >>> # Grab the MarketWatch News Client.88 >>> market_Watch_client = news_client.market_Watch 89 """90 self._market_watch_client = MarketWatch()91 return self._market_watch_client92 @property93 def sp_global(self) -> SPGlobal:94 """Returns a new instance of the `SPGlobal` news client.95 Returns:96 ----97 SPGlobal: The `SPGlobal` news client that can be used to98 query different RSS feeds by topics.99 Usage:100 ----101 >>> from finnews.client import News102 >>> # Create a new instance of the News Client.103 >>> news_client = News()104 >>> # Grab the SPGlobal News Client.105 >>> sp_global_client = news_client.sp_global 106 """107 self._sp_global_client = SPGlobal()108 return self._sp_global_client109 @property110 def seeking_alpha(self) -> SeekingAlpha:111 """Returns a new instance of the `SeekingAlpha` news client.112 Returns:113 ----114 SeekingAlpha: The `SeekingAlpha` news client that can be used to115 query different RSS feeds by topics.116 Usage:117 ----118 >>> from finnews.client import News119 >>> # Create a new instance of the News Client.120 >>> news_client = News()121 >>> # Grab the SeekingAlpha News Client.122 >>> seeking_alpha_client = news_client.seeking_alpha 123 """124 self._seeking_alpha_client = SeekingAlpha()125 return self._seeking_alpha_client126 @property127 def cnn_finance(self) -> CNNFinance:128 """Returns a new instance of the `CNNFinance` news client.129 Returns:130 ----131 CNNFinance: The `CNNFinance` news client that can be used to132 query different RSS feeds by topics.133 Usage:134 ----135 >>> from finnews.client import News136 >>> # Create a new instance of the News Client.137 >>> news_client = News()138 >>> # Grab the CNN Finance News Client.139 >>> cnn_finance_client = news_client.cnn_finance 140 """141 self._cnn_finance_client = CNNFinance()142 return self._cnn_finance_client143 @property144 def wsj(self) -> WallStreetJournal:145 """Returns a new instance of the `WallStreetJournal` news client.146 Returns:147 ----148 WallStreetJournal: The `WallStreetJournal` news client that can be used to149 query different RSS feeds by topics.150 Usage:151 ----152 >>> from finnews.client import News153 >>> # Create a new instance of the News Client.154 >>> news_client = News()155 >>> # Grab the Wall Street Journal News Client.156 >>> wsj_client = news_client.wsj 157 """158 self._wsj_client = WallStreetJournal()159 return self._wsj_client160 @property161 def yahoo_finance(self) -> YahooFinance:162 """Returns a new instance of the `YahooFinance` news client.163 Returns:164 ----165 YahooFinance: The `YahooFinance` news client that can be used to166 query different RSS feeds by topics.167 Usage:168 ----169 >>> from finnews.client import News170 >>> # Create a new instance of the News Client.171 >>> news_client = News()172 >>> # Grab the Yahoo Finance News Client.173 >>> yahoo_finance_client = news_client.yahoo_finance 174 """175 self._yahoo_finance_client = YahooFinance()176 return self._yahoo_finance_client177 def save_to_file(self, content: List[Dict], file_name: str) -> None:178 """Saves the news content to a JSONC file.179 Arguments:180 ----181 content (List[Dict]): A news collection list.182 file_name (str): The name of the file, with no file extension183 included.184 Usage:185 ----186 >>> from finnews.client import News187 >>> # Create a new instance of the News Client.188 >>> news_client = News()189 >>> # Grab the CNBC News Client.190 >>> cnbc_news_client = news_client.cnbc191 >>> # Grab the top news.192 >>> cbnc_top_news = cnbc_news_client.news_feed(topic='top_news') 193 >>> # Save the data.194 >>> news_client.save_to_file(195 content=cbnc_top_news,196 file_name='cnbc_top_news'197 )198 """199 # Define the file name.200 file_name = 'samples/responses/{name}.jsonc'.format(name=file_name)201 # Dump the content.202 with open(file_name, 'w+') as news_data:...

Full Screen

Full Screen

clientsecrets.py

Source:clientsecrets.py Github

copy

Full Screen

1# Copyright 2014 Google Inc. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Utilities for reading OAuth 2.0 client secret files.15A client_secrets.json file contains all the information needed to interact with16an OAuth 2.0 protected service.17"""18__author__ = 'jcgregorio@google.com (Joe Gregorio)'19import json20import six21# Properties that make a client_secrets.json file valid.22TYPE_WEB = 'web'23TYPE_INSTALLED = 'installed'24VALID_CLIENT = {25 TYPE_WEB: {26 'required': [27 'client_id',28 'client_secret',29 'redirect_uris',30 'auth_uri',31 'token_uri',32 ],33 'string': [34 'client_id',35 'client_secret',36 ],37 },38 TYPE_INSTALLED: {39 'required': [40 'client_id',41 'client_secret',42 'redirect_uris',43 'auth_uri',44 'token_uri',45 ],46 'string': [47 'client_id',48 'client_secret',49 ],50 },51}52class Error(Exception):53 """Base error for this module."""54 pass55class InvalidClientSecretsError(Error):56 """Format of ClientSecrets file is invalid."""57 pass58def _validate_clientsecrets(obj):59 _INVALID_FILE_FORMAT_MSG = (60 'Invalid file format. See '61 'https://developers.google.com/api-client-library/'62 'python/guide/aaa_client_secrets')63 if obj is None:64 raise InvalidClientSecretsError(_INVALID_FILE_FORMAT_MSG)65 if len(obj) != 1:66 raise InvalidClientSecretsError(67 _INVALID_FILE_FORMAT_MSG + ' '68 'Expected a JSON object with a single property for a "web" or '69 '"installed" application')70 client_type = tuple(obj)[0]71 if client_type not in VALID_CLIENT:72 raise InvalidClientSecretsError('Unknown client type: %s.' % (client_type,))73 client_info = obj[client_type]74 for prop_name in VALID_CLIENT[client_type]['required']:75 if prop_name not in client_info:76 raise InvalidClientSecretsError(77 'Missing property "%s" in a client type of "%s".' % (prop_name,78 client_type))79 for prop_name in VALID_CLIENT[client_type]['string']:80 if client_info[prop_name].startswith('[['):81 raise InvalidClientSecretsError(82 'Property "%s" is not configured.' % prop_name)83 return client_type, client_info84def load(fp):85 obj = json.load(fp)86 return _validate_clientsecrets(obj)87def loads(s):88 obj = json.loads(s)89 return _validate_clientsecrets(obj)90def _loadfile(filename):91 try:92 with open(filename, 'r') as fp:93 obj = json.load(fp)94 except IOError:95 raise InvalidClientSecretsError('File not found: "%s"' % filename)96 return _validate_clientsecrets(obj)97def loadfile(filename, cache=None):98 """Loading of client_secrets JSON file, optionally backed by a cache.99 Typical cache storage would be App Engine memcache service,100 but you can pass in any other cache client that implements101 these methods:102 * ``get(key, namespace=ns)``103 * ``set(key, value, namespace=ns)``104 Usage::105 # without caching106 client_type, client_info = loadfile('secrets.json')107 # using App Engine memcache service108 from google.appengine.api import memcache109 client_type, client_info = loadfile('secrets.json', cache=memcache)110 Args:111 filename: string, Path to a client_secrets.json file on a filesystem.112 cache: An optional cache service client that implements get() and set()113 methods. If not specified, the file is always being loaded from114 a filesystem.115 Raises:116 InvalidClientSecretsError: In case of a validation error or some117 I/O failure. Can happen only on cache miss.118 Returns:119 (client_type, client_info) tuple, as _loadfile() normally would.120 JSON contents is validated only during first load. Cache hits are not121 validated.122 """123 _SECRET_NAMESPACE = 'oauth2client:secrets#ns'124 if not cache:125 return _loadfile(filename)126 obj = cache.get(filename, namespace=_SECRET_NAMESPACE)127 if obj is None:128 client_type, client_info = _loadfile(filename)129 obj = {client_type: client_info}130 cache.set(filename, obj, namespace=_SECRET_NAMESPACE)...

Full Screen

Full Screen

test_client.py

Source:test_client.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from resources.lib import nightcrawler3__author__ = 'bromix'4import re5import unittest6from resources.lib.content import Client7class TestClient(unittest.TestCase):8 USERNAME = 'co4hu41hkqud5cm@my10minutemail.com'9 PASSWORD = '1234567890'10 def test_get_trending(self):11 client = Client()12 result = client.get_trending('audio')13 pass14 def test_get_categories(self):15 client = Client()16 result = client.get_categories()17 pass18 def test_get_genre(self):19 client = Client()20 result = client.get_genre('techno')21 pass22 def test_search(self):23 client = Client()24 tracks = client.search('angerfist', category='sounds')25 playlist = client.search('angerfist', category='sets')26 people = client.search('angerfist', category='people')27 pass28 def test_get_favorites(self):29 client = Client()30 json_data = client.get_favorites(520685)31 pass32 def test_get_likes(self):33 client = Client()34 json_data = client.get_likes(520685)35 pass36 def test_get_playlists(self):37 client = Client()38 json_data = client.get_playlists(520685)39 pass40 def test_get_playlist(self):41 client = Client()42 json_data = client.get_playlist(55019726)43 self.assertGreater(len(json_data), 0)44 pass45 def test_get_following(self):46 client = Client()47 json_data = client.get_following(520685)48 pass49 def test_get_follower(self):50 client = Client()51 json_data = client.get_follower(520685)52 pass53 def test_get_recommended_for_track(self):54 client = Client()55 json_data = client.get_recommended_for_track(193347852, page=1)56 pass57 def test_user(self):58 client = Client()59 json_data = client.get_user(1701116)60 pass61 def test_tracks(self):62 client = Client()63 json_data = client.get_tracks(1701116)64 pass65 def test_get_track(self):66 client = Client()67 json_data = client.get_track(193347852)68 pass69 def test_get_track_url(self):70 client = Client()71 url = client.get_track_url(193347852)72 pass73 def test_resolve_url(self):74 client = Client()75 url = 'http://soundcloud.com/qdance/luna-presents-minus-is-more-december-2014-yearmix'76 json_data = client.resolve_url(url)77 url = 'http://soundcloud.com/julyukie/sets/juliana-yamasaki-new-tracks'78 json_data = client.resolve_url(url)79 pass80 def test_login(self):81 login_data = Client().login(username=self.USERNAME, password=self.PASSWORD)82 self.assertRaises(nightcrawler.CredentialsException, Client().login, username=self.USERNAME, password='0')83 pass84 def test_get_stream(self):85 login_data = Client().login(username=self.USERNAME, password=self.PASSWORD)86 client = Client(access_token=login_data['access_token'])87 json_data = client.get_stream()88 pass89 def test_follow(self):90 login_data = Client().login(username=self.USERNAME, password=self.PASSWORD)91 client = Client(access_token=login_data['access_token'])92 json_data = client.follow_user(1647796, False)93 self.assertGreater(len(json_data), 0)94 json_data = client.follow_user(1647796, True)95 self.assertGreater(len(json_data), 0)96 pass97 def test_cursor(self):98 next_href = u'https://api.soundcloud.com/me/activities/tracks/affiliated?cursor=aedb3280-55fb-11e3-8019-38efa603dd45&limit=50'99 re_match = re.match('.*cursor\=(?P<cursor>[a-z0-9-]+).*', next_href)100 page_cursor = re_match.group('cursor')101 self.assertEqual('aedb3280-55fb-11e3-8019-38efa603dd45', page_cursor)102 pass...

Full Screen

Full Screen

update_client.gypi

Source:update_client.gypi Github

copy

Full Screen

1# Copyright 2014 The Chromium Authors. All rights reserved.2# Use of this source code is governed by a BSD-style license that can be3# found in the LICENSE file.4{5 'targets': [6 {7 # GN version: //components/update_client8 'target_name': 'update_client',9 'type': 'static_library',10 'dependencies': [11 '../base/base.gyp:base',12 '../courgette/courgette.gyp:courgette_lib',13 '../crypto/crypto.gyp:crypto',14 '../third_party/libxml/libxml.gyp:libxml',15 '../third_party/zlib/google/zip.gyp:zip',16 '../net/net.gyp:net',17 '../url/url.gyp:url_lib',18 'crx_file',19 ],20 'include_dirs': [21 '..',22 ],23 'sources': [24 'update_client/action.cc',25 'update_client/action.h',26 'update_client/action_update.cc',27 'update_client/action_update.h',28 'update_client/action_update_check.cc',29 'update_client/action_update_check.h',30 'update_client/action_wait.cc',31 'update_client/action_wait.h',32 'update_client/background_downloader_win.cc',33 'update_client/background_downloader_win.h',34 'update_client/component_patcher.cc',35 'update_client/component_patcher.h',36 'update_client/component_patcher_operation.cc',37 'update_client/component_patcher_operation.h',38 'update_client/component_unpacker.cc',39 'update_client/component_unpacker.h',40 'update_client/configurator.h',41 'update_client/crx_downloader.cc',42 'update_client/crx_downloader.h',43 'update_client/crx_update_item.h',44 'update_client/ping_manager.cc',45 'update_client/ping_manager.h',46 'update_client/request_sender.cc',47 'update_client/request_sender.h',48 'update_client/task.h',49 'update_client/task_update.cc',50 'update_client/task_update.h',51 'update_client/update_checker.cc',52 'update_client/update_checker.h',53 'update_client/update_client.cc',54 'update_client/update_client.h',55 'update_client/update_client_internal.h',56 'update_client/update_engine.cc',57 'update_client/update_engine.h',58 'update_client/update_query_params.cc',59 'update_client/update_query_params.h',60 'update_client/update_query_params_delegate.cc',61 'update_client/update_query_params_delegate.h',62 'update_client/update_response.cc',63 'update_client/update_response.h',64 'update_client/url_fetcher_downloader.cc',65 'update_client/url_fetcher_downloader.h',66 'update_client/utils.cc',67 'update_client/utils.h',68 ],69 },70 {71 # GN version: //components/update_client:test_support72 'target_name': 'update_client_test_support',73 'type': 'static_library',74 'dependencies': [75 'update_client',76 '../testing/gmock.gyp:gmock',77 '../testing/gtest.gyp:gtest',78 ],79 'include_dirs': [80 '..',81 ],82 'sources': [83 'update_client/test_configurator.cc',84 'update_client/test_configurator.h',85 'update_client/test_installer.cc',86 'update_client/test_installer.h',87 'update_client/url_request_post_interceptor.cc',88 'update_client/url_request_post_interceptor.h',89 ],90 },91 ],...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var pact = require('pact-foundation/pact-node');2var pact = require('pact-foundation/pact-web');3var pact = require('pact-foundation/pact');4var pact = require('pact-node');5var pact = require('pact-web');6var pact = require('pact');

Full Screen

Using AI Code Generation

copy

Full Screen

1var pact = require('pact-foundation/pact-node');2var opts = {3};4pact.verifyPacts(opts)5 .then(function() {6 console.log("Pact Verification Complete!");7 console.log("");8 })9 .catch(function(e) {10 console.log(e);11 });

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pact-foundation-pact automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful