示例#1
0
    def test3_profile_interest_in_company(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] should link an interest(Company)')

        self.user.profile.add_interest(self.company)
        interests = self.user.profile.get_interests()

        self.assertGreater(len(interests), 0, Colorizer.Red('No Company linked'))
示例#2
0
    def test8_delete_profile(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] deleting profile should delete related interest')

        Challenge.create('test challenge')
        challenge = Challenge.objects.get(title='test challenge')
        self.user.profile.add_interest(challenge)
        self.user.profile.delete()

        self.assertEqual(len(Interest.objects.all()), 0, Colorizer.Red('Deleting profile does not remove related interest objects'))
示例#3
0
    def test5_get_interested_from_challenge(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] should return a list of profile interested in a challenge')

        Challenge.create('test challenge')
        challenge = Challenge.objects.get(title='test challenge')
        self.user.profile.add_interest(challenge)

        profiles = challenge.interested()

        self.assertTrue(all(isinstance(x, Profile) for x in profiles), Colorizer.Red('Challenge related interest are not a porofile list'))
示例#4
0
    def test2_get_alternate_city_names(self):
        print Colorizer.LightPurple('\n[TEST PROFILE LOCATION] assert should respond')

        latlng = self.user.profile.location.lat+','+self.user.profile.location.lng
        response = OpenDataConnector.get_city_alternate_name_by_latlng(latlng)

        self.assertIsNotNone(
            response,
            Colorizer.Red('City alternate names is not present on response')
        )
示例#5
0
    def test2_profile_interest_in_challenge(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] should link an interest(Challenge)')

        Challenge.create('test challenge')
        challenge = Challenge.objects.get(title='test challenge')

        self.user.profile.add_interest(challenge)
        interests = self.user.profile.get_interests()

        self.assertGreater(len(interests), 0, Colorizer.Red('No Challenge linked'))
示例#6
0
 def test1_create_project(self):
     print Colorizer.LightPurple('\n[TEST project] should create a project')
     project = Project(
         title='Prova project',
         picture='images/profile/default_user_icon.png',
         details='Prova description'
     )
     project.profile = self.user.profile
     project.save()
     self.assertTrue(Project.objects.get(title='Prova project'), Colorizer.Red('Create project Error'))
示例#7
0
    def test5_add_location_to_profile(self):
        print Colorizer.LightPurple('\n[TEST PROFILE LOCATION] add location')

        location = Location.create(**self.location)

        self.user.profile.location = location
        self.user.profile.save()

        user = User.objects.filter(email=self.user.email)[0]

        self.assertIsNotNone(user.profile.location)
示例#8
0
    def test1_api_response(self):
        print Colorizer.LightPurple('\n[TEST PROFILE LOCATION] assert should respond correctly')

        latlng = self.user.profile.location.lat+','+self.user.profile.location.lng
        response = OpenDataConnector.get_by_latlng(latlng)

        self.assertLessEqual(
            response.status_code,
            202,
            Colorizer.Red('Update Response Error: \n code: %s \n Info : %s' % (response.status_code, response))
        )
示例#9
0
    def test4_profile_filter_interest_challenge(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] should return only interests that are Challenges')

        Challenge.create('test challenge')
        challenge = Challenge.objects.get(title='test challenge')
        self.user.profile.add_interest(challenge)

        self.user.profile.add_interest(self.company)
        interests = self.user.profile.get_interests(Challenge)

        self.assertTrue(all(isinstance(x, Challenge) for x in interests), Colorizer.Red('Filter interest does not return a list of challenge'))
示例#10
0
    def test7_delete_interest_from_profile(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] should should delete interest(challenge) from profile')

        Challenge.create('test challenge')
        challenge = Challenge.objects.get(title='test challenge')
        self.user.profile.add_interest(challenge)

        self.user.profile.delete_interest(Challenge, challenge.id)
        challenges = self.user.profile.get_interests(Challenge)

        self.assertEqual(len(challenges), 0, Colorizer.Red('User interest(challenge) is not deleted'))
