Ejemplo n.º 1
0
  def test_group_bootstrap_non_empty(self):
    ident1 = model.Identity(model.IDENTITY_USER, '*****@*****.**')
    ident2 = model.Identity(model.IDENTITY_USER, '*****@*****.**')

    mocked_now = datetime.datetime(2014, 01, 01)
    self.mock_now(mocked_now)

    added = model.bootstrap_group(
        'some-group', [ident1, ident2], 'Blah description')
    self.assertTrue(added)

    ent = model.group_key('some-group').get()
    self.assertEqual(
        {
          'auth_db_rev': 1,
          'auth_db_prev_rev': None,
          'created_by': model.get_service_self_identity(),
          'created_ts': mocked_now,
          'description': 'Blah description',
          'globs': [],
          'members': [ident1, ident2],
          'modified_by': model.get_service_self_identity(),
          'modified_ts': mocked_now,
          'nested': [],
          'owners': u'administrators',
        },
        ent.to_dict())
Ejemplo n.º 2
0
    def test_group_bootstrap_non_empty(self):
        ident1 = model.Identity(model.IDENTITY_USER, '*****@*****.**')
        ident2 = model.Identity(model.IDENTITY_USER, '*****@*****.**')

        mocked_now = datetime.datetime(2014, 01, 01)
        self.mock_now(mocked_now)

        added = model.bootstrap_group('some-group', [ident1, ident2],
                                      'Blah description')
        self.assertTrue(added)

        ent = model.group_key('some-group').get()
        self.assertEqual(
            {
                'auth_db_rev': 1,
                'auth_db_prev_rev': None,
                'created_by': model.get_service_self_identity(),
                'created_ts': mocked_now,
                'description': 'Blah description',
                'globs': [],
                'members': [ident1, ident2],
                'modified_by': model.get_service_self_identity(),
                'modified_ts': mocked_now,
                'nested': [],
                'owners': u'administrators',
            }, ent.to_dict())
Ejemplo n.º 3
0
    def test_group_bootstrap_empty(self):
        mocked_now = datetime.datetime(2014, 01, 01)
        self.mock_now(mocked_now)

        added = model.bootstrap_group('some-group', [], 'Blah description')
        self.assertTrue(added)

        ent = model.group_key('some-group').get()
        self.assertEqual(
            {
                'created_by': model.get_service_self_identity(),
                'created_ts': mocked_now,
                'description': 'Blah description',
                'globs': [],
                'members': [],
                'modified_by': model.get_service_self_identity(),
                'modified_ts': mocked_now,
                'nested': []
            }, ent.to_dict())
Ejemplo n.º 4
0
  def test_group_bootstrap_empty(self):
    mocked_now = datetime.datetime(2014, 01, 01)
    self.mock_now(mocked_now)

    added = model.bootstrap_group('some-group', [], 'Blah description')
    self.assertTrue(added)

    ent = model.group_key('some-group').get()
    self.assertEqual(
        {
          'created_by': model.get_service_self_identity(),
          'created_ts': mocked_now,
          'description': 'Blah description',
          'globs': [],
          'members': [],
          'modified_by': model.get_service_self_identity(),
          'modified_ts': mocked_now,
          'nested': []
        },
        ent.to_dict())