comparison test/test_status.py @ 36:086c68ca51d2

rename Status to RevisionStatus
author Bernhard Herzog <bh@intevation.de>
date Thu, 15 Mar 2007 12:08:15 +0100
parents b1235080e694
children c544903eeced
comparison
equal deleted inserted replaced
35:de7c1237220c 36:086c68ca51d2
3 # Bernhard Herzog <bh@intevation.de> 3 # Bernhard Herzog <bh@intevation.de>
4 # 4 #
5 # This program is free software under the GPL (>=v2) 5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with the software for details. 6 # Read the file COPYING coming with the software for details.
7 7
8 """Tests for the Status class""" 8 """Tests for the Status classes"""
9 9
10 import os 10 import os
11 import unittest 11 import unittest
12 from datetime import datetime 12 from datetime import datetime
13 13
14 from treepkg.status import Status 14 from treepkg.status import RevisionStatus
15 from treepkg.util import ensure_directory, writefile 15 from treepkg.util import ensure_directory, writefile
16 16
17 17
18 18
19 class TestStatus(unittest.TestCase): 19 class TestStatus(unittest.TestCase):
27 self.filename = self.tempfilename() 27 self.filename = self.tempfilename()
28 if os.path.exists(self.filename): 28 if os.path.exists(self.filename):
29 os.remove(self.filename) 29 os.remove(self.filename)
30 30
31 def test_status(self): 31 def test_status(self):
32 status = Status(self.filename) 32 status = RevisionStatus(self.filename)
33 status.status = "testing" 33 status.status = "testing"
34 34
35 otherstatus = Status(self.filename) 35 otherstatus = RevisionStatus(self.filename)
36 self.assertEquals(otherstatus.status, "testing") 36 self.assertEquals(otherstatus.status, "testing")
37 37
38 def test_getting_unknown_fields(self): 38 def test_getting_unknown_fields(self):
39 status = Status(self.filename) 39 status = RevisionStatus(self.filename)
40 self.assertRaises(AttributeError, getattr, status, "unknown_field") 40 self.assertRaises(AttributeError, getattr, status, "unknown_field")
41 41
42 def test_setting_unknown_fields(self): 42 def test_setting_unknown_fields(self):
43 status = Status(self.filename) 43 status = RevisionStatus(self.filename)
44 self.assertRaises(AttributeError, 44 self.assertRaises(AttributeError,
45 setattr, status, "unknown_field", "some value") 45 setattr, status, "unknown_field", "some value")
46 46
47 def test_default_values(self): 47 def test_default_values(self):
48 status = Status(self.filename) 48 status = RevisionStatus(self.filename)
49 self.assertEquals(status.status, "unknown") 49 self.assertEquals(status.status, "unknown")
50 self.assertEquals(status.start, None) 50 self.assertEquals(status.start, None)
51 self.assertEquals(status.stop, None) 51 self.assertEquals(status.stop, None)
52 52
53 def test_date(self): 53 def test_date(self):
54 timestamp = datetime(2007, 3, 9, 17, 32, 55) 54 timestamp = datetime(2007, 3, 9, 17, 32, 55)
55 status = Status(self.filename) 55 status = RevisionStatus(self.filename)
56 status.start = timestamp 56 status.start = timestamp
57 57
58 otherstatus = Status(self.filename) 58 otherstatus = RevisionStatus(self.filename)
59 self.assertEquals(otherstatus.start, timestamp) 59 self.assertEquals(otherstatus.start, timestamp)
60 60
61 def test_magic(self): 61 def test_magic(self):
62 writefile(self.filename, 62 writefile(self.filename,
63 "Some other magic\nstart: 2007-03-09 17:32:55\n") 63 "Some other magic\nstart: 2007-03-09 17:32:55\n")
64 self.assertRaises(ValueError, Status, self.filename) 64 self.assertRaises(ValueError, RevisionStatus, self.filename)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)