File: test_dhcrypto.py

package info (click to toggle)
python-secretstorage 3.3.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: python: 697; makefile: 11; sh: 8
file content (18 lines) | stat: -rw-r--r-- 556 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Tests for SecretStorage
# Author: Dmitry Shachnev, 2014-2016
# License: 3-clause BSD, see LICENSE file

# This file tests the dhcrypto module.

import unittest
from secretstorage.dhcrypto import int_to_bytes


class ConversionTest(unittest.TestCase):
    """A test case that tests conversion functions
    between bytes and long."""

    def test_int_to_bytes(self) -> None:
        self.assertEqual(int_to_bytes(1), b'\x01')
        self.assertEqual(int_to_bytes(258), b'\x01\x02')
        self.assertEqual(int_to_bytes(1 << 64), b'\x01' + b'\x00' * 8)