def create_board(self, name, user_id): """Create a board to group notes.""" if user_id is None: raise ValueError("User ID required to create board.") board = Board(name=name) board = self.storage.save_board(board) self.add_user_to_board(board.id, user_id, role="owner") return board
def test_move_note_success(self): """Edit the board for a note.""" board = Board(name="the best notes") board = self.storage.save_board(board) self.use_cases.move_note(note_id=self.note.id, board_id=board.id) new_note = self.storage.get_note(self.note.id) self.assertEqual(new_note.board_id, board.id)
def test_edit_note_board_and_save(self): """Edit the board for a note.""" board = Board(name="the best notes") board = self.storage.save_board(board) note = self.note.replace(board_id=board.id) self.use_cases.save_note(note) new_note = self.storage.get_note(self.note.id) self.assertEqual(note, new_note) self.assertEqual(new_note.board_id, board.id)
def test_has_perm(self): """User with valid role on board should have some permissions.""" role = "editor" board = notes_storage.save_board(Board(name="Fox & Raccoon")) user = account_storage.create_user( User(name="Bird", email="*****@*****.**"), "w0rm") notes_storage.save_board_user(board.id, user.id, role) has_perm = self.get_perms(user.id, board.id, "edit_note") self.assertEqual(has_perm, True)
def setUp(self): self.use_cases, self.storage, self.accounts_storage = init() self.user = User(id=1, name="Bob", email="*****@*****.**") self.accounts_storage.create_user(self.user, "sl4ck") self.board = Board(id=1, name="The Book of the SubGenius") self.storage.save_board(self.board) self.storage.save_board_user(board_id=self.board.id, user_id=self.user.id, role="owner")
def setUp(self): self.use_cases, self.storage, self.accounts_storage = init() self.user = self.accounts_storage.create_user( User(name="Bob", email="*****@*****.**"), "sl4ck") self.board = self.storage.save_board( Board(name="The Book of the SubGenius")) self.note = self.storage.save_note( Note(title="Stark fist of removal", body="...", board_id=self.board.id)) self.storage.save_board_user(user_id=self.user.id, board_id=self.board.id, role="owner")
def setUp(self): self.use_cases, self.storage, self.accounts_storage = init() self.user = User(id=1, name="Bob", email="*****@*****.**") self.board = Board(id=1, name="The Book of the SubGenius") self.storage.save_board(self.board)
def setUp(self): self.use_cases, self.storage, _ = init() self.board = self.storage.save_board(Board(name="mediocre notes")) self.note = Note(title="title", body="body", board_id=self.board.id) self.note = self.storage.save_note(self.note)