def test_create_authenticate_nego_data(self):
        expected = auth_nego_data

        actual = NegoData()
        actual['nego_token'].value = auth_token

        assert expected == actual.get_data()
    def test_create_negotiate_nego_data(self):
        expected = negotiate_nego_data

        actual = NegoData()
        actual['nego_token'].value = negotiate_token

        assert expected == actual.get_data()
    def test_create_negotiate_ts_request(self):
        expected = negotiate_ts_request

        actual_nego_data = NegoData()
        actual_nego_data['nego_token'].value = negotiate_token
        actual = TSRequest()
        actual['nego_tokens'].value = actual_nego_data.get_data()

        assert expected == actual.get_data()
    def test_parse_nego_data_wrong_structure_type(self):
        test_data = hex_to_byte('31 05 A0 03 04 01 03')

        with self.assertRaises(AsnStructureException) as context:
            test_nego_data = NegoData()
            test_nego_data.parse_data(test_data)

        assert context.exception.args[
            0] == 'Expecting NegoData type to be (30), was (31)'
    def test_parse_nego_data_wrong_type(self):
        test_data = hex_to_byte('30 05 A0 03 02 01 03')

        with self.assertRaises(AsnStructureException) as context:
            test_nego_data = NegoData()
            test_nego_data.parse_data(test_data)

        assert context.exception.args[
            0] == 'Expecting negoToken type to be (4), was (2)'
    def test_parse_nego_data_wrong_sequence(self):
        test_data = hex_to_byte('30 05 A5 03 04 01 03')

        with self.assertRaises(AsnStructureException) as context:
            test_nego_data = NegoData()
            test_nego_data.parse_data(test_data)

        assert context.exception.args[
            0] == 'Expecting sequence (a0) for negoToken, was (a5)'
    def test_parse_challenge_ts_request(self):
        expected = challenge_token

        actual_ts_request = TSRequest()
        actual_ts_request.parse_data(challenge_ts_request)

        actual = NegoData()
        actual.parse_data(actual_ts_request['nego_tokens'].value)

        assert expected == actual['nego_token'].value
    def test_create_authenticate_ts_request(self):
        expected = auth_ts_request

        actual_nego_data = NegoData()
        actual_nego_data['nego_token'].value = auth_token

        actual = TSRequest()
        actual['nego_tokens'].value = actual_nego_data.get_data()
        actual['pub_key_auth'].value = pub_key_token

        assert expected == actual.get_data()