Esempio n. 1
0
    def test_from_json_errors(self):
        """
        Verify that 'None' is generated correctly with invalid JSON data
        """

        self.assertIsNone(NistBeaconValue.from_json('Foo Bar'))

        self.assertIsNone(
            NistBeaconValue.from_json('{"version": "Version 1.0"}')
        )
Esempio n. 2
0
    def test_from_json(self):
        """
        Test building a beacon from JSON
        """

        expected = self.target_record
        actual = NistBeaconValue.from_json(self.target_json)

        self.assertIsInstance(actual, NistBeaconValue)
        self.assertIsNot(expected, actual)
        self.assertEqual(expected, actual)