예제 #1
0
 def test_shows_only_versions_for_ref(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     repo2 = Repo(
         p,
         "hammer",
         "ubuntu",
         "precise",
     )
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/ubuntu/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == ["trusty"]
예제 #2
0
파일: test_refs.py 프로젝트: ahills/chacra
 def test_multiple_distros_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo2 = Repo(
         p,
         "firefly",
         "centos",
         "7",
     )
     repo.path = "some_path"
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/')
     assert result.status_int == 200
     assert len(result.json) == 2
     assert result.json == {"ubuntu": ["trusty"], "centos": ['7']}
예제 #3
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_ref_does_not_exist(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/hammer/ubuntu/trusty/', expect_errors=True)
     assert result.status_int == 404
예제 #4
0
 def test_does_not_show_duplicate_distro_versions(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     repo2 = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/ubuntu/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == ["trusty"]
예제 #5
0
 def test_do_not_show_refs_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo2 = Repo(
         p,
         "hammer",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/')
     assert result.status_int == 200
     assert len(result.json) == 2
     assert result.json == {"firefly": ["ubuntu"], "hammer": ["ubuntu"]}
예제 #6
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_extra_metadata_default(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.json['extra'] == {}
예제 #7
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_sha1_does_not_exist(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url, expect_errors=True)
     assert result.status_int == 404
예제 #8
0
파일: test_flavors.py 프로젝트: ceph/chacra
 def test_default_flavor(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
     assert result.json == ['default']
예제 #9
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_recreate_head(self, session, tmpdir, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.head(url)
     assert result.status_int == 200
예제 #10
0
파일: test_flavors.py 프로젝트: ceph/chacra
 def test_multiple_flavors(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
         flavor="tcmalloc",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
     assert sorted(result.json) == sorted(['default', 'tcmalloc'])
예제 #11
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_recreate_head(self, session, tmpdir, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.head(url)
     assert result.status_int == 200
예제 #12
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_extra_metadata_default(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.json['extra'] == {}
예제 #13
0
 def test_sha1_does_not_exist(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/sha1/', expect_errors=True)
     assert result.status_int == 404
예제 #14
0
 def test_multiple_flavors(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
         flavor="tcmalloc",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(
         '/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
     assert sorted(result.json) == sorted(['default', 'tcmalloc'])
예제 #15
0
 def test_shows_only_versions_for_ref(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     repo2 = Repo(
         p,
         "hammer",
         "ubuntu",
         "precise",
         sha1="head",
     )
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/ubuntu/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == ["trusty"]
예제 #16
0
 def test_does_not_show_duplicate_distro_versions(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     repo2 = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/ubuntu/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == ["trusty"]
예제 #17
0
 def test_show_multiple_refs_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="HEAD",
     )
     repo2 = Repo(
         p,
         "hammer",
         "ubuntu",
         "trusty",
         sha1="HEAD",
     )
     repo.path = "some_path"
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/')
     assert result.status_int == 200
     assert len(result.json) == 2
     assert result.json == {"firefly": ["HEAD"], "hammer": ["HEAD"]}
예제 #18
0
 def test_single_project_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"foobar": ["firefly"]}
예제 #19
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_repo_type(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["type"] is None
예제 #20
0
 def test_default_flavor(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(
         '/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
     assert result.json == ['default']
예제 #21
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_recreate_head(self, session, tmpdir):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.head(
         "/repos/foobar/firefly/ubuntu/trusty/recreate"
     )
     assert result.status_int == 200
예제 #22
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_repo_type(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["type"] is None
예제 #23
0
 def test_multiple_distros_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo2 = Repo(
         p,
         "firefly",
         "centos",
         "7",
         sha1="head",
     )
     repo.path = "some_path"
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/')
     assert result.status_int == 200
     assert len(result.json) == 2
     assert result.json == {"ubuntu": ["trusty"], "centos": ['7']}
예제 #24
0
 def test_single_project_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"foobar": ["firefly"]}
예제 #25
0
 def test_get_single_project(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"ubuntu": ["trusty"]}
예제 #26
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_repo_exists(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/ubuntu/trusty/')
     assert result.status_int == 200
     assert result.json["distro_version"] == "trusty"
     assert result.json["distro"] == "ubuntu"
     assert result.json["ref"] == "firefly"
예제 #27
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_recreate(self, session, tmpdir, url):
     path = str(tmpdir)
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = path
     session.commit()
     result = session.app.post_json(url, params={})
     assert os.path.exists(path) is False
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
예제 #28
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_recreate(self, session, tmpdir, url):
     path = str(tmpdir)
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = path
     session.commit()
     result = session.app.post_json(url, params={})
     assert os.path.exists(path) is False
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
예제 #29
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_recreate_invalid_path(self, session, tmpdir, url):
     path = str(tmpdir)
     invalid_path = os.path.join(path, 'invalid_path')
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = invalid_path
     session.commit()
     result = session.app.post_json(url)
     assert os.path.exists(path) is True
     assert result.json['needs_update'] is True
예제 #30
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_update_empty_json(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=dict(),
         expect_errors=True,
     )
     assert result.status_int == 400
예제 #31
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_recreate_invalid_path(self, session, tmpdir, url):
     path = str(tmpdir)
     invalid_path = os.path.join(path, 'invalid_path')
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = invalid_path
     session.commit()
     result = session.app.post_json(url)
     assert os.path.exists(path) is True
     assert result.json['needs_update'] is True
예제 #32
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update_empty_json(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.post_json(
         url,
         params=dict(),
         expect_errors=True,
     )
     assert result.status_int == 400
예제 #33
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update(self, session, tmpdir, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo.get(1)
     repo.needs_update = False
     session.commit()
     result = session.app.post_json(url, params={})
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
예제 #34
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_repo_exists(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["distro_version"] == "trusty"
     assert result.json["distro"] == "ubuntu"
     assert result.json["ref"] == "firefly"
     assert result.json["sha1"] == "head"
예제 #35
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_repo_exists(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["distro_version"] == "trusty"
     assert result.json["distro"] == "ubuntu"
     assert result.json["ref"] == "firefly"
     assert result.json["sha1"] == "head"
예제 #36
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_recreate(self, session, tmpdir):
     path = str(tmpdir)
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = path
     session.commit()
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/recreate",
         params={}
     )
     assert os.path.exists(path) is False
     assert result.json['needs_update'] is True
예제 #37
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_update_invalid_field_value(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     data = {"distro": 123}
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
예제 #38
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update_invalid_field_value(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     data = {"distro": 123}
     result = session.app.post_json(
         url,
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
예제 #39
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_update(self, session, tmpdir):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     repo.get(1)
     repo.needs_update = False
     session.commit()
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/update",
         params={}
     )
     assert result.json['needs_update'] is True
예제 #40
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_add_extra_metadata(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {'version': '0.94.8', 'distros': ['precise']}
     session.app.post_json(
         url,
         params=data,
     )
     updated_repo = Repo.get(repo_id)
     assert updated_repo.extra == {"version": "0.94.8", 'distros': ['precise']}
예제 #41
0
 def test_does_show_refs_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     Repo(
         p,
         "hammer",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert sorted(result.json["foobar"]) == sorted(["firefly", "hammer"])
예제 #42
0
 def test_does_show_refs_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     Repo(
         p,
         "hammer",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert sorted(result.json["foobar"]) == sorted(["firefly", "hammer"])
예제 #43
0
파일: test_refs.py 프로젝트: ahills/chacra
 def test_do_not_show_distro_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     Repo(
         p,
         "firefly",
         "centos",
         "7",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"ubuntu": ["trusty"]}
예제 #44
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update(self, session, tmpdir, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo.get(1)
     repo.needs_update = False
     session.commit()
     result = session.app.post_json(
         url,
         params={}
     )
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
예제 #45
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_update_invalid_fields(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"bogus": "7", "distro": "centos"}
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro == "ubuntu"
예제 #46
0
파일: test_repos.py 프로젝트: ahills/chacra
 def test_update_single_field(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"distro_version": "precise"}
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=data,
     )
     assert result.status_int == 200
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro_version == "precise"
     assert result.json['distro_version'] == "precise"
예제 #47
0
 def test_does_show_sha1_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="sha1",
     )
     Repo(
         p,
         "firefly",
         "centos",
         "7",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/')
     assert len(result.json) == 2
     assert "sha1" in result.json
예제 #48
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update_single_field(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"distro_version": "precise"}
     result = session.app.post_json(
         url,
         params=data,
     )
     assert result.status_int == 200
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro_version == "precise"
     assert result.json['distro_version'] == "precise"
예제 #49
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update_invalid_fields(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"bogus": "7", "distro": "centos"}
     result = session.app.post_json(
         url,
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro == "ubuntu"
예제 #50
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_add_extra_metadata(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {'version': '0.94.8', 'distros': ['precise']}
     session.app.post_json(
         url,
         params=data,
     )
     updated_repo = Repo.get(repo_id)
     assert updated_repo.extra == {
         "version": "0.94.8",
         'distros': ['precise']
     }
예제 #51
0
파일: test_repos.py 프로젝트: ceph/chacra
 def test_update_multiple_fields(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"distro_version": "7", "distro": "centos"}
     result = session.app.post_json(
         url,
         params=data,
     )
     assert result.status_int == 200
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro_version == "7"
     assert updated_repo.distro == "centos"
     assert result.json['distro_version'] == "7"
     assert result.json['distro'] == "centos"
예제 #52
0
파일: test_repos.py 프로젝트: ceph/chacra
    def test_create(self, session, url):
        p = Project('foobar')
        repo = Repo(
            p,
            "firefly",
            "ubuntu",
            "trusty",
            sha1="head",
        )
        repo.path = "some_path"
        session.commit()
        repo.get(1)
        repo.needs_update = False
        session.commit()
        # create a raw type repo
        result = session.app.post_json(
            url,
            params={'type': 'raw'},
        )
        assert result.json['type'] == 'raw'

        # adding an rpm doesn't change the type
        Binary(
            'binary.rpm',
            p,
            repo,
            ref='firefly',
            sha1='head',
            flavor='default',
            distro='ubuntu',
            distro_version='trusty',
            arch='arm64',
        )
        session.commit()
        result = session.app.get(url)
        assert result.json['type'] == 'raw'