コード例 #1
0
ファイル: tests.py プロジェクト: GestorPsi-MES/gestorpsi
class OrganizationModelTest(TestCase):
    def setUp(self):
    	self.name= 'testing organization'
        self.organization = Organization(name='testing organization')

    def testGetFisrtPhoneFull(self):
    	self.phone_type = PhoneType(description='phone type test')
        self.phone_type.save()
        self.phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                      phoneType=self.phone_type, content_object = self.organization)
        self.phone.save()

        self.assertEquals(self.organization.get_first_phone(), self.phone)
    def testGetFisrtPhoneEmpty(self):    
        self.assertEquals(self.organization.get_first_phone(), '')
   
    def testGetFisrtEmailFull(self):
    	self.email_type = EmailType(description='type email')
    	self.email_type.save()
    	self.email= Email(email='*****@*****.**',email_type= self.email_type, content_object=self.organization)    
    	self.email.save()
    	self.assertEquals(self.organization.get_first_email(), self.email)

    def testGetFisrtEmailEmpty(self):    
        self.assertEquals(self.organization.get_first_email(), '')

    def testUnicode(self):
    	self.assertEquals(self.name, unicode(self.organization))   

    def testClientNotExist(self):
    	self.assertFalse(self.organization.clients().exists())
    	#self.assertQuerysetEqual(self.organization.clients(), []) 
    
    '''
コード例 #2
0
ファイル: forms.py プロジェクト: GestorPsi-MES/gestorpsi
    def save(self, request, *args, **kwargs):
        organization = super(RegistrationForm, self).save(False, *args, **kwargs) # send_email = False 

        # add phone number to 'first' professional registered
        if self.cleaned_data['phone']:
            p = Phone()
            p.area = self.cleaned_data['phone'][1:3]
            p.phoneNumber = self.cleaned_data['phone'][5:15]
            p.phoneType_id = 2
            person = organization.care_professionals()[0]
            person.phones.add(p)
            
        # add cpf number to 'first' professional registered
        if self.cleaned_data['cpf']:
            d = Document()
            t = TypeDocument.objects.get(description='CPF')
            d.typeDocument_id = t.id
            d.document = self.cleaned_data['cpf']
            person.document.add(d)

        # add address to 'first' professional registered
        if self.cleaned_data['address']:
            a = Address()
            at = AddressType.objects.get(description='Comercial')
            a.addressType_id = at.id
            a.addressLine1 = self.cleaned_data['address']
            a.addressNumber = self.cleaned_data['address_number']
            a.zipCode = self.cleaned_data['zipcode']
            a.city_id = request.POST.get('city')
            person.address.add(a)
コード例 #3
0
ファイル: tests.py プロジェクト: tallysmartins/gestorpsi
    def setUp(self):
        self.place = Place(label='testing place', visible=True)
        place_type = PlaceType(description='a place type')
        place_type.save()
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        phone = Phone(area='23',
                      phoneNumber='45679078',
                      ext='4444',
                      phoneType=phone_type)
        phone.content_object = self.place

        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)

        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()

        address.city = city
        address.content_object = self.place

        self.place.save()
コード例 #4
0
ファイル: tests.py プロジェクト: caep-unb/gestorpsi
class testPhoneView(unittest.TestCase):
	def setUp(self):
		self.organization = Organization(name='testing organization')
		self.phone_type=PhoneType(description= 'description phone')
		self.phone_type.save()
		self.phone= Phone(area='21', phoneNumber='11111111',ext='111', 
			phoneType= self.phone_type, content_object = self.organization)
		self.phone.save()
		self.phone2 = Phone()
		self.phone2.phoneNumber = '81111111'
		self.phone2.area = 'DF'
	
	def testIsEqual(self):
	   self.assertFalse(is_equal(self.phone2))
	
	def testIfPhoneIsEqual(self):
		expected=is_equal(self.phone)
		self.assertEqual(expected, True)
		self.assertTrue(is_equal(self.phone))

	def testIfPhoneIsDeleting(self):
		phone= Phone(area='21', phoneNumber='0',ext='111', 
			phoneType= self.phone_type, content_object = self.organization)
		self.phone.save()
		self.assertIsNone(phone_delete(phone.id, phone.phoneNumber))
コード例 #5
0
class testPhoneView(unittest.TestCase):
    def setUp(self):
        self.organization = Organization(name='testing organization')
        self.phone_type = PhoneType(description='description phone')
        self.phone_type.save()
        self.phone = Phone(area='21',
                           phoneNumber='11111111',
                           ext='111',
                           phoneType=self.phone_type,
                           content_object=self.organization)
        self.phone.save()
        self.phone2 = Phone()
        self.phone2.phoneNumber = '81111111'
        self.phone2.area = 'DF'

    def testIsEqual(self):
        self.assertFalse(is_equal(self.phone2))

    def testIfPhoneIsEqual(self):
        expected = is_equal(self.phone)
        self.assertEqual(expected, True)
        self.assertTrue(is_equal(self.phone))

    def testIfPhoneIsDeleting(self):
        phone = Phone(area='21',
                      phoneNumber='0',
                      ext='111',
                      phoneType=self.phone_type,
                      content_object=self.organization)
        self.phone.save()
        self.assertIsNone(phone_delete(phone.id, phone.phoneNumber))
コード例 #6
0
    def setUp(self):
        self.place = Place(label='testing place', visible=True)
        place_type = PlaceType(description='a place type')
        place_type.save()
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        phone = Phone(area='23', phoneNumber='45679078',
                      ext='4444', phoneType=phone_type)
        phone.content_object = self.place

        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)

        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()

        address.city = city
        address.content_object = self.place

        self.place.save()
コード例 #7
0
ファイル: tests.py プロジェクト: GestorPsi-MES/gestorpsi
    def testGetFisrtPhoneFull(self):
    	self.phone_type = PhoneType(description='phone type test')
        self.phone_type.save()
        self.phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                      phoneType=self.phone_type, content_object = self.organization)
        self.phone.save()

        self.assertEquals(self.organization.get_first_phone(), self.phone)
コード例 #8
0
 def setUp(self):
     self.organization = Organization(name='testing organization')
     self.phone_type = PhoneType(description='description phone')
     self.phone_type.save()
     self.phone = Phone(area='21',
                        phoneNumber='11111111',
                        ext='111',
                        phoneType=self.phone_type,
                        content_object=self.organization)
     self.phone.save()
     self.phone2 = Phone()
     self.phone2.phoneNumber = '81111111'
     self.phone2.area = 'DF'
コード例 #9
0
ファイル: tests.py プロジェクト: GestorPsi-MES/gestorpsi
    def setUp(self):
        #organization = Organization(name='Organizacao Teste',short_name='OT')
        person = Person()
        person.name = 'Levi Moraes'
        person.id = 01
        person.active = True

        phone = Phone()
        phone.phoneNumber = '12344321'

        #person.phones = phone

        self.client = Client()
        self.client.person = person

        self.client
コード例 #10
0
ファイル: tests.py プロジェクト: caep-unb/gestorpsi
    def setUp(self):
        #organization = Organization(name='Organizacao Teste',short_name='OT')
        person = Person()
        person.name = 'Levi Moraes'
        person.id = 01
        person.active = True

        phone = Phone()
        phone.phoneNumber = '12344321'

        #person.phones = phone

        self.client = Client()
        self.client.person = person

        self.client
コード例 #11
0
 def testIfPhoneIsDeleting(self):
     phone = Phone(area='21',
                   phoneNumber='0',
                   ext='111',
                   phoneType=self.phone_type,
                   content_object=self.organization)
     self.phone.save()
     self.assertIsNone(phone_delete(phone.id, phone.phoneNumber))
コード例 #12
0
ファイル: tests.py プロジェクト: caep-unb/gestorpsi
	def setUp(self):
		self.organization = Organization(name='testing organization')
		self.phone_type=PhoneType(description= 'description phone')
		self.phone_type.save()
		self.phone= Phone(area='21', phoneNumber='11111111',ext='111', 
			phoneType= self.phone_type, content_object = self.organization)
		self.phone.save()
		self.phone2 = Phone()
		self.phone2.phoneNumber = '81111111'
		self.phone2.area = 'DF'
コード例 #13
0
ファイル: tests.py プロジェクト: GestorPsi-MES/gestorpsi
    def setUp(self):
        self.schedule = ScheduleOccurrence()
        self.schedule.reserve = True
        self.schedule.annotation = "this is schedule test"
        self.schedule.start_time = datetime.now()
        self.schedule.end_time = datetime.now()

        self.place = Place(label='testing place')
        place_type = PlaceType(description='a place type')
        place_type.save()
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        self.phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                      phoneType=phone_type)
        self.phone.content_object = self.place
        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)
        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()
        address.city = city
        address.content_object = self.place
        self.place.save()
        self.room = Room()
        self.room.place = self.place
        room_type = RoomType()
        self.room.room_type = room_type
        self.room.furniture = "tree table"
        self.schedule.room = self.room
コード例 #14
0
 def test_can_save_phone_type(self):
     phone = Phone()
     pass
コード例 #15
0
ファイル: tests.py プロジェクト: GestorPsi-MES/gestorpsi
    def setUp(self):
        self.place = Place(label='testing place')
        
        if len(PlaceType.objects.all())==0:
            place_type = PlaceType(description='Matriz')
            place_type.save()
            document = TypeDocument(description='CPF')
            document.save()
            a = AddressType(description='Comercial')
            a.save()
            room_type = RoomType()
            room_type.description = 'sala test'
            room_type.save()
            plan = Plan()
            plan.name = 'Teste 1'
            plan.value = 324.00
            plan.duration = 1
            plan.staff_size = 1
            plan.save()
            p = PaymentType()
            p.id = 1
            p.name = 'Teste 1'
            p.save()
            p  = PaymentType()
            p.id = 4
            p.name = 'Teste 4'
            p.save()
            country = Country(name='test', nationality='testing')
            country.save()
            state = State(name='test', shortName='t', country=country)
            state.save()
            city = City(name='test', state=state)
            city.save()
        else:
            place_type = PlaceType.objects.get(description='Matriz')
        self.place.place_type = place_type
        phone_type = PhoneType(description='phone type test')
        phone_type.save()
        self.phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                      phoneType=phone_type)
        self.phone.content_object = self.place
        addressType = AddressType(description='Home')
        addressType.save()
        address = Address()
        address.addressPrefix = 'Rua'
        address.addressLine1 = 'Rui Barbosa, 1234'
        address.addressLine2 = 'Anexo II - Sala 4'
        address.neighborhood = 'Centro'
        address.zipCode = '12345-123'
        address.addressType = AddressType.objects.get(pk=1)

        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()

        address.city = city
        address.content_object = self.place

        self.place.save()
コード例 #16
0
ファイル: test_utils.py プロジェクト: caep-unb/gestorpsi
def setup_required_data():
    place = Place(label='testing place')

    if len(PlaceType.objects.all())==0:
        place_type = PlaceType(description='Matriz')
        place_type.save()
        document = TypeDocument(description='CPF')
        document.save()
        a = AddressType(description='Comercial')
        a.save()
        room_type = RoomType()
        room_type.description = 'sala test'
        room_type.save()
        plan = Plan()
        plan.name = 'Teste 1'
        plan.value = 324.00
        plan.duration = 1
        plan.staff_size = 1
        plan.save()
        p = PaymentType()
        p.id = 1
        p.name = 'Teste 1'
        p.save()
        p  = PaymentType()
        p.id = 4
        p.name = 'Teste 4'
        p.save()
        country = Country(name='test', nationality='testing')
        country.save()
        state = State(name='test', shortName='t', country=country)
        state.save()
        city = City(name='test', state=state)
        city.save()
    else:
        place_type = PlaceType.objects.get(description='Matriz')
    place.place_type = place_type
    phone_type = PhoneType(description='Celular')
    phone_type.save()
    phone_type = PhoneType(description='Comercial')
    phone_type.save()
    phone_type = PhoneType(description='Fax')
    phone_type.save()
    phone_type = PhoneType(description='Recado')
    phone_type.save()
    phone_type = PhoneType(description='Residencial')
    phone_type.save()
    phone = Phone(area='23', phoneNumber='45679078', ext='4444',
                  phoneType=phone_type)
    phone.content_object = place
    addressType = AddressType(description='Home')
    addressType.save()
    address = Address()
    address.addressPrefix = 'Rua'
    address.addressLine1 = 'Rui Barbosa, 1234'
    address.addressLine2 = 'Anexo II - Sala 4'
    address.neighborhood = 'Centro'
    address.zipCode = '12345-123'
    address.addressType = AddressType.objects.get(pk=1)

    country = Country(name='test', nationality='testing')
    country.save()
    state = State(name='test', shortName='t', country=country)
    state.save()
    city = City(name='test', state=state)
    city.save()

    address.city = city
    address.content_object = place

    place.save()
コード例 #17
0
def setup_required_data():
    country = Country(name='test', nationality='testing')
    country.save()
    place = Place(label='testing place')
    state = State(name='test', shortName='t', country=country)
    state.save()
    city = City(name='test', state=state)
    city.save()

    if len(PlaceType.objects.all()) == 0:
        placeType = PlaceType(description='Matriz')
        placeType.save()
        document = TypeDocument(description='CPF')
        document.save()
        a = AddressType(description='Comercial')
        a.save()
        room_type = RoomType()
        room_type.description = 'sala test'
        room_type.save()
        plan = Plan()
        plan.name = 'Teste 1'
        plan.value = 324.00
        plan.duration = 1
        plan.staff_size = 1
        plan.save()
        p = PaymentType()
        p.id = 1
        p.name = 'Teste 1'
        p.save()
        p = PaymentType()
        p.id = 4
        p.name = 'Teste 4'
        p.save()
    else:
        placeType = PlaceType.objects.get(description='Matriz')

    place.place_type = placeType

    phone_type = PhoneType(description='Recado', pk=2)
    phone_type.save()
    content_type_temp = ContentType()
    content_type_temp.save()
    phone = Phone(area='23',
                  phoneNumber='45679078',
                  ext='4444',
                  phoneType=phone_type,
                  content_type=content_type_temp)
    phone.content_object = place
    phone.save()
    address_type = AddressType(description='Home')
    address_type.save()
    address = Address()
    address.addressPrefix = 'Rua'
    address.addressLine1 = 'Rui Barbosa, 1234'
    address.addressLine2 = 'Anexo II - Sala 4'
    address.neighborhood = 'Centro'
    address.zipCode = '12345-123'
    address.addressType = address_type

    address.city = city
    address.content_object = place
    place.save()

    issuer = Issuer(description='SSP')
    issuer.save()

    email_type = EmailType(description='Comercial')
    email_type.save()

    instant_message = IMNetwork(description='Hangouts')
    instant_message.save()