Skip to content

Commit 0f30d71

Browse files
committed
Update tests
1 parent 04835d4 commit 0f30d71

File tree

8 files changed

+38
-162
lines changed

8 files changed

+38
-162
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ omit =
1010
conftest.py
1111
local_settings.py
1212
/home/travis/virtualenv*
13+
manage.py

conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from django.core.management import call_command
44

5+
from main.models import Repo
56
from devel.models import UserProfile
67

78

@@ -31,8 +32,9 @@ def staff_groups(db):
3132
call_command('loaddata', 'devel/fixtures/staff_groups.json')
3233

3334

35+
# TODO: test with non-admin user fixture
3436
@pytest.fixture
35-
def admin_user_profile(admin_user):
37+
def admin_user_profile(admin_user, arches, repos):
3638
profile = UserProfile.objects.create(user=admin_user,
3739
public_email="[email protected]")
3840
yield profile

packages/tests.py

Lines changed: 0 additions & 160 deletions
This file was deleted.

packages/tests/__init__.py

Whitespace-only changes.

packages/tests/test_adoptorphan_packages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def request(client, pkgid, adopt=True):
1313
return client.post('/packages/update/', data, follow=True)
1414

1515

16-
1716
def test_wrong_request(admin_client, arches, repos, package):
1817
# TODO(jelle): fix
1918
pkg = Package.objects.first()

packages/tests/test_unflag.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
def assert_flag_package(client):
2+
data = {
3+
'website': '',
4+
'email': '[email protected]',
5+
'message': 'new linux version',
6+
}
7+
8+
# TODO: hardcoded package name
9+
response = client.post('/packages/core/x86_64/linux/flag/',
10+
data,
11+
follow=True)
12+
assert response.status_code == 200
13+
14+
15+
def test_unflag_package_404(admin_user_profile, admin_client):
16+
response = admin_client.get('/packages/core/x86_64/fooobar/unflag/')
17+
assert response.status_code == 404
18+
19+
response = admin_client.get('/packages/core/x86_64/fooobar/unflag/all/')
20+
assert response.status_code == 404
21+
22+
23+
def test_unflag_package(admin_user_profile, admin_client, package):
24+
assert_flag_package(admin_client)
25+
response = admin_client.get('/packages/core/x86_64/linux/unflag/', follow=True)
26+
assert response.status_code == 200
27+
assert 'Flag linux as out-of-date' in response.content.decode()
28+
29+
30+
def test_unflag_all_package(admin_user_profile, admin_client, package):
31+
assert_flag_package(admin_client)
32+
response = admin_client.get('/packages/core/x86_64/linux/unflag/all/', follow=True)
33+
assert response.status_code == 200
34+
assert 'Flag linux as out-of-date' in response.content.decode()
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)