def test_validate(self): affiliation = Affiliation.new('test', 'this is test') user = User.new('user_1', 'User', affiliation.id, False, True) with pytest.raises(AssertionError) as error: user.id = '' assert 'no id provided' == str(error.value) with pytest.raises(AssertionError) as error: user.login_id = '' assert 'no login_id provided' == str(error.value) with pytest.raises(AssertionError) as error: user.login_id = 'aaaaabbbbbcccccdd' assert 'login_id is less than 16' == str(error.value) with pytest.raises(AssertionError) as error: user.password = '' assert 'no password provided' == str(error.value) with pytest.raises(AssertionError) as error: user.password = '******' assert 'password is less than 16' == str(error.value) with pytest.raises(AssertionError) as error: user.name = '' assert 'no name provided' == str(error.value) with pytest.raises(AssertionError) as error: user.name = 'aaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjk' assert 'name is less than 50' == str(error.value)
def test_user_factory(self): user = User.new_member('tester', 'てすたろう', is_admin=True, is_operator=False) assert user.id assert 'tester' == user.login_id assert 'ptester' == user.password assert 'てすたろう' == user.name assert user.is_admin assert not user.is_operator
def test_user_factory(self): affiliation = Affiliation.new('test', 'this is test') user = User.new('tester', 'てすたろう', affiliation, is_admin=True, is_operator=False) assert user.id assert 'tester' == user.login_id assert 'ptester' == user.password assert 'てすたろう' == user.name assert user.is_admin assert not user.is_operator
def test_append_user(self, session): user_repository = UserQuery(session) user = User.new_member('test_login', 'tester', is_admin=False, is_operator=True) session.add(user) session.commit() users = user_repository.get_users() assert 4 == len(users) user = users[-1] assert user.id assert 'test_login' == user.login_id assert 'ptest_login' == user.password assert 'tester' == user.name assert not user.is_admin assert user.is_operator
def append_user(self, login_id: str, name: str, belong: Belong, is_admin: bool, is_operator: bool): user = User.new_member(login_id, name, belong, is_admin, is_operator) self._session.add(user) self._session.add(Operator.new_operator(user)) return user
def test_user_factory_identifier(self): affiliation = Affiliation.new('test', 'this is test') user_1 = User.new('user_1', 'User', affiliation.id, False, True) user_2 = User.new('user_2', 'UUSser', affiliation.id, True, False) assert user_1.id != user_2.id
def test_user_factory_identifier(self): user_1 = User.new_member('user_1', 'User', False, True) user_2 = User.new_member('user_2', 'UUSser', True, False) assert user_1.id != user_2.id