Exemplo n.º 1
0
 def test_one_bad_search(self):
     filters = {
         'id': mocks.UUID1,
     }
     search_spec = search.SearchSpec(self.ctx, filters=filters)
     with testtools.ExpectedException(ValueError):
         organization.one(self.engine.connect(), search_spec)
Exemplo n.º 2
0
 def test_one_not_found(self):
     filters = {
         'uuid': mocks.NO_EXIST_UUID,
     }
     search_spec = search.SearchSpec(self.ctx, filters=filters)
     with testtools.ExpectedException(exc.NotFound):
         organization.one(self.engine.connect(), search_spec)
Exemplo n.º 3
0
    def test_one_by_name(self):
        filters = {
            'name': helpers.utf8_bytes('my org'),
        }
        search_spec = search.SearchSpec(self.ctx, filters=filters)
        r = organization.one(self.engine.connect(), search_spec)

        uuid_no_dash = mocks.UUID1.replace('-', '')
        expected = {
            'uuid': uuid_no_dash,
            'name': helpers.utf8_bytes('my org'),
            'slug': helpers.utf8_bytes('my-org'),
            'root_organization_uuid': uuid_no_dash,
            'parent_organization_uuid': None,
            'created_on': mocks.CREATED_ON_NAIVE,
            'generation': 1,
            'left_sequence': 1,
            'right_sequence': 2,
        }
        self.assertEqual(expected, r)