def test_json_load_dump(self): bucket = kvgit.bucket.JSONBucket(path=self.test_repo_path, author=('test', 'test@test')) bucket['foo'] = {'foo': 'bar'} self.assertEqual(bucket.get('foo'), {'foo': 'bar'}) bucket.commit() self.assertEqual(bucket.get('foo'), {'foo': 'bar'})
def test_commit_after_update(self): path = '_test_temp/cloned.git' bucket = kvgit.bucket.Bucket(path=path, remote=self.test_repo_path) bucket['foo'] = 'bar' bucket.commit() bucket.update() bucket['foo'] = 'foo' bucket.commit()
def test_multiple_commits(self): self.bucket['foo'] = 'bar' self.bucket.commit() bucket = kvgit.bucket.Bucket(path=self.test_repo_path, author=('test', 'test@test')) bucket['bar'] = 'foo' bucket.commit() self.assertEqual(bucket['foo'], 'bar')
def test_update_uncommitted(self): path = '_test_temp/cloned.git' bucket = kvgit.bucket.Bucket(path=path, remote=self.test_repo_path) bucket['foo'] = 'bar' bucket.commit() bucket.update() bucket['foo'] = 'biz' with self.assertRaises(kvgit.errors.ChangesNotCommitted): bucket.update()
def test_yaml_load_dump(self): bucket = kvgit.bucket.Bucket(path=self.test_repo_path, author=('test', 'test@test'), loader=yaml.load, dumper=yaml.dump) bucket['foo'] = {'foo': 'bar'} self.assertEqual(bucket.get('foo'), {'foo': 'bar'}) bucket.commit() self.assertEqual(bucket.get('foo'), {'foo': 'bar'})