Skip to content

Commit 476eaa9

Browse files
committed
Removing some older test_db functionality until it's ready for prime time
1 parent 34a2078 commit 476eaa9

File tree

3 files changed

+0
-207
lines changed

3 files changed

+0
-207
lines changed

README.md

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -621,49 +621,6 @@ self.assertTrue(num_email_results) # true if not zero
621621
Now you can parse through the email if you're looking for specific text or want to navigate to a link listed there.
622622

623623

624-
#### Database Powers:
625-
Let's say you have a test that needs to access the database. First make sure you already have a table ready. Then try this example:
626-
627-
```python
628-
from seleniumbase.core.mysql import DatabaseManager
629-
def write_data_to_db(self, the_id, the_value, the_url):
630-
db = DatabaseManager()
631-
query = """INSERT INTO myTable(the_id,the_value,the_url)
632-
VALUES (%(the_id)s,%(the_value)s,%(the_url)s)"""
633-
db.execute_query(query, {"the_id":the_id,
634-
"the_value":the_value,
635-
"the_url":the_url})
636-
```
637-
638-
Access credentials are stored in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) for your convenience (you have to add them first).
639-
640-
The following example below (taken from the Divided Test Data Manager) shows how data can be pulled from the database.
641-
642-
```python
643-
import logging
644-
from seleniumbase.core.mysql import DatabaseManager
645-
646-
def get_divided_test_data(self, test_address, is_done=0):
647-
""" Returns a list of rows """
648-
db = DatabaseManager()
649-
query = """SELECT guid,test_address,inserted_at,test_data,is_done
650-
FROM divided_test_data
651-
WHERE test_address=%(test_address)s
652-
AND is_done=%(is_done)s"""
653-
data = db.fetchall_query(query, {"test_address":test_address, "is_done":is_done})
654-
if data:
655-
return data
656-
else:
657-
logging.debug("Could not find any rows in divided_test_data.")
658-
logging.debug("DB Query = " + query % {"test_address":test_address, "is_done":is_done})
659-
return []
660-
```
661-
662-
Now you know how to pull data from your MySQL DB.
663-
664-
Divided Test usage example: If you scheduled an email to go out 3 hours from now and you wanted to check that the email gets received (but you don't want your test sitting idle for 3 hours) you can store the email credentials as a unique time-stamp for the email subject in the DB (along with a time for when it's safe for the email to be searched for) and then a later-running test can do the checking after the right amount of time has passed.
665-
666-
667624
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Wrap-Up
668625

669626
**Congratulations** on learning how to use **SeleniumBase**!

seleniumbase/core/create_db_tables.sql

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,3 @@ CREATE TABLE `test_execution` (
2828
`execution_start` bigint(20) DEFAULT '0',
2929
PRIMARY KEY (`guid`)
3030
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
31-
32-
# divided_test_data table
33-
# -----------------------------------
34-
CREATE TABLE `divided_test_data` (
35-
`guid` varchar(64) NOT NULL DEFAULT '',
36-
`test_address` varchar(255) NOT NULL DEFAULT '',
37-
`inserted_at` bigint(20) NOT NULL,
38-
`test_data` text,
39-
`is_done` tinyint(1) DEFAULT '0',
40-
`wait_time` bigint(20) DEFAULT NULL,
41-
PRIMARY KEY (`guid`),
42-
UNIQUE KEY `uuid` (`guid`)
43-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

seleniumbase/fixtures/divided_test_manager.py

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)