@@ -0,0 +1,2647 @@
+import responses%0A%0Afrom django.test import TestCase, override_settings%0A%0Afrom nurseconnect.services import get_clinic_code%0A%0AFAKE_URL = %22https://username:password@external.api/%22%0A%0AFAKE_ENDPOINT_RESPONSE = %7B%0A    %22title%22: %22Facility Check Nurse Connect%22,%0A    %22headers%22: %5B%0A        %7B%0A            %22name%22: %22value%22,%0A            %22column%22: %22value%22,%0A            %22type%22: %22java.lang.String%22,%0A            %22hidden%22: False,%0A            %22meta%22: False%0A        %7D,%0A        %7B%0A            %22name%22: %22uid%22,%0A            %22column%22: %22uid%22,%0A            %22type%22: %22java.lang.String%22,%0A            %22hidden%22: False,%0A            %22meta%22: False%0A        %7D,%0A        %7B%0A            %22name%22: %22name%22,%0A            %22column%22: %22name%22,%0A            %22type%22: %22java.lang.String%22,%0A            %22hidden%22: False,%0A            %22meta%22: False%0A        %7D%0A    %5D,%0A    %22rows%22: %5B%0A        %5B%0A            %22123456%22,%0A            %22aTud78njasdf%22,%0A            %22NC Test Clinic%22%0A        %5D%0A    %5D,%0A    %22width%22: 3,%0A    %22height%22: 1%0A%7D%0A%0AFAKE_ENDPOINT_INVALID_PARAM_RESPONSE = %7B%0A    %22title%22: %22%22,%0A    %22headers%22: %5B%5D,%0A    %22rows%22: %5B%5D,%0A    %22width%22: 0,%0A    %22height%22: 0%0A%7D%0A%0A%0A@override_settings(CLINIC_CODE_API=FAKE_URL)%0Aclass ServicesTestCase(TestCase):%0A%0A    @override_settings(FAKE_CLINIC_CODE_VALIDATION=True, DEBUG=True)%0A    def test_get_clinic_code_returns_fake_data(self):%0A        clinic_code = 123456%0A%0A        self.assertEqual(%0A            get_clinic_code(clinic_code),%0A            %5B0, 1, %22fake_clinic_name%22%5D%0A        )%0A%0A    @responses.activate%0A    def test_get_clinic_code_returns_none(self):%0A        clinic_code = 123456%0A        complete_url = %22%7B%7D?criteria=value:%7B%7D%22.format(FAKE_URL, clinic_code)%0A%0A        responses.add(responses.GET, FAKE_URL, status=400)%0A        self.assertEqual(get_clinic_code(clinic_code), None)%0A%0A        responses.add(responses.GET, FAKE_URL, status=200)%0A        self.assertEqual(get_clinic_code(clinic_code), None)%0A%0A        responses.add(responses.GET, complete_url,%0A                      json=%7B'error': 'not found'%7D, status=200)%0A        self.assertEqual(get_clinic_code(clinic_code), None)%0A%0A        responses.add(responses.GET, complete_url,%0A                      json=FAKE_ENDPOINT_INVALID_PARAM_RESPONSE,%0A                      status=200)%0A        self.assertEqual(get_clinic_code(clinic_code), None)%0A%0A    @responses.activate%0A    def test_get_clinic_code_returns_values(self):%0A        clinic_code = 123456%0A        complete_url = %22%7B%7D?criteria=value:%7B%7D%22.format(FAKE_URL, clinic_code)%0A%0A        responses.add(responses.GET, complete_url,%0A                      json=FAKE_ENDPOINT_RESPONSE, status=200)%0A        self.assertEqual(%0A            get_clinic_code(clinic_code),%0A            FAKE_ENDPOINT_RESPONSE%5B%22rows%22%5D%5B0%5D)%0A

Test the get_clinic_code function