Esempio n. 1
0
    def test_create_user(self):
	crawler = Crawler(self)

	self.login(username='******', password='******')

	crawler.visit('/users/')
	crawler.crawl()

	self.assertEquals(crawler.types['/users/create'],
			  'text/html')

	r = self.client.get('/users/create')
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'MCID')

	mcid = r.context[0]['mcid']
	test_user = dict(mcid = mcid,
			 first_name = 'Bob',
			 last_name = 'Marley')

	r = self.client.post('/users/create', test_user)
	self.assertRedirects(r, 'user?mcid=' + mcid)

	r = self.client.get('/users/')
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'Marley')

	crawler = Crawler(self)
	crawler.visit('/')
	crawler.crawl()
Esempio n. 2
0
    def test_crawl_logged_in(self):
        crawler = Crawler(self)

        self.login(username="******", password="******")

        crawler.visit("/")
        crawler.crawl()
Esempio n. 3
0
    def test_create_idp(self):
	crawler = Crawler(self)

	self.login(username='******', password='******')

	crawler.visit('/idps/')
	crawler.crawl()

	self.assertEquals(crawler.types['/idps/add'],
			  'text/html')

	test_idp = dict(source_id = 'aol',
			name = 'AOL',
			domain = 'www.aol.com',
			format = 'test')

	r = self.client.post('/idps/add', test_idp)

	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'Must have one percent')

	test_idp['format'] = 'http://openid.aol.com/%'

	r = self.client.post('/idps/add', test_idp)
	self.assertRedirects(r, '.')

	r = self.client.get('/idps/')
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'http://openid.aol')

	crawler = Crawler(self)
	crawler.visit('/idps/')
	crawler.crawl()
Esempio n. 4
0
    def test_crawl_logged_in(self):
	crawler = Crawler(self)

	self.login(username='******', password='******')

	crawler.visit('/')
	crawler.crawl()
Esempio n. 5
0
    def test_crawl_logged_out(self):
        crawler = Crawler(self)

        r = self.get("/")
        self.assertRedirects(r, "/account/login?next=/")

        crawler.visit("/account/login")
        crawler.crawl()
Esempio n. 6
0
    def test_create_admin(self):
	crawler = Crawler(self)

	self.login(username='******', password='******')

	crawler.visit('/admins/')
	crawler.crawl()

	self.assertEquals(crawler.types['/admins/create'],
			  'text/html')

	test_admin = dict(username = '******',
			  first_name = 'Bob',
			  last_name = 'Marley',
			  email = 'test',
			  pw1 = 'welcome',
			  pw2 = 'welcome')

	r = self.client.post('/admins/create', test_admin)
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'Enter a valid e-mail')

	test_admin['email'] = '*****@*****.**'
	test_admin['pw2'] = 'mismatch'

	r = self.client.post('/admins/create', test_admin)
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'Must match password above')

	test_admin['pw2'] = test_admin['pw1']
	r = self.client.post('/admins/create', test_admin)
	self.assertRedirects(r, '.')

	r = self.client.get('/admins/')
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'Marley')

	r = self.client.get('/account/logout')
	r = self.client.post('/account/login',
			     dict(username='******', password='******'))
	self.assertRedirects(r, '/')
Esempio n. 7
0
    def test_crawl_logged_in(self):
        crawler = Crawler(self)

        self.login(username='******', password='******')

        crawler.visit('/')
        crawler.crawl()
Esempio n. 8
0
    def test_crawl_logged_out(self):
        crawler = Crawler(self)

        r = self.get('/')
        self.assertRedirects(r, '/account/login?next=/')

        crawler.visit('/account/login')
        crawler.crawl()
Esempio n. 9
0
    def test_create_admin(self):
        crawler = Crawler(self)

        self.login(username='******', password='******')

        crawler.visit('/admins/')
        crawler.crawl()

        self.assertEquals(crawler.types['/admins/create'], 'text/html')

        test_admin = dict(username='******',
                          first_name='Bob',
                          last_name='Marley',
                          email='test',
                          pw1='welcome',
                          pw2='welcome')

        r = self.client.post('/admins/create', test_admin)
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'Enter a valid e-mail')

        test_admin['email'] = '*****@*****.**'
        test_admin['pw2'] = 'mismatch'

        r = self.client.post('/admins/create', test_admin)
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'Must match password above')

        test_admin['pw2'] = test_admin['pw1']
        r = self.client.post('/admins/create', test_admin)
        self.assertRedirects(r, '.')

        r = self.client.get('/admins/')
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'Marley')

        r = self.client.get('/account/logout')
        r = self.client.post('/account/login',
                             dict(username='******', password='******'))
        self.assertRedirects(r, '/')
Esempio n. 10
0
    def test_create_user(self):
        crawler = Crawler(self)

        self.login(username='******', password='******')

        crawler.visit('/users/')
        crawler.crawl()

        self.assertEquals(crawler.types['/users/create'], 'text/html')

        r = self.client.get('/users/create')
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'MCID')

        mcid = r.context[0]['mcid']
        test_user = dict(mcid=mcid, first_name='Bob', last_name='Marley')

        r = self.client.post('/users/create', test_user)
        self.assertRedirects(r, 'user?mcid=' + mcid)

        r = self.client.get('/users/')
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'Marley')

        crawler = Crawler(self)
        crawler.visit('/')
        crawler.crawl()
