def setUp(self): self.idea = Idea.Factory(participant__username="******") self.user = User.Factory() self.auth_header = { 'HTTP_AUTHORIZATION': 'Apikey %s:%s' % (self.user.username, self.user.api_key.key) }
def setUp(self): # self.user = User.objects.create_user(username="******", password="******", email="*****@*****.**") #ApiKey.objects.create(user=self.user) self.user = User.Factory() self.auth_header = { 'HTTP_AUTHORIZATION': 'Apikey %s:%s' % (self.user.username, self.user.api_key.key) } print self.auth_header self.groups = { 'admins': Group.Factory(name='admins'), 'participants': Group.Factory(name='participants'), }
def test_create_session(self): """ Test create a session In order to acces to the her data, a user should create a session using basic authentication. Then using the api_key returned as part of the session she will be authorized to access other respurces. (token auth) TODO: Timed token invalidation. Right now you can renovate your api key """ username = '******' user = User.Factory(username=username) response = self.client.post('/api/v1/sessions/', content_type='application/json', **self.get_auth_headers(username=username, password='******')) logging.info(response) self.assertEqual(response.status_code, 201)
def setUp(self): self.user = User.Factory() self.auth_header = { 'HTTP_AUTHORIZATION': 'Apikey %s:%s' % (self.user.username, self.user.api_key.key) }
def setUp(self): self.user = User.Factory(username="******")