Esempio n. 1
0
    def test_should_fail_for_invalid_dim_in_dimensions(self):
        invalid_dim = 'a'
        with self.assertRaises(exceptions.HTTPUnprocessableEntity) as context:
            common_service.parse_dimensions(invalid_dim)

        self.assertEqual(context.exception.description,
                         '%s is not a valid dimension' % invalid_dim)
Esempio n. 2
0
    def test_should_pass_for_valid_dimensions(self):
        dimensions = 'a:1,b:2'
        expected = {
            'a': '1',
            'b': '2'
        }

        self.assertDictEqual(expected,
                             common_service.parse_dimensions(dimensions))
Esempio n. 3
0
    def test_should_fail_for_empty_dim_in_dimensions(self):
        with self.assertRaises(exceptions.HTTPUnprocessableEntity) as context:
            common_service.parse_dimensions(',')

        self.assertEqual(context.exception.description,
                         'Dimension cannot be empty')