Esempio n. 1
0
 def test_delete_test_suite(self):
     ts = TestSuite(name='Zamboni',
                    slug='zamboni',
                    default_url='http://127.0.0.1:8001/qunit/')
     ts.save()
     r = self.client.get(reverse('system.delete_test_suite', args=[ts.id]))
     self.assertRedirects(r, reverse('system.test_suites'))
     eq_(TestSuite.objects.filter(slug='zamboni').count(), 0)
     eq_(Token.objects.filter(test_suite=ts).count(), 0)
Esempio n. 2
0
 def test_generate_token(self):
     ts = TestSuite(name='Zamboni',
                    slug='zamboni',
                    default_url='http://127.0.0.1:8001/qunit/')
     ts.save()
     r = self.client.post(reverse('system.generate_token'),
                          {'test_suite_id': ts.id})
     self.assertRedirects(r, reverse('system.test_suites'))
     tk = Token.objects.get(test_suite=ts)
Esempio n. 3
0
 def setUp(self):
     user_agent = ('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; '
                   'en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12')
     worker = Worker.objects.create()
     worker.parse_user_agent(user_agent)
     worker.save()
     ts = TestSuite(name='Zamboni',
                    slug='zamboni',
                    default_url='http://server/qunit1.html')
     ts.save()
     token = Token.create(ts)
     r = self.client.post(reverse('system.start_tests'),
                          data={
                              'browsers': 'firefox',
                              'token': token,
                              'name': ts.slug
                          })
     eq_(r.status_code, 200)
     r = self.client.post(reverse('work.query'),
                          dict(worker_id=worker.id, user_agent=user_agent))
     eq_(r.status_code, 200)
     data = json.loads(r.content)
     self.work_queue_id = data['work_queue_id']
Esempio n. 4
0
 def test_edit_test_suite(self):
     ts = TestSuite(name='Zamboni',
                    slug='zamboni',
                    default_url='http://127.0.0.1:8001/qunit/')
     ts.save()
     orig_ts = ts
     tokens = Token.objects.count()
     r = self.client.post(
         reverse('system.create_edit_test_suite', args=[ts.id]), {
             'name': 'Zamboni2',
             'slug': 'zamboni2',
             'default_url': 'http://127.0.0.1:8001/qunit2/'
         })
     no_form_errors(r)
     self.assertRedirects(r, reverse('system.test_suites'))
     ts = TestSuite.objects.get(pk=orig_ts.id)
     eq_(ts.name, 'Zamboni2')
     eq_(ts.slug, 'zamboni2')
     eq_(ts.default_url, 'http://127.0.0.1:8001/qunit2/')
     eq_(ts.created.timetuple()[0:5], orig_ts.created.timetuple()[0:5])
     assert ts.last_modified != orig_ts.last_modified
     # Make sure no new tokens were created
     eq_(Token.objects.count(), tokens)