示例#11
0
    def test_6_FindNotExisting(self):
        print(Colorizer.LightPurple('\n[ CRM Test : Find non existent party by email]'))

        # Deepcopy user
        user = copy.deepcopy(self.user)
        user.email = '*****@*****.**'
        party = Party(user)

        party.emailAddresses[0]['address'] = '*****@*****.**'
        results = party.get()

        self.assertIsNone(results, '\n[CRM-CONNECTOR ERROR] Response should be empty')
示例#12
0
    def test1_add_country_aliases(self):
        print Colorizer.LightPurple(
            '\n[TEST PROFILE LOCATION] assert should add country aliases if doesnt exist'
        )

        # response = RestCountriesConnector.get_city_alias(self.location['country'])

        print 'country aliases'
        print self.user.profile.location.country_alias

        self.assertIsNotNone(
            None,
            Colorizer.Red('City alternate names is not present on response'))
示例#13
0
    def test7_save_existing_location_add_country(self):
        print Colorizer.LightPurple(
            '\n[TEST PROFILE LOCATION] assert should add country aliases')

        Location.create(**self.location)

        location = Location.objects.filter(lat=self.location['lat'],
                                           lng=self.location['lng'])

        print location[0].country_alias

        self.assertEqual(
            len(location), 1,
            'Save Location with same lat an lng and different name, should update existing location'
        )
示例#14
0
    def test6_get_interested_from_project(self):
        print Colorizer.LightPurple('\n[TEST CHALLENGE] should return a list of profile interested in a project')

        project = Project(
            title='Prova project',
            picture='images/profile/default_user_icon.png',
            details='Prova description'
        )
        project.profile = self.user.profile
        project.save()
        self.user.profile.add_interest(project)

        profiles = project.interested()

        self.assertTrue(all(isinstance(x, Profile) for x in profiles), Colorizer.Red('Challenge related interest are not a porofile list'))
示例#15
0
    def test2_add_project_contributor(self):
        print Colorizer.LightPurple('\n[TEST project] should add a contributor to project')
        project = Project(
            title='Prova project',
            picture='images/profile/default_user_icon.png',
            details='Prova description'
        )
        project.profile = self.user.profile
        project.save()
        project.contributors.add(self.user.profile)
        project.save()

        new_project = Project.objects.get(title='Prova project')

        self.assertGreater(len(new_project.contributors.all()), 0, Colorizer.Red('Add contributor to project error'))
示例#16
0
 def test_5_Update(self):
     print(Colorizer.LightPurple('[ CRM Test : Update test ]'))
     results = self.party.create_or_update()
     self.assertTrue(True, '[CRM-CONNECTOR ERROR] Response is not a valid Party object :\n %s ')
示例#17
0
 def test_2_creation(self):
     print(Colorizer.LightPurple('[ CRM Test : Create ]'))
     results = self.party.create_or_update()
     self.assertIsInstance(results, dict, '[CRM-CONNECTOR ERROR] Creation Response should be a dictionary ')
示例#18
0
 def test_1_connection(self):
     print(Colorizer.LightPurple('\n[ CRM Test : Connection test ]'))
     response = self.party.all()
     self.assertEqual(response.status_code, 200, '[CRM-CONNECTOR ERROR] Response error :\n %s ' % response)
示例#19
0
 def test_7_findExisting(self):
     print(Colorizer.LightPurple('\n[ CRM Test : Find existing party]'))
     results = self.party.get()
     self.assertIsInstance(results, dict, '\n[CRM-CONNECTOR ERROR] Get Response should contain a dictionary')
示例#20
0
 def test_1_connection(self):
     print(Colorizer.LightPurple('\n[ CRM Test : Connection test ]'))
     response = Insight.questions(crm_ids=[self.crm_id])
     self.assertEqual(response.status_code, 200,
                      '[INSIGHT-CONNECTOR ERROR] Response error ')
示例#21
0
 def test1_create_challenge(self):
     print Colorizer.LightPurple('\n[TEST CHALLENGE] should create an interest(challenge)')
     Challenge.create('test challenge')
     self.assertTrue(Challenge.objects.get(title='test challenge'), Colorizer.Red('Create Challenge Error'))