Example #1
0
    def test_bad_init(self):
        """Test breaking the presentation context manager init"""
        req = PresentationContext()
        req.context_id = 1
        req.abstract_syntax = '1.1.1'
        req.transfer_syntax = ['1.2.840.10008.1.2']
        acc = PresentationContext()
        acc.context_id = 1
        acc.abstract_syntax = '1.1.1'
        acc.transfer_syntax = ['1.2.840.10008.1.2']

        pcm = PresentationContextManager()
        self.assertEqual(pcm.requestor_contexts, [])
        self.assertEqual(pcm.acceptor_contexts, [])

        with self.assertRaises(TypeError):
            pcm = PresentationContextManager(req, [acc])
Example #2
0
    def test_good_init(self):
        """Test the presentation context manager init"""
        req = PresentationContext()
        req.context_id = 1
        req.abstract_syntax = '1.1.1'
        req.transfer_syntax = ['1.2.840.10008.1.2']
        acc = PresentationContext()
        acc.context_id = 1
        acc.abstract_syntax = '1.1.1'
        acc.transfer_syntax = ['1.2.840.10008.1.2']

        pcm = PresentationContextManager()
        self.assertEqual(pcm.requestor_contexts, [])
        self.assertEqual(pcm.acceptor_contexts, [])

        pcm = PresentationContextManager([req], [acc])
        self.assertEqual(pcm.requestor_contexts, [req])
        self.assertEqual(pcm.acceptor_contexts, [acc])