File: test_core_request.py

package info (click to toggle)
osc 1.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,616 kB
  • sloc: python: 33,563; sh: 1,846; xml: 157; makefile: 36; csh: 14
file content (40 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (2)
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
import unittest

from osc.core import Request


class TestRequest(unittest.TestCase):
    def test_eq(self):
        req1 = Request()
        req1.reqid = 1
        req2 = Request()
        req2.reqid = 1
        self.assertEqual(req1, req2)

    def test_lt(self):
        req1 = Request()
        req1.reqid = 1
        req2 = Request()
        req2.reqid = 2
        self.assertTrue(req1 < req2)

    def test_gt(self):
        req1 = Request()
        req1.reqid = 2
        req2 = Request()
        req2.reqid = 1
        self.assertTrue(req1 > req2)

    def test_sort(self):
        req1 = Request()
        req1.reqid = 2
        req2 = Request()
        req2.reqid = 1
        requests = [req1, req2]
        requests.sort()
        self.assertEqual(requests[0].reqid, 1)
        self.assertEqual(requests[1].reqid, 2)


if __name__ == "__main__":
    unittest.main()