Ejemplo n.º 1
0
    def test_add_same_project(self):
        self.db_client.read.return_value = [fixtures.row(id=1, name="foo")]

        ws = Workspace(self.client, self.db_client, self.config)

        ws.add_project(fixtures.project(id=1, name="foo"))

        self.db_client.write.assert_not_called()
Ejemplo n.º 2
0
    def test_add_existing_project(self):
        self.db_client.read.return_value = [fixtures.row(id=1, name="foo")]

        ws = Workspace(self.client, self.db_client, self.config)

        ws.add_project(fixtures.project(id=1, name="bar"))

        self.db_client.write.assert_called_once_with(
            workspace.INSERT_PROJECT.format(
                table_name=workspace.PROJECTS_TABLE_NAME), 1, "bar")