Esempio n. 11
0
    def test_create_idp(self):
        crawler = Crawler(self)

        self.login(username='******', password='******')

        crawler.visit('/idps/')
        crawler.crawl()

        self.assertEquals(crawler.types['/idps/add'], 'text/html')

        test_idp = dict(source_id='aol',
                        name='AOL',
                        domain='www.aol.com',
                        format='test')

        r = self.client.post('/idps/add', test_idp)

        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'Must have one percent')

        test_idp['format'] = 'http://openid.aol.com/%'

        r = self.client.post('/idps/add', test_idp)
        self.assertRedirects(r, '.')

        r = self.client.get('/idps/')
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'http://openid.aol')

        crawler = Crawler(self)
        crawler.visit('/idps/')
        crawler.crawl()
Esempio n. 12
0
    def test_create_group(self):
        crawler = Crawler(self)

        self.login(username='******', password='******')

        crawler.visit('/groups/')
        crawler.crawl()

        self.assertEquals(crawler.types['/groups/wiz_create'], 'text/html')

        mcid1 = self.create_user(first_name='Alphonse',
                                 last_name='Angstrom',
                                 email='*****@*****.**',
                                 pw='welcome')

        mcid2 = self.create_user(first_name='Bertrand',
                                 last_name='Bulstrod',
                                 email='*****@*****.**',
                                 pw='welcome')

        r = self.client.get('/groups/wiz_create')
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, mcid1)
        self.assertContains(r, mcid2)
        self.assertContains(r, 'Alphonse')
        self.assertContains(r, 'Bertrand')

        r = self.client.post('/groups/wiz_create', dict(owner_mcid=mcid1,
                                                        id=''))
        id = r['Location'][12:]
        self.assertRedirects(r, 'wiz_name?id=%s' % id)

        r = self.get('/groups/wiz_name?id=%s' % id)
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)

        user_url_file = 'wiz_users?id=%s' % id
        user_url_path = '/groups'
        user_url = user_url_path + '/' + user_url_file
        r = self.client.post('/groups/wiz_name',
                             dict(id=id, name="Alphonse's Group"))
        self.assertRedirects(r, user_url_file)

        r = self.get(user_url)
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)

        # Add user
        r = self.client.post('/groups/wiz_users', {
            'id': id,
            'mcid': mcid2,
            'add.x': 10,
            'add.y': 6
        })
        self.assertRedirects(r, user_url_file)

        r = self.get(user_url)
        self.assertEquals(r.status_code, 200)
        self.assertValidXHTML(r.content)
        self.assertContains(r, 'Bertrand')

        r = self.client.post('/groups/wiz_users', {
            'id': id,
            'mcid': mcid2,
            'remove.x': 10,
            'remove.y': 6
        })
        self.assertRedirects(r, user_url_file)

        r = self.client.post('/groups/wiz_users', {
            'id': id,
            'finish': 'finish'
        })
        self.assertRedirects(r, '.')

        crawler = Crawler(self)
        crawler.visit('/')
        crawler.crawl()
Esempio n. 13
0
    def test_create_group(self):
	crawler = Crawler(self)

	self.login(username='******', password='******')

	crawler.visit('/groups/')
	crawler.crawl()

	self.assertEquals(crawler.types['/groups/wiz_create'],
			  'text/html')

	mcid1 = self.create_user(first_name='Alphonse', last_name='Angstrom',
				 email='*****@*****.**', pw='welcome')

	mcid2 = self.create_user(first_name='Bertrand', last_name='Bulstrod',
				 email='*****@*****.**', pw='welcome')

	r = self.client.get('/groups/wiz_create')
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, mcid1)
	self.assertContains(r, mcid2)
	self.assertContains(r, 'Alphonse')
	self.assertContains(r, 'Bertrand')	

	r = self.client.post('/groups/wiz_create',
			     dict(owner_mcid = mcid1,
				  id = ''))
	id = r['Location'][12:]
	self.assertRedirects(r, 'wiz_name?id=%s' % id)

	r = self.get('/groups/wiz_name?id=%s' % id)
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)

	user_url_file = 'wiz_users?id=%s' % id
	user_url_path = '/groups'
	user_url = user_url_path + '/' + user_url_file
	r = self.client.post('/groups/wiz_name',
			     dict(id = id, name = "Alphonse's Group"))
	self.assertRedirects(r, user_url_file)

	r = self.get(user_url)
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)

	# Add user
	r = self.client.post('/groups/wiz_users',
			     {'id': id, 'mcid': mcid2, 'add.x': 10, 'add.y': 6})
	self.assertRedirects(r, user_url_file)

	r = self.get(user_url)
	self.assertEquals(r.status_code, 200)
	self.assertValidXHTML(r.content)
	self.assertContains(r, 'Bertrand')

	r = self.client.post('/groups/wiz_users',
			     {'id': id, 'mcid': mcid2, 'remove.x': 10, 'remove.y': 6})
	self.assertRedirects(r, user_url_file)

	r = self.client.post('/groups/wiz_users',
			     {'id': id, 'finish': 'finish'})
	self.assertRedirects(r, '.')

	crawler = Crawler(self)
	crawler.visit('/')
	crawler.crawl()