Exemplo n.º 1
0
 def test_create_project_fail(self):
     u = ElementalUser(password="******", username="******")
     u.save()
     self.client.login(username="******", password="******")
     data = {"data": "fake_testing_data_create_fail", "name": "my_project", "thumbnail": "thumb"}
     response = self.client.post(reverse("api:project-create"), data)
     self.assertEqual(response.status_code, 403)
     try:
         project = Project.objects.get(data="fake_testing_data_create_fail")
     except:
         project = None
     self.assertIsNone(project)
Exemplo n.º 2
0
 def test_create_project_fail(self):
     u = ElementalUser(password='******',
                       username='******')
     u.save()
     self.client.login(username='******', password='******')
     data = {
         'data': 'fake_testing_data_create_fail',
         'name': 'my_project'
     }
     response = self.client.post(reverse('api:project-create'), data)
     self.assertEqual(response.status_code, 403)
     try:
         project = Project.objects.get(data='fake_testing_data_create_fail')
     except:
         project = None
     self.assertIsNone(project)
Exemplo n.º 3
0
 def test_create_project_fail(self):
     u = ElementalUser(password='******', username='******')
     u.save()
     self.client.login(username='******', password='******')
     data = {
         'data': 'fake_testing_data_create_fail',
         'name': 'my_project',
         'thumbnail': 'thumb',
     }
     response = self.client.post(reverse('api:project-create'), data)
     self.assertEqual(response.status_code, 403)
     try:
         project = Project.objects.get(data='fake_testing_data_create_fail')
     except:
         project = None
     self.assertIsNone(project)
Exemplo n.º 4
0
 def test_update_project(self):
     u = ElementalUser(password="******", username="******")
     u.save()
     self.client.login(username="******", password="******")
     project = Project(name="name", user=u, data="fake_data")
     project.save()
     data = {"data": "new_data"}
     data = json.dumps(data)
     response = self.client.patch(
         reverse("api:project-data", args=[project.id]), data, content_type="application/json"
     )
     try:
         project = Project.objects.get(data="new_data")
     except:
         project = None
     self.assertIsNotNone(project)
Exemplo n.º 5
0
 def test_update_project(self):
     u = ElementalUser(password='******', username='******')
     u.save()
     self.client.login(username='******', password='******')
     project = Project(name='name', user=u, data='fake_data')
     project.save()
     data = {"data": "new_data"}
     data = json.dumps(data)
     response = self.client.patch(reverse('api:project-data',
                                          args=[project.id]),
                                  data,
                                  content_type='application/json')
     try:
         project = Project.objects.get(data='new_data')
     except:
         project = None
     self.assertIsNotNone(project)
Exemplo n.º 6
0
 def test_update_project(self):
     u = ElementalUser(password='******',
                       username='******')
     u.save()
     self.client.login(username='******', password='******')
     project = Project(name='name',
                       user=u,
                       data='fake_data')
     project.save()
     data = {
         "data": "new_data"
     }
     data = json.dumps(data)
     response = self.client.patch(reverse('api:project-data', args=[project.id]), data, content_type='application/json')
     try:
         project = Project.objects.get(data='new_data')
     except:
         project = None
     self.assertIsNotNone(project)