def test_user_add_project(self): user_create('charlie', 'secret') api.project_create('acme-corp') user_add_project('charlie', 'acme-corp') user = api._must_find(User, 'charlie') project = api._must_find(model.Project, 'acme-corp') assert project in user.projects assert user in project.users
def test_user_add_project(self): user_create('charlie', 'secret') api.project_create('acme-corp') user_add_project('charlie', 'acme-corp') user = api._must_find(User, 'charlie') project = api._must_find(model.Project, 'acme-corp') assert project in user.projects assert user in project.users
def _new_user(self, is_admin): """Helper method for creating/switching to a new user. A new admin user will be created with the credentials: username: '******' password: '******' The argument is_admin determines whether the user has admin rights. Once the user has been created, the authentication info will be changed to that user. """ user_create('charlie', 'foo', is_admin=is_admin) flask.request = FakeAuthRequest('charlie', 'foo') local.auth = User.query.filter_by(label='charlie').one()
def _new_user(self, is_admin): """Helper method for creating/switching to a new user. A new admin user will be created with the credentials: username: '******' password: '******' The argument is_admin determines whether the user has admin rights. Once the user has been created, the authentication info will be changed to that user. """ user_create('charlie', 'foo', is_admin=is_admin) flask.request = FakeAuthRequest('charlie', 'foo') local.auth = User.query.filter_by(label='charlie').one()
def test_bad_user_remove_project(self): """Tests that removing a user from a project they're not in fails.""" user_create('charlie', 'secret') api.project_create('acme-corp') with pytest.raises(api.NotFoundError): user_remove_project('charlie', 'acme-corp')
def test_duplicate_user_add_project(self): user_create('charlie', 'secret') api.project_create('acme-corp') user_add_project('charlie', 'acme-corp') with pytest.raises(api.DuplicateError): user_add_project('charlie', 'acme-corp')
def test_delete_user_twice(self): user_create('charlie', 'foo') user_delete('charlie') with pytest.raises(api.NotFoundError): user_delete('charlie')
def test_delete_user(self): user_create('charlie', 'foo') user_delete('charlie')
def test_duplicate_user(self): user_create('charlie', 'secret') with pytest.raises(api.DuplicateError): user_create('charlie', 'password')
def test_new_user(self): api._assert_absent(User, 'charlie') user_create('charlie', 'foo')
def test_bad_user_remove_project(self): """Tests that removing a user from a project they're not in fails.""" user_create('charlie', 'secret') api.project_create('acme-corp') with pytest.raises(api.NotFoundError): user_remove_project('charlie', 'acme-corp')
def test_duplicate_user_add_project(self): user_create('charlie', 'secret') api.project_create('acme-corp') user_add_project('charlie', 'acme-corp') with pytest.raises(api.DuplicateError): user_add_project('charlie', 'acme-corp')
def test_delete_user_twice(self): user_create('charlie', 'foo') user_delete('charlie') with pytest.raises(api.NotFoundError): user_delete('charlie')
def test_delete_user(self): user_create('charlie', 'foo') user_delete('charlie')
def test_duplicate_user(self): user_create('charlie', 'secret') with pytest.raises(api.DuplicateError): user_create('charlie', 'password')
def test_new_user(self): api._assert_absent(User, 'charlie') user_create('charlie', 'foo')