Last change
on this file since 66 was 59, checked in by Wouter Pasman, 3 years ago |
#44 manual commit of first public release, because this will cause the dist directory to move
|
File size:
898 bytes
|
Line | |
---|
1 | import unittest
|
---|
2 | from uuid import UUID
|
---|
3 |
|
---|
4 | from pyson.ObjectMapper import ObjectMapper
|
---|
5 |
|
---|
6 | from geniusweb.actions.FileLocation import FileLocation
|
---|
7 |
|
---|
8 |
|
---|
9 | class FileLocationTest (unittest.TestCase) :
|
---|
10 | pyson=ObjectMapper()
|
---|
11 | uuidstr='d5a4718a-4cc8-41d7-a988-2e2fda9154aa'
|
---|
12 | fileloc = FileLocation(UUID(uuidstr))
|
---|
13 |
|
---|
14 | def testSerialize(self):
|
---|
15 |
|
---|
16 | loc=FileLocation()
|
---|
17 | locstr = str(loc.getName())
|
---|
18 |
|
---|
19 | print(str(self.pyson.toJson(loc)))
|
---|
20 | self.assertEqual(locstr, self.pyson.toJson(loc))
|
---|
21 | self.assertEqual( self.uuidstr, self.pyson.toJson(self.fileloc))
|
---|
22 |
|
---|
23 | def testDeserialize(self):
|
---|
24 | loc=FileLocation()
|
---|
25 | locstr = str(loc.getName())
|
---|
26 |
|
---|
27 | self.assertEqual(loc, self.pyson.parse(locstr, FileLocation))
|
---|
28 |
|
---|
29 | self.assertEqual( self.fileloc, self.pyson.parse(self.uuidstr, FileLocation))
|
---|
30 |
|
---|
31 | def testTryWrite(self):
|
---|
32 | path=self.fileloc.getFile()
|
---|
33 | print(str(path))
|
---|
34 | f=open(path,"w")
|
---|
35 | f.write("test data")
|
---|
36 | f.close()
|
---|
37 | |
---|
Note:
See
TracBrowser
for help on using the repository browser.