예제 #1
0
 def test__list_projects__filters_on_organization(self):
     self.client.login(username="******", password='******')
     url = reverse(self.projects_list_name) + '?' + urlencode(
         {'organization': self.lannisters.id})
     response = self.client.get(url)
     self.assertEquals(response.status_code, status.HTTP_200_OK)
     self.assertEquals(
         response.data,
         [{
             'id': self.kingslanding.id,
             'name': self.kingslanding.name,
             'organization': self.lannisters.id,
             'created': format_iso8601(self.kingslanding.created)
         }, {
             'id': self.casterlyrock.id,
             'name': self.casterlyrock.name,
             'organization': self.lannisters.id,
             'created': format_iso8601(self.casterlyrock.created)
         }])
예제 #2
0
    def test__list_projects__lists_all_projects_from_organizations_actor_belongs(
            self):
        self.client.login(username="******", password='******')
        response = self.client.get(reverse(self.projects_list_name))

        self.assertEquals(response.status_code, status.HTTP_200_OK)
        self.assertEquals(
            response.data, [{
                'id': self.winterfell.id,
                'name': self.winterfell.name,
                'organization': self.starks.id,
                'created': format_iso8601(self.winterfell.created)
            }])
예제 #3
0
 def test__patch_project__updates_name(self):
     self.client.login(username="******", password='******')
     url = reverse(self.projects_detail_name,
                   kwargs={'pk': self.winterfell.id})
     response = self.client.patch(url, {'name': 'greywater'})
     self.assertEquals(response.status_code, status.HTTP_200_OK)
     self.assertEquals(
         response.data, {
             'id': self.winterfell.id,
             'name': 'greywater',
             'organization': self.starks.id,
             'created': format_iso8601(self.winterfell.created)
         })