Ejemplo n.º 1
0
 def test_mget_all(self):
   '''Can get a list of all projects in ordered by create date
   '''
   project.create_or_get("foo")
   project.create_or_get("bar")
   actual = project.mget_all(offset=0, limit=10)
   eq_(len(actual), 3)
   eq_([p['project_name'] for p in actual], [self.project_name, 'foo', 'bar'])
Ejemplo n.º 2
0
 def setup_class(cls):
   '''Load data and record expected results
   '''
   with gus.config.get_db_conn().cursor() as c:
     c.execute("TRUNCATE TABLE projects CASCADE")
   cls.expected_id_list = []
   cls.expected_id_list.append(project.create_or_get('foo'))
   cls.expected_id_list.append(project.create_or_get('bar'))
   cls.expected_id_list.append(project.create_or_get('baz'))
   cls.expected_object_list = [project.get_by_id(pid)
       for pid in cls.expected_id_list]
Ejemplo n.º 3
0
 def setup(self):
   '''Clear out the database & create a test project
   '''
   # TODO: refactor database cleanup
   self.db_conn = gus.config.get_db_conn()
   with self.db_conn.cursor() as c:
     c.execute("TRUNCATE TABLE projects CASCADE")
   self.project_name = "frobnitz"
   self.project_id = project.create_or_get(self.project_name)
Ejemplo n.º 4
0
def build(project_name, branch_name, revision_id, code_path,
    venv_path):
  """Register a release candidate with the gus system.  Jenkins should call
  this after a successful build
  """
  from gus.models import project
  from gus.models import release_candidate
  project_id = project.create_or_get(project_name)
  release_candidate.create(project_id, branch_name, revision_id, code_path,
      venv_path)
Ejemplo n.º 5
0
 def setup_class(cls):
   """Load test data
   """
   with gus.config.get_db_conn().cursor() as c:
     c.execute("TRUNCATE TABLE chef_roles, chef_roles_xref_projects CASCADE")
   project_id = project.create_or_get("outland")
   cls.expected_id_list = []
   cls.expected_id_list.append(chef_role.create('www'))
   cls.expected_id_list.append(chef_role.create('admin'))
   cls.expected_id_list.append(chef_role.create('postgres'))
   chef_role.create('helios')
   for role_id in cls.expected_id_list:
     chef_role.add_role_to_project(role_id, project_id)
   cls.expected_id_list.reverse()
   cls.expected_object_list = [chef_role.get_by_id(r_id)
       for r_id in cls.expected_id_list]
   cls.args = [project_id]
Ejemplo n.º 6
0
 def test_duplicate_create(self):
   """Trying to create an existing project just returns the existing project
   """
   new_id = project.create_or_get(self.project_name)
   eq_(new_id, self.project_id)