Пример #1
0
    def test_create_and_update(self):
        component = Component(self.env)
        component.name = 'Test'
        component.insert()

        self.assertEqual([('Test', None, None)], self.env.db_query("""
            SELECT name, owner, description FROM component
            WHERE name='Test'"""))

        # Use the same model object to update the component
        component.owner = 'joe'
        component.update()
        self.assertEqual([('Test', 'joe', None)], self.env.db_query(
            "SELECT name, owner, description FROM component WHERE name='Test'"))
Пример #2
0
    def test_create_and_update(self):
        component = Component(self.env)
        component.name = "Test"
        component.insert()

        cursor = self.db.cursor()
        cursor.execute("SELECT name,owner,description FROM component " "WHERE name='Test'")
        self.assertEqual(("Test", None, None), cursor.fetchone())

        # Use the same model object to update the component
        component.owner = "joe"
        component.update()
        cursor.execute("SELECT name,owner,description FROM component " "WHERE name='Test'")
        self.assertEqual(("Test", "joe", None), cursor.fetchone())
Пример #3
0
Файл: model.py Проект: t2y/trac
    def test_create_and_update(self):
        component = Component(self.env)
        component.name = 'Test'
        component.insert()

        self.assertEqual([('Test', None, None)], self.env.db_query("""
            SELECT name, owner, description FROM component
            WHERE name='Test'"""))

        # Use the same model object to update the component
        component.owner = 'joe'
        component.update()
        self.assertEqual([('Test', 'joe', None)], self.env.db_query(
            "SELECT name, owner, description FROM component WHERE name='Test'"))
Пример #4
0
    def test_create_and_update(self):
        component = Component(self.env)
        component.name = 'Test'
        component.insert()

        cursor = self.db.cursor()
        cursor.execute("SELECT name,owner,description FROM component "
                       "WHERE name='Test'")
        self.assertEqual(('Test', None, None), cursor.fetchone())

        # Use the same model object to update the component
        component.owner = 'joe'
        component.update()
        cursor.execute("SELECT name,owner,description FROM component "
                       "WHERE name='Test'")
        self.assertEqual(('Test', 'joe', None), cursor.fetchone())