예제 #1
0
 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'})
예제 #2
0
 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()
예제 #3
0
 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')
예제 #4
0
 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()
예제 #5
0
 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'})