Ejemplo n.º 1
0
 def test_request_passes_correct_data_to_template(self):
     admin = User.objects.create_superuser("admin", "*****@*****.**", "sekrit")
     tech = User.objects.create_user("tech", "*****@*****.**", "password")
     tech.save()
     tech_test_computer = Computer(serial="TECHSERIAL",
                                   username="******",
                                   computername="compy587")
     tech_test_computer.save()
     test_secret = Secret(
         computer=tech_test_computer,
         secret="SHHH-DONT-TELL",
         date_escrowed=datetime.now(),
     )
     test_secret.save()
     secret_request = Request(secret=test_secret, requesting_user=tech)
     secret_request.save()
     client = Client()
     login_response = self.client.post("/login/", {
         "username": "******",
         "password": "******"
     },
                                       follow=True)
     response = self.client.get("/manage-requests/", follow=True)
     print(response)
     self.assertTrue(response.context["user"].is_authenticated)
Ejemplo n.º 2
0
 def setUp(self):
     self.browser = webdriver.Firefox()
     User.objects.create_superuser('admin', '*****@*****.**', 'sekrit')
     User.objects._create_user('tech', '*****@*****.**', 'password', is_staff=True, is_superuser=False)
     tech_test_computer = Computer(serial = 'TECHSERIAL')
     tech_test_computer.username = '******'
     tech_test_computer.computername ='compy587'
     tech_test_computer.save()
     secret = Secret(computer = tech_test_computer, secret = 'SHHH-DONT-TELL', date_escrowed = datetime.now())
     secret.save()
Ejemplo n.º 3
0
 def setUp(self):
     self.browser = webdriver.Firefox()
     User.objects.create_superuser("admin", "*****@*****.**", "sekrit")
     User.objects._create_user(
         "tech", "*****@*****.**", "password", is_staff=True, is_superuser=False
     )
     tech_test_computer = Computer(serial="TECHSERIAL")
     tech_test_computer.username = "******"
     tech_test_computer.computername = "compy587"
     tech_test_computer.save()
     secret = Secret(
         computer=tech_test_computer,
         secret="SHHH-DONT-TELL",
         date_escrowed=datetime.now(),
     )
     secret.save()
Ejemplo n.º 4
0
 def test_request_passes_correct_data_to_template(self):
     admin = User.objects.create_superuser('admin', '*****@*****.**', 'sekrit')
     tech = User.objects.create_user('tech', '*****@*****.**', 'password')
     tech.save()
     tech_test_computer = Computer(serial = 'TECHSERIAL', username = '******',
                                   computername ='compy587')
     tech_test_computer.save()
     test_secret = Secret(computer = tech_test_computer, secret = 'SHHH-DONT-TELL',
                     date_escrowed = datetime.now())
     test_secret.save()
     secret_request = Request(secret = test_secret, requesting_user = tech)
     secret_request.save()
     client = Client()
     login_response = self.client.post('/login/', {'username': '******', 'password': '******'}, follow=True)
     response = self.client.get('/manage-requests/', follow=True)
     print response
     self.assertTrue(response.context['user'].is_authenticated)
Ejemplo n.º 5
0
 def test_request_passes_correct_data_to_template(self):
     admin = User.objects.create_superuser('admin', '*****@*****.**', 'sekrit')
     tech = User.objects.create_user('tech', '*****@*****.**', 'password')
     tech.save()
     tech_test_computer = Computer(serial='TECHSERIAL',
                                   username='******',
                                   computername='compy587')
     tech_test_computer.save()
     test_secret = Secret(computer=tech_test_computer,
                          secret='SHHH-DONT-TELL',
                          date_escrowed=datetime.now())
     test_secret.save()
     secret_request = Request(secret=test_secret, requesting_user=tech)
     secret_request.save()
     client = Client()
     login_response = self.client.post('/login/', {
         'username': '******',
         'password': '******'
     },
                                       follow=True)
     response = self.client.get('/manage-requests/', follow=True)
     print response
     self.assertTrue(response.context['user'].is_authenticated)
Ejemplo n.º 6
0
 def test_request_passes_correct_data_to_template(self):
     admin = User.objects.create_superuser("admin", "*****@*****.**", "sekrit")
     tech = User.objects.create_user("tech", "*****@*****.**", "password")
     tech.save()
     tech_test_computer = Computer(
         serial="TECHSERIAL", username="******", computername="compy587"
     )
     tech_test_computer.save()
     test_secret = Secret(
         computer=tech_test_computer,
         secret="SHHH-DONT-TELL",
         date_escrowed=datetime.now(),
     )
     test_secret.save()
     secret_request = Request(secret=test_secret, requesting_user=tech)
     secret_request.save()
     client = Client()
     login_response = self.client.post(
         "/login/", {"username": "******", "password": "******"}, follow=True
     )
     response = self.client.get("/manage-requests/", follow=True)
     print(response)
     self.assertTrue(response.context["user"].is_authenticated)