Ejemplo n.º 1
0
class APITest(unittest.TestCase):
    '''
    Тестирование работоспособности класса для работы с API
    '''
    
    def setUp(self):
        self.api = API('')

    def runTest(self):
        answer = self.api.getProfiles(uids='durov,andrew')

        self.assertEqual(answer[0]['uid'], 1)
        self.assertEqual(answer[1]['uid'], 6492)      
        self.assertEqual(self.api.isAppUser(), "0")  
Ejemplo n.º 2
0
 def clean_url(self):
     #import pdb;pdb.set_trace()
     if 'url' not in self.cleaned_data:
         self.cleaned_data['url'] = ''
         
     matches = re.findall(r'^http://(vk\.com|vkontakte\.ru)/(.*)', 
                 self.cleaned_data['url'])
     if len(matches) == 0:
         raise ValidationError, _("URL must be within Vkontakte domain")
     screen_name = matches[0][1]
     
     api = API('')
     try:
         answer = api.getProfiles(uids=screen_name)
     except APIError, e:
         raise ValidationError, "APIError: %s" % e
Ejemplo n.º 3
0
 def setUp(self):
     self.api = API('')