Пример #1
0
 def setUp(self):
     self.user = User.objects.create_superuser('admin', '*****@*****.**', 'pwd')
     self.user2 = User.objects.create_superuser('admin2', '*****@*****.**', 'pwd')
     self.client.login(username='******', password='******')
     self.query = SimpleQueryFactory.build()
     self.data = model_to_dict(self.query)
     self.data["created_by_user"] = 2
Пример #2
0
 def setUp(self):
     self.user = User.objects.create_superuser('admin', '*****@*****.**', 'pwd')
     self.user2 = User.objects.create_superuser('admin2', '*****@*****.**', 'pwd')
     self.client.login(username='******', password='******')
     self.query = SimpleQueryFactory.build()
     self.data = model_to_dict(self.query)
     self.data["created_by_user"] = 2
Пример #3
0
 def setUp(self):
     self.user = User.objects.create_superuser("admin", "*****@*****.**", "pwd")
     self.user2 = User.objects.create_superuser("admin2", "*****@*****.**", "pwd")
     self.client.login(username="******", password="******")
     self.query = SimpleQueryFactory.build()
     self.data = model_to_dict(self.query)
     self.data["created_by_user"] = 2
Пример #4
0
 def test_invalid_query(self):
     self.client.login(username='******', password='******')
     query = SimpleQueryFactory.build(sql='DELETE FROM foo;')
     data = model_to_dict(query)
     del data['id']
     del data['created_by_user']
     self.client.post(reverse("query_create"), data)
     self.assertEquals(len(Query.objects.all()), 0)