Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit fe1457c

Browse files
author
Brad Miller
committed
test sql activecode
1 parent 1c1380c commit fe1457c

5 files changed

Lines changed: 34 additions & 6 deletions

File tree

3 KB
Binary file not shown.

runestone/activecode/test/_sources/index.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
ActiveCode Test
24
===============
35

@@ -1304,6 +1306,8 @@ Support for SQL in the browser ? Yes!
13041306

13051307
.. activecode:: sql1
13061308
:language: sql
1307-
:dburl: http://dev.runestoneinteractive.org:8080/_static/bikeshare.db
1309+
:dburl: /_static/test.db
1310+
1311+
select * from test;
13081312

1309-
select * from trip_data limit 10;
1313+
.. :dburl: http://dev.runestoneinteractive.org:8080/_static/bikeshare.db
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Progress Bar Testing
2+
====================
3+
4+
.. activecode:: test_p1
5+
6+
print("Hello World")
7+
8+
9+
End of test1

runestone/activecode/test/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
# relative to this directory. They are copied after the builtin static files,
183183
# so a file named "default.css" will overwrite the builtin "default.css".
184184

185-
html_static_path = runestone_static_dirs()
185+
html_static_path = ['_sources/_static'] + runestone_static_dirs()
186186

187187
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
188188
# using the given strftime format.

runestone/activecode/test/test_activecode.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def test_livecode_datafile(self):
8282
print("WARNING - No response from JOBE server")
8383

8484
def test_activity_count(self):
85-
self.driver.get(self.host + "/index.html")
86-
t2 = self.driver.find_element_by_id("test1")
85+
self.driver.get(self.host + "/progresspage.html")
86+
t2 = self.driver.find_element_by_id("test_p1")
8787
self.assertIsNotNone(t2)
8888
rb = t2.find_element_by_class_name("run-button")
8989
self.assertIsNotNone(rb)
@@ -93,8 +93,23 @@ def test_activity_count(self):
9393
total = self.driver.find_element_by_id("scprogresstotal").text.strip()
9494
self.assertEqual(2, int(total))
9595
possible = self.driver.find_element_by_id("scprogressposs").text.strip()
96-
self.assertEqual(5, int(possible))
96+
# expect only 1 because the page isn't included when not using services
97+
self.assertEqual(1, int(possible))
9798
# count should not increment after a second click
9899
rb.click()
99100
total = self.driver.find_element_by_id("scprogresstotal").text.strip()
100101
self.assertEqual(2, int(total))
102+
103+
def test_sql_activecode(self):
104+
self.driver.get(self.host + "/index.html")
105+
t2 = self.driver.find_element_by_id("sql1")
106+
self.assertIsNotNone(t2)
107+
time.sleep(1)
108+
rb = t2.find_element_by_class_name("run-button")
109+
self.assertIsNotNone(rb)
110+
rb.click()
111+
res = self.driver.find_element_by_id("sql1_sql_out")
112+
self.assertIsNotNone(res)
113+
trlist = res.find_elements_by_tag_name('tr')
114+
self.assertEqual(6, len(trlist))
115+
self.assertTrue("hello" in trlist[1].text)

0 commit comments

Comments
 (0)