예제 #1
0
def update_snapshots(snapshots):
    connection = db_util.get_db_connection()
    cursor = connection.cursor()

    for snapshot in snapshots:
        db_util.update_snapshot(snapshot, cursor)

    connection.commit()
    connection.close()
예제 #2
0
    def test_update_snapshot(self):
        fake_cursor = FakeCursor()

        db_util.update_snapshot(TEST_SNAPSHOT, fake_cursor)

        self.assertEqual(len(fake_cursor.commands), 1)

        test_command = fake_cursor.commands[0]
        self.assertTrue('child_id=?,' in test_command[0])
        self.assertEqual(TEST_SNAPSHOT.child_id, test_command[1][0])
        self.assertEqual(TEST_SNAPSHOT.languages, test_command[1][14])