-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_web.py
More file actions
44 lines (36 loc) · 1.2 KB
/
Copy pathtest_web.py
File metadata and controls
44 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import unittest
import spider as sp
import os
import utils
class TestWeb(unittest.TestCase):
def setUp(self):
# Delete if already exists:
utils.remove_web("temp")
def tearDown(self):
# Delete if exists:
utils.remove_web("temp")
def test_create(self):
# Create web:
metadata = {"path" : os.path.join(os.getcwd(), "temp")}
myWeb = sp.createWeb(metadata)
# Check the web object got created
self.assertIsNotNone(myWeb)
# Check directories and files were created
utils.check_direc_file_lists(self,
os.getcwd(),
["temp", "temp/media", "temp/web", "temp/web/nodes", "temp/web/edges",
"temp/web/node_collections", "temp/web/edge_collections"],
["temp/metadata.json", "temp/.gitignore"]
)
def test_load(self):
# Create web:
metadata = {
"path" : os.path.join(os.getcwd(), "temp"),
"title" : "hello world"
}
myWeb = sp.createWeb(metadata)
loaded = sp.loadWeb(os.path.join(os.getcwd(), "temp"))
self.assertIsNotNone(loaded)
# Run
if __name__ == "__main__":
unittest.